|
2 | 2 |
|
3 | 3 | This connector enables Amazon Athena to access your Cloudera Hive databases.
|
4 | 4 |
|
5 |
| -**Athena Federated Queries are now enabled as GA in us-east-1, us-east-2, us-west-2, eu-west-1, ap-northeast-1, ap-south-1, us-west-1, ap-southeast-1, ap-southeast-2, eu-west-2, ap-northeast-2, eu-west-3, ca-central-1, sa-east-1, and eu-central-1. To use this feature, upgrade your engine version to Athena V2 in your workgroup settings. Check documentation here for more details: https://docs.aws.amazon.com/athena/latest/ug/engine-versions.html.** |
6 |
| - |
7 |
| -By using this connector, you acknowledge the inclusion of third party components, a list of which can be found in [`pom.xml`](https://github.com/awslabs/aws-athena-query-federation/blob/master/athena-cloudera-hive/pom.xml) and agree to the terms in their respective licenses, provided in [`LICENSE.txt`](https://github.com/awslabs/aws-athena-query-federation/blob/master/athena-cloudera-hive/LICENSE.txt). |
8 |
| - |
9 |
| -# Terms |
10 |
| - |
11 |
| -* **Database Instance:** Any instance of a database deployed on premises, EC2 or using RDS. |
12 |
| -* **Handler:** A Lambda handler accessing your database instance(s). Could be metadata or a record handler. |
13 |
| -* **Metadata Handler:** A Lambda handler that retrieves metadata from your database instance(s). |
14 |
| -* **Record Handler:** A Lambda handler that retrieves data records from your database instance(s). |
15 |
| -* **Composite Handler:** A Lambda handler that retrieves metadata and data records from your database instance(s). This is recommended to be set as lambda function handler. |
16 |
| -* **Multiplexing Handler:** a Lambda handler that can accept and use multiple different database connections. |
17 |
| -* **Property/Parameter:** A database property used by handlers to extract database information for connection. These are set as Lambda environment variables. |
18 |
| -* **Connection String:** Used to establish connection to a database instance. |
19 |
| -* **Catalog:** Athena Catalog. This is not a Glue Catalog. Must be used to prefix `connection_string` property. |
20 |
| - |
21 |
| -# Usage |
22 |
| - |
23 |
| -## Parameters |
24 |
| - |
25 |
| -The Cloudera Hive Connector supports several configuration parameters using Lambda environment variables. |
26 |
| - |
27 |
| -### Connection String: |
28 |
| - |
29 |
| -A JDBC Connection string is used to connect to a database instance. Following format is supported: `hive://${jdbc_connection_string}`. |
30 |
| - |
31 |
| -### Multiplexing handler parameters |
32 |
| - |
33 |
| -Multiplexer provides a way to connect to multiple database instances using a single Lambda function. Requests are routed depending on catalog name. Use following classes in Lambda for using multiplexer. |
34 |
| - |
35 |
| -|Handler|Class| |
36 |
| -|--- |--- | |
37 |
| -|Composite Handler|HiveMuxCompositeHandler| |
38 |
| -|Metadata Handler|HiveMuxMetadataHandler| |
39 |
| -|Record Handler|HiveMuxRecordHandler| |
40 |
| - |
41 |
| - |
42 |
| -**Parameters:** |
43 |
| - |
44 |
| -``` |
45 |
| -${catalog}_connection_string Database instance connection string. One of two types specified above. Required. |
46 |
| - Example: If the catalog as registered with Athena is myhivecatalog then the environment variable name should be myhivecatalog_connection_string |
47 |
| -
|
48 |
| -default Default connection string. Required. This will be used when catalog is `lambda:${AWS_LAMBDA_FUNCTION_NAME}`. |
49 |
| -``` |
50 |
| - |
51 |
| -Example properties for a Hive Mux Lambda function that supports two database instances, hive1host(default) and hive2host: |
52 |
| - |
53 |
| -|Property|Value| |
54 |
| -|---|---| |
55 |
| -|default|hive://jdbc:hive2://hive1host:10000/default?${Test/RDS/hive1host}| |
56 |
| -| | | |
57 |
| -|hive2_catalog1_connection_string|hive://jdbc:hive2://hive1host:10000/default?${Test/RDS/hive1host}| |
58 |
| -| | | |
59 |
| -|hive2_catalog2_connection_string|hive://jdbc:hive2://hive2host:10000/default?UID=sample&PWD=sample| |
60 |
| - |
61 |
| -Cloudera Hive Connector supports substitution of any string enclosed like *${SecretName}* with *username* and *password* retrieved from AWS Secrets Manager. Example: |
62 |
| - |
63 |
| -``` |
64 |
| -hive://jdbc:hive2://hive1host:10000/default?...&${Test/RDS/hive1host}&... |
65 |
| -``` |
66 |
| - |
67 |
| -will be modified to: |
68 |
| - |
69 |
| -``` |
70 |
| -hive://jdbc:hive2://hive1host:10000/default?...&UID=sample2&PWD=sample2&... |
71 |
| -``` |
72 |
| - |
73 |
| -Secret Name `Test/RDS/hive1host` will be used to retrieve secrets. |
74 |
| - |
75 |
| -Currently Cloudera Hive recognizes `UID` and `PWD` JDBC properties. |
76 |
| - |
77 |
| -### Single connection handler parameters |
78 |
| - |
79 |
| -Single connection metadata and record handlers can also be used to connect to a single cloudera Hive instance. |
80 |
| -``` |
81 |
| -Composite Handler HiveCompositeHandler |
82 |
| -Metadata Handler HiveMetadataHandler |
83 |
| -Record Handler HiveRecordHandler |
84 |
| -``` |
85 |
| - |
86 |
| -**Parameters:** |
87 |
| - |
88 |
| -``` |
89 |
| -default Default connection string. Required. This will be used when a catalog is not recognized. |
90 |
| -``` |
91 |
| - |
92 |
| -These handlers support one database instance and must provide `default` connection string parameter. All other connection strings are ignored. |
93 |
| - |
94 |
| -**Example property for a single Cloudera Hive instance supported by a Lambda function:** |
95 |
| - |
96 |
| -|Property|Value| |
97 |
| -|---|---| |
98 |
| -|default|hive://jdbc:hive2://hive1host:10000/default?secret=${Test/RDS/hive1host}| |
99 |
| - |
100 |
| -### Spill parameters: |
101 |
| - |
102 |
| -Lambda SDK may spill data to S3. All database instances accessed using a single Lambda spill to the same location. |
103 |
| - |
104 |
| -``` |
105 |
| -spill_bucket Spill bucket name. Required. |
106 |
| -spill_prefix Spill bucket key prefix. Required. |
107 |
| -spill_put_request_headers JSON encoded map of request headers and values for the s3 putObject request used for spilling. Example: `{"x-amz-server-side-encryption" : "AES256"}`. For more possible headers see: https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutObject.html |
108 |
| -``` |
109 |
| - |
110 |
| -# Data types support |
111 |
| - |
112 |
| -|Jdbc| *Cloudera Hive[] |Arrow| |
113 |
| -| ---|------------------|---| |
114 |
| -|Boolean| Boolean[] |Bit| |
115 |
| -|Integer| TINYINT[] |Tiny| |
116 |
| -|Short| SMALLINT[] |Smallint| |
117 |
| -|Integer| INT[] |Int| |
118 |
| -|Long| BIGINT[] |Bigint| |
119 |
| -|float| float4[] |Float4| |
120 |
| -|Double| float8[] |Float8| |
121 |
| -|Date| date[] |DateDay| |
122 |
| -|Timestamp| timestamp[] |DateMilli| |
123 |
| -|String| VARCHAR[] |Varchar| |
124 |
| -|Bytes| bytes[] |Varbinary| |
125 |
| -|BigDecimal| Decimal[] |Decimal| |
126 |
| -|**\*ARRAY**| **N/A** |List| |
127 |
| - |
128 |
| -See Cloudera Hive documentation for conversion between JDBC and database types. |
129 |
| - |
130 |
| -**\*NOTE**: The aggregate types (ARRAY, MAP, STRUCT, and UNIONTYPE) are not yet supported by Cloudera Hive. Columns of aggregate types are treated as VARCHAR columns in SQL and STRING columns in Java. |
131 |
| - |
132 |
| -# Secrets |
133 |
| - |
134 |
| -We support two ways to input database username and password: |
135 |
| - |
136 |
| -1. **AWS Secrets Manager:** The name of the secret in AWS Secrets Manager can be embedded in JDBC connection string, which is used to replace with `username` and `password` values from Secret. Support is tightly integrated for AWS RDS database instances. When using AWS RDS, we highly recommend using AWS Secrets Manager, including credential rotation. If your database is not using AWS RDS, store credentials as JSON in the following format `{“username”: “${username}”, “password”: “${password}”}.`. To use the Athena Federated Query feature with AWS Secrets Manager, the VPC connected to your Lambda function should have [internet access](https://aws.amazon.com/premiumsupport/knowledge-center/internet-access-lambda-function/) or a [VPC endpoint](https://docs.aws.amazon.com/secretsmanager/latest/userguide/vpc-endpoint-overview.html#vpc-endpoint-create) to connect to Secrets Manager. |
137 |
| -2. **Connection String:** Username and password can be specified as properties in the JDBC connection string. |
138 |
| - |
139 |
| -# Partitions and Splits |
140 |
| -A partition is represented by one partition column of type varchar. We leverage partitions as columns defined on a Cloudera Hive table, and these columns contains parition on columns information. For a table that does not have partition names, * is returned which is equivalent to a single partition. A partition is equivalent to a split. |
141 |
| - |
142 |
| -| Name | Type | Description | |
143 |
| -|-----------|---------|-------------| |
144 |
| -| partition | Varchar |Partition information on table columns| |
145 |
| - |
146 |
| -# Running Integration Tests |
147 |
| - |
148 |
| -The integration tests in this module are designed to run without the prior need for deploying the connector. Nevertheless, the integration tests will not run straight out-of-the-box. Certain build-dependencies are required for them to execute correctly. |
149 |
| -For build commands and step-by-step instructions on building and running the integration tests see the [Running Integration Tests](https://github.com/awslabs/aws-athena-query-federation/blob/master/athena-federation-integ-test/README.md#running-integration-tests) README section in the **athena-federation-integ-test** module. |
150 |
| - |
151 |
| -In addition to the build-dependencies, certain test configuration attributes must also be provided in the connector's [test-config.json](./etc/test-config.json) JSON file. |
152 |
| -For additional information about the test configuration file, see the [Test Configuration](https://github.com/awslabs/aws-athena-query-federation/blob/master/athena-federation-integ-test/README.md#test-configuration) README section in the **athena-federation-integ-test** module. |
153 |
| - |
154 |
| -Once all prerequisites have been satisfied, the integration tests can be executed by specifying the following command: `mvn failsafe:integration-test` from the connector's root directory. |
155 |
| -**Cloudera Hive integration Test suite will not create any Cloudera Hive service and Datasets, instead it will use existing Cloudera Hive databases. |
156 |
| - |
157 |
| -# Deploying The Connector |
158 |
| - |
159 |
| -To use this connector in your queries, navigate to AWS Serverless Application Repository and deploy a pre-built version of this connector. Alternatively, you can build and deploy this connector from |
160 |
| -source follow the below steps or use the more detailed tutorial in the athena-example module: |
161 |
| - |
162 |
| -1. From the **athena-federation-sdk** dir, run `mvn clean install` if you haven't already. |
163 |
| -2. From the **athena-federation-integ-test** dir, run `mvn clean install` if you haven't already |
164 |
| - (**Note: failure to follow this step will result in compilation errors**). |
165 |
| -3. From the **athena-jdbc** dir, run `mvn clean install`. |
166 |
| -4. From the **athena-cloudera-hive** dir, run `mvn clean install`. |
167 |
| -5. From the **athena-cloudera-hive** dir, run `../tools/publish.sh S3_BUCKET_NAME athena-hive2` to publish the connector to your private AWS Serverless Application Repository. The S3_BUCKET in the command is where a copy of the connector's code will be stored for Serverless Application Repository to retrieve it. This will allow users with permission to do so, the ability to deploy instances of the connector via 1-Click form. Then navigate to [Serverless Application Repository](https://aws.amazon.com/serverless/serverlessrepo) |
168 |
| - |
169 |
| -# JDBC Driver Versions |
170 |
| - |
171 |
| -For latest version information see [pom.xml](./pom.xml). |
172 |
| - |
173 |
| -# Limitations |
174 |
| -* Write DDL operations are not supported. |
175 |
| -* In Mux setup, spill bucket and prefix is shared across all database instances. |
176 |
| -* Any relevant Lambda Limits. See Lambda documentation. |
177 |
| - |
178 |
| -# Performance tuning |
179 |
| - |
180 |
| -Hive supports Static partitions. Athena's lambda connector can retrieve data from these partitions in parallel. We highly recommend static partitioning for retrieving huge datasets with uniform partition distribution. |
| 5 | +Documentation has moved [here](https://docs.aws.amazon.com/athena/latest/ug/connectors-cloudera-hive.html). |
0 commit comments