Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
IMPALA-5741: Initial support for reading tiny RDBMS tables
This patch uses the "external data source" mechanism in Impala to implement data source for querying JDBC. It has some limitations due to the restrictions of "external data source": - It is not distributed, e.g, fragment is unpartitioned. The queries are executed on coordinator. - Queries which read following data types from external JDBC tables are not supported: BINARY, CHAR, DATETIME, and COMPLEX. - Only support binary predicates with operators =, !=, <=, >=, <, > to be pushed to RDBMS. - Following data types are not supported for predicates: DECIMAL, TIMESTAMP, DATE, and BINARY. - External tables with complex types of columns are not supported. - Support is limited to the following databases: MySQL, Postgres, Oracle, MSSQL, H2, DB2, and JETHRO_DATA. - Catalog V2 is not supported (IMPALA-7131). - DataSource objects are not persistent (IMPALA-12375). Additional fixes are planned on top of this patch. Source files under jdbc/conf, jdbc/dao and jdbc/exception are replicated from Hive JDBC Storage Handler. In order to query the RDBMS tables, the following steps should be followed (note that existing data source table will be rebuilt): 1. Make sure the Impala cluster has been started. 2. Copy the jar files of JDBC drivers and the data source library into HDFS. ${IMPALA_HOME}/testdata/bin/copy-ext-data-sources.sh 3. Create an `alltypes` table in the Postgres database. ${IMPALA_HOME}/testdata/bin/load-ext-data-sources.sh 4. Create data source tables (alltypes_jdbc_datasource and alltypes_jdbc_datasource_2). ${IMPALA_HOME}/bin/impala-shell.sh -f\ ${IMPALA_HOME}/testdata/bin/create-ext-data-source-table.sql 5. It's ready to run query to access data source tables created in last step. Don't need to restart Impala cluster. Testing: - Added unit-test for Postgres and ran unit-test with JDBC driver postgresql-42.5.1.jar. - Ran manual unit-test for MySql with JDBC driver mysql-connector-j-8.1.0.jar. - Ran core tests successfully. Change-Id: I8244e978c7717c6f1452f66f1630b6441392e7d2 Reviewed-on: http://gerrit.cloudera.org:8080/17842 Reviewed-by: Wenzhe Zhou <wzhou@cloudera.com> Reviewed-by: Kurt Deschler <kdeschle@cloudera.com> Reviewed-by: Riza Suminto <riza.suminto@cloudera.com> Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
- Loading branch information
Showing
33 changed files
with
2,469 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
Licensed to the Apache Software Foundation (ASF) under one | ||
or more contributor license agreements. See the NOTICE file | ||
distributed with this work for additional information | ||
regarding copyright ownership. The ASF licenses this file | ||
to you under the Apache License, Version 2.0 (the | ||
"License"); you may not use this file except in compliance | ||
with the License. You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
--> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>org.apache.impala</groupId> | ||
<artifactId>impala-data-source</artifactId> | ||
<version>4.4.0-SNAPSHOT</version> | ||
</parent> | ||
<artifactId>impala-data-source-jdbc</artifactId> | ||
<name>Apache Impala External Data Source JDBC Library</name> | ||
<description>JDBC External Data Source</description> | ||
<packaging>jar</packaging> | ||
<url>.</url> | ||
|
||
<properties> | ||
<commons-dbcp2.version>2.9.0</commons-dbcp2.version> | ||
<h2database.version>1.3.166</h2database.version> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.apache.impala</groupId> | ||
<artifactId>impala-data-source-api</artifactId> | ||
<version>${project.version}</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.impala</groupId> | ||
<artifactId>impala-frontend</artifactId> | ||
<version>${project.version}</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.commons</groupId> | ||
<artifactId>commons-dbcp2</artifactId> | ||
<version>${commons-dbcp2.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.h2database</groupId> | ||
<artifactId>h2</artifactId> | ||
<version>${h2database.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<version>${junit.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>3.11.0</version> | ||
<configuration> | ||
<source>1.8</source> | ||
<target>1.8</target> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
Oops, something went wrong.