Stamatis Zampetakis created HIVE-29031:
------------------------------------------

             Summary: Setup Derby database in qtests via qt:database option
                 Key: HIVE-29031
                 URL: https://issues.apache.org/jira/browse/HIVE-29031
             Project: Hive
          Issue Type: Improvement
          Components: Testing Infrastructure
            Reporter: Stamatis Zampetakis
            Assignee: Stamatis Zampetakis


The goal of this jira is to add support for running Derby based tests using the 
qt:database directive that is already implemented for other databases.
{code:sql}
--!qt:database:derby:q_test_country_table.sql
CREATE EXTERNAL TABLE country
(
    id int,
    name varchar(20)
)
    STORED BY 'org.apache.hive.storage.jdbc.JdbcStorageHandler'
    TBLPROPERTIES (
        "hive.sql.database.type" = "DERBY",
        "hive.sql.jdbc.driver" = "org.apache.derby.jdbc.EmbeddedDriver",
        "hive.sql.jdbc.url" = 
"jdbc:derby:;databaseName=${system:test.tmp.dir}/qtestDB",
        "hive.sql.dbcp.username" = "qtestuser",
        "hive.sql.dbcp.password" = "qtestpassword",
        "hive.sql.dbcp.maxActive" = "1",
        "hive.sql.table" = "COUNTRY"
        );
SELECT * FROM country;
{code}
There are already qtests that are using Derby (e.g., external_jdbc_rowcount.q) 
but they are a bit messy to read and understand since they mix Derby and Hive 
queries in a single file. Moreover, the database life-cycle must be handled 
explicitly in the file creating race-conditions and flakiness.

Eventually, all the existing Derby qtests should be migrated to use the 
qt:database directive for improving readability and stability.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to