IMPALA-12789: Fix unit-test code JdbcDataSourceTest.java

The unit test `JdbcDataSourceTest.java` was originally
implemented using the H2 database, which is no longer
available in Impala's environment. The test code was
also outdated and erroneous.

This commit addresses and fixes the failure of
JdbcDataSourceTest.java and rewrites it in
Postgres, hence ensures compatibility with Impala's
current environment and aligns with JDBC and external
data source APIs. Please note, this test is moved to fe
folder to fix the BackendConfig instance not initialized
error.

To test this file, run the following command:
pushd fe && mvn -fae test -Dtest=JdbcDataSourceTest

Please note that the tests in JdbcDataSourceTest have a
dependency on previous tests and individual tests cannot be
ran separately for this class.
Change-Id: Ie07173d256d73c88f5a6c041f087db16b6ff3127
Reviewed-on: http://gerrit.cloudera.org:8080/21805
Reviewed-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
This commit is contained in:
Pranav Lodha
2024-06-24 15:24:11 -07:00
committed by Impala Public Jenkins
parent 071d176180
commit 907c1738a0
5 changed files with 87 additions and 81 deletions

View File

@@ -109,3 +109,23 @@ TBLPROPERTIES (
"dbcp.username"="hiveuser",
"dbcp.password"="password",
"table"="decimal_tbl");
DROP TABLE IF EXISTS test_strategy;
CREATE EXTERNAL TABLE IF NOT EXISTS test_strategy (
strategy_id INT,
name STRING,
referrer STRING,
landing STRING,
priority INT,
implementation STRING,
last_modified timestamp,
PRIMARY KEY (strategy_id) )
STORED BY JDBC
TBLPROPERTIES (
"database.type"="POSTGRES",
"jdbc.url"="jdbc:postgresql://localhost:5432/functional",
"jdbc.driver"="org.postgresql.Driver",
"driver.url"="/test-warehouse/data-sources/jdbc-drivers/postgresql-jdbc.jar",
"dbcp.username"="hiveuser",
"dbcp.password"="password",
"table"="test_strategy");