Files
impala/testdata/workloads/functional-query/queries/QueryTest/create-database.test
Joe McDonnell 0163a10332 IMPALA-9068: Use different directories for external vs managed warehouse
Hive 3 changed the typical storage model for tables to split them
between two directories:
 - hive.metastore.warehouse.dir stores managed tables (which is now
   defined to be only transactional tables)
 - hive.metastore.warehouse.external.dir stores external tables
   (everything that is not a transactional table)
In more recent commits of Hive, there is now validation that the
external tables cannot be stored in the managed directory. In order
to adopt these newer versions of Hive, we need to use separate
directories for external vs managed warehouses.

Most of our test tables are not transactional, so they would reside
in the external directory. To keep the test changes small, this uses
/test-warehouse for the external directory and /test-warehouse/managed
for the managed directory. Having the managed directory be a subdirectory
of /test-warehouse means that the data snapshot code should not need to
change.

The Hive 2 configuration doesn't change as it does not have this concept.

Since this changes the dataload layout, this also sets the CDH_MAJOR_VERSION
to 7 for USE_CDP_HIVE=true. This means that dataload will uses a separate
location for data as compared to USE_CDP_HIVE=false. That should reduce
conflicts between the two configurations.

Testing:
 - Ran exhaustive tests with USE_CDP_HIVE=false
 - Ran exhaustive tests with USE_CDP_HIVE=true (with current Hive version)
 - Verified that dataload succeeds and tests are able to run with a newer
   Hive version.

Change-Id: I3db69f1b8ca07ae98670429954f5f7a1a359eaec
Reviewed-on: http://gerrit.cloudera.org:8080/15026
Reviewed-by: Joe McDonnell <joemcdonnell@cloudera.com>
Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
2020-01-24 17:29:15 +00:00

133 lines
3.3 KiB
Plaintext

====
---- QUERY
create database $DATABASE_2 comment "For testing"
---- RESULTS
'Database has been created.'
====
---- QUERY
show databases like "$DATABASE_2"
---- RESULTS
'$DATABASE_2','For testing'
---- TYPES
STRING, STRING
====
---- QUERY
# Test that DESCRIBE shows the proper database location
# for a newly created database (regression test for IMPALA-7439)
describe database $DATABASE_2
---- RESULTS
'$DATABASE_2','$NAMENODE/$MANAGED_WAREHOUSE_DIR/$DATABASE_2.db','For testing'
---- TYPES
string, string, string
====
---- QUERY
# Test that DESCRIBE EXTENDED also has all of the necessary info.
describe database extended $DATABASE_2
---- RESULTS
'$DATABASE_2','$NAMENODE/$MANAGED_WAREHOUSE_DIR/$DATABASE_2.db','For testing'
'Owner: ','',''
'','$USER','USER'
---- TYPES
string, string, string
====
---- QUERY
# Make sure creating a database with the same name doesn't throw an error when
# IF NOT EXISTS is specified.
create database if not exists $DATABASE_2
---- RESULTS
'Database already exists.'
====
---- QUERY
# Test dropping the database.
drop database $DATABASE_2
---- RESULTS
'Database has been dropped.'
====
---- QUERY
show databases like "$DATABASE_2"
---- RESULTS
---- TYPES
STRING, STRING
====
---- QUERY
# Dropping a non-existent databases is ok with IF EXISTS
drop database if exists $DATABASE_2
---- RESULTS
'Database does not exist.'
====
---- QUERY
# Test DROP DATABASE ... CASCADE
create database if not exists $DATABASE_cascade
====
---- QUERY
create table if not exists $DATABASE_cascade.t1 (i int);
create table if not exists $DATABASE_cascade.t2 (i int)
partitioned by (year smallint, month smallint);
insert into $DATABASE_cascade.t2 partition (year=2015, month=8) values(1);
create external table if not exists $DATABASE_cascade.t3 like functional.alltypes
location '$FILESYSTEM_PREFIX/test-warehouse/alltypes_external';
create view if not exists $DATABASE_cascade.v1 as
select int_col from functional.alltypes;
create function if not exists $DATABASE_cascade.f1() returns string
location '$FILESYSTEM_PREFIX/test-warehouse/libTestUdfs.so' symbol='NoArgs';
create aggregate function if not exists $DATABASE_cascade.f2(int, string) RETURNS int
location '$FILESYSTEM_PREFIX/test-warehouse/libTestUdas.so' UPDATE_FN='TwoArgUpdate'
---- RESULTS
'Function has been created.'
====
---- QUERY
show tables in $DATABASE_cascade
---- RESULTS
't1'
't2'
't3'
'v1'
---- TYPES
STRING
====
---- QUERY
show functions in $DATABASE_cascade
---- RESULTS
'STRING','f1()','NATIVE','true'
---- TYPES
STRING, STRING, STRING, STRING
====
---- QUERY
show aggregate functions in $DATABASE_cascade
---- RESULTS
'INT','f2(INT, STRING)','NATIVE','true'
---- TYPES
STRING, STRING, STRING, STRING
====
---- QUERY
# Should drop all tables, functions, and aggregate functions, as well
# as the database itself.
drop database $DATABASE_cascade cascade
---- RESULTS
'Database has been dropped.'
====
---- QUERY
show databases like '$DATABASE_cascade'
---- RESULTS
====
---- QUERY
# Test that DROP DATABASE ... RESTRICT executes ok.
create database if not exists $DATABASE_restrict
====
---- QUERY
show databases like '$DATABASE_restrict'
---- RESULTS
'$DATABASE_restrict',''
---- TYPES
STRING,STRING
====
---- QUERY
drop database $DATABASE_restrict restrict
---- RESULTS
'Database has been dropped.'
====
---- QUERY
show databases like '$DATABASE_restrict'
---- RESULTS
====