impala-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mjac...@apache.org
Subject [4/5] incubator-impala git commit: IMPALA-3491: Use unique database fixture in test_ddl.py.
Date Fri, 02 Sep 2016 20:13:44 GMT
IMPALA-3491: Use unique database fixture in test_ddl.py.

Adds new parametrization to the unique database fixture:
- num_dbs: allows creating multiple unique databases at once;
  the 2nd, 3rd, etc. datbase name is generated by appending
  "2", "3", etc., to the first database name
- sync_ddl: allows creating the dabatases(s) with sync_ddl
  which is needed by most tests in test_ddl.py

Testing: I ran debug/core and debug/exhaustive on HDFS and
core/debug on S3. Also ran the test locally in a loop on
exhaustive.

Change-Id: Idf667dd5e960768879c019e2037cf48ad4e4241b
Reviewed-on: http://gerrit.cloudera.org:8080/4155
Reviewed-by: Alex Behm <alex.behm@cloudera.com>
Tested-by: Internal Jenkins


Project: http://git-wip-us.apache.org/repos/asf/incubator-impala/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-impala/commit/ab9e54bc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-impala/tree/ab9e54bc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-impala/diff/ab9e54bc

Branch: refs/heads/master
Commit: ab9e54bc4298549048b1935837e8e818d5b980ce
Parents: 16f1c8d
Author: Alex Behm <alex.behm@cloudera.com>
Authored: Tue May 10 01:01:32 2016 -0700
Committer: Internal Jenkins <cloudera-hudson@gerrit.cloudera.org>
Committed: Fri Sep 2 02:47:02 2016 +0000

----------------------------------------------------------------------
 .../queries/QueryTest/alter-table.test          | 186 +++---
 .../queries/QueryTest/create-database.test      |  57 +-
 .../QueryTest/create-table-as-select.test       |  10 +-
 .../QueryTest/create-table-like-file.test       |  32 +-
 .../queries/QueryTest/create-table.test         |  52 +-
 .../queries/QueryTest/functions-ddl.test        | 148 +----
 .../queries/QueryTest/truncate-table.test       |   9 +-
 .../queries/QueryTest/views-ddl.test            |  78 +--
 tests/common/parametrize.py                     |  23 +-
 tests/conftest.py                               |  73 ++-
 tests/metadata/test_ddl.py                      | 574 +++++++++----------
 tests/metadata/test_ddl_base.py                 |  22 -
 tests/metadata/test_hms_integration.py          |  34 +-
 13 files changed, 562 insertions(+), 736 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/ab9e54bc/testdata/workloads/functional-query/queries/QueryTest/alter-table.test
----------------------------------------------------------------------
diff --git a/testdata/workloads/functional-query/queries/QueryTest/alter-table.test b/testdata/workloads/functional-query/queries/QueryTest/alter-table.test
index 48d47b5..1f63c2b 100644
--- a/testdata/workloads/functional-query/queries/QueryTest/alter-table.test
+++ b/testdata/workloads/functional-query/queries/QueryTest/alter-table.test
@@ -1,11 +1,8 @@
 ====
 ---- QUERY
-use alter_table_test_db
----- RESULTS
-====
----- QUERY
 # First create an unpartitioned table
-create external table t1 (i int) location '$FILESYSTEM_PREFIX/test-warehouse/t1_tmp1'
+create external table t1 (i int)
+location '$FILESYSTEM_PREFIX/test-warehouse/$DATABASE.db/t1_tmp1'
 ---- RESULTS
 ====
 ---- QUERY
@@ -37,24 +34,26 @@ alter table t1 rename to t2
 show tables
 ---- RESULTS
 't2'
+'part_data'
 ---- TYPES
 string
 ====
 ---- QUERY
 # Move the table to a different database
-alter table t2 rename to alter_table_test_db2.t1_inotherdb
+alter table t2 rename to $DATABASE2.t1_inotherdb
 ---- RESULTS
 ====
 ---- QUERY
 # No longer appears in this database
 show tables
 ---- RESULTS
+'part_data'
 ---- TYPES
 string
 ====
 ---- QUERY
 # Shows up in the second database
-show tables in alter_table_test_db2
+show tables in $DATABASE2
 ---- RESULTS
 't1_inotherdb'
 ---- TYPES
@@ -62,7 +61,7 @@ string
 ====
 ---- QUERY
 # Move the table back to this database
-alter table alter_table_test_db2.t1_inotherdb rename to t2
+alter table $DATABASE2.t1_inotherdb rename to t2
 ---- RESULTS
 ====
 ---- QUERY
@@ -263,37 +262,25 @@ bigint,string,int,int
 # Create a partitioned table. Specify the location so we know what dirs need
 # to be cleaned after the test finishes executing.
 create external table t_part (i int) partitioned by (j int, s string)
-location '$FILESYSTEM_PREFIX/test-warehouse/t_part_tmp'
----- RESULTS
-====
----- QUERY
-alter table t_part add partition (j=cast(2-1 as int), s='2012')
----- RESULTS
-====
----- QUERY
-alter table t_part add if not exists partition (j=1, s='2012')
----- RESULTS
-====
----- QUERY
-alter table t_part add if not exists partition (j=1, s='2012/withslash')
----- RESULTS
-====
----- QUERY
-alter table t_part add partition (j=1, s=substring('foo2013bar', 4, 8))
+location '$FILESYSTEM_PREFIX/test-warehouse/$DATABASE.db/t_part_tmp';
+alter table t_part add partition (j=cast(2-1 as int), s='2012');
+alter table t_part add if not exists partition (j=1, s='2012');
+alter table t_part add if not exists partition (j=1, s='2012/withslash');
+alter table t_part add partition (j=1, s=substring('foo2013bar', 4, 8));
 ---- RESULTS
 ====
 ---- QUERY
 # Add another partition that points to the same location as another partition.
 # This will cause the data to be read twice, but shouldn't result in an error.
 alter table t_part add partition (j=100, s='same_location')
-location '$FILESYSTEM_PREFIX/test-warehouse/t_part_tmp/j=1/s=2012'
+location '$FILESYSTEM_PREFIX/test-warehouse/$DATABASE.db/t_part_tmp/j=1/s=2012'
 ---- RESULTS
 ====
 ---- QUERY
 # Add another partition that points to an existing data location that does not
 # follow the key=value directory structure.
 alter table t_part add partition (j=101, s='different_part_dir')
-location '$FILESYSTEM_PREFIX/test-warehouse/part_data/'
+location '$FILESYSTEM_PREFIX/test-warehouse/$DATABASE.db/part_data/'
 ---- RESULTS
 ====
 ---- QUERY
@@ -735,34 +722,34 @@ bigint,bigint
 # Tests that renaming a table with column stats across databases
 # preserves table and column stats, and allows the renamed table
 # to be dropped (IMPALA-1711/HIVE-9720).
-create table alter_table_test_db.mv (x int, y string);
-insert into alter_table_test_db.mv values(1, 'a'), (2, 'b'), (NULL, NULL);
-compute stats alter_table_test_db.mv;
-alter table alter_table_test_db.mv rename to alter_table_test_db2.mv2;
-invalidate metadata alter_table_test_db2.mv2
+create table $DATABASE.mv (x int, y string);
+insert into $DATABASE.mv values(1, 'a'), (2, 'b'), (NULL, NULL);
+compute stats $DATABASE.mv;
+alter table $DATABASE.mv rename to $DATABASE2.mv2;
+invalidate metadata $DATABASE2.mv2
 ---- RESULTS
 ====
 ---- QUERY
-show tables in alter_table_test_db like '%mv%'
+show tables in $DATABASE like '%mv%'
 ---- RESULTS
 ---- TYPES
 STRING
 ====
 ---- QUERY
-show tables in alter_table_test_db2 like '%mv%'
+show tables in $DATABASE2 like '%mv%'
 ---- RESULTS
 ---- TYPES
 STRING
 ====
 ---- QUERY
-show table stats alter_table_test_db2.mv2
+show table stats $DATABASE2.mv2
 ---- RESULTS
 3,1,'14B','NOT CACHED','NOT CACHED','TEXT','false',regex:.*
 ---- TYPES
 BIGINT, BIGINT, STRING, STRING, STRING, STRING, STRING, STRING
 ====
 ---- QUERY
-show column stats alter_table_test_db2.mv2
+show column stats $DATABASE2.mv2
 ---- RESULTS
 'x','INT',2,-1,4,4
 'y','STRING',2,-1,1,1
@@ -770,34 +757,19 @@ show column stats alter_table_test_db2.mv2
 STRING, STRING, BIGINT, BIGINT, INT, DOUBLE
 ====
 ---- QUERY
-drop table alter_table_test_db2.mv2
+drop table $DATABASE2.mv2
 ---- RESULTS
 ====
 ---- QUERY
-show tables in alter_table_test_db2 like '%mv%'
+show tables in $DATABASE2 like '%mv%'
 ---- RESULTS
 ---- TYPES
 STRING
 ====
 ---- QUERY
-# Test tblproperties and serdeproperties key and property value length
-create database if not exists test_alter_property_length_db
-====
----- QUERY
-show databases like 'test_alter_property_length_db'
----- RESULTS
-'test_alter_property_length_db',''
----- TYPES
-STRING,STRING
-====
----- QUERY
-drop table if exists test_alter_property_length_db.property_length
----- RESULTS
-====
----- QUERY
 # alter with serde property lengths just within limits
-create table test_alter_property_length_db.property_length (i int);
-alter table test_alter_property_length_db.property_length
+create table $DATABASE.property_length (i int);
+alter table $DATABASE.property_length
 set serdeproperties(
 'keykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeyk'
 =
@@ -807,7 +779,7 @@ set serdeproperties(
 ====
 ---- QUERY
 # alter with property lengths just within limits
-alter table test_alter_property_length_db.property_length
+alter table $DATABASE.property_length
 set tblproperties(
 'keykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeyk'
 =
@@ -816,28 +788,12 @@ set tblproperties(
 ---- RESULTS
 ====
 ---- QUERY
-drop table if exists test_alter_property_length_db.property_length
----- RESULTS
-====
----- QUERY
-# Need to switch databases before dropping
-use default;
-drop database if exists test_alter_property_length_db
----- RESULTS
-====
----- QUERY
-show databases like 'test_alter_property_length_db'
----- RESULTS
----- TYPES
-STRING,STRING
-====
----- QUERY
 -- Change table location after a partition has been created in the original table location
-create table alter_table_test_db.change_loc (s string) partitioned by (i int);
-insert into alter_table_test_db.change_loc partition (i=1) values ('a');
-alter table alter_table_test_db.change_loc
-  set location '$FILESYSTEM_PREFIX/test-warehouse/alter_table_test_db.db/garbage';
-select * from alter_table_test_db.change_loc;
+create table $DATABASE.change_loc (s string) partitioned by (i int);
+insert into $DATABASE.change_loc partition (i=1) values ('a');
+alter table $DATABASE.change_loc
+  set location '$FILESYSTEM_PREFIX/test-warehouse/$DATABASE.db/garbage';
+select * from $DATABASE.change_loc;
 ---- RESULTS
 'a',1
 ---- TYPES
@@ -847,21 +803,21 @@ STRING,INT
 -- ALTER TABLE .. SET LOCATION works when setting the location of a partition to be the
 -- the same as a partition of a different table with a different number of clustering
 -- columns.
-create table alter_table_test_db.table_one_part (s string) partitioned by (i int);
-create table alter_table_test_db.table_many_part (s string) partitioned by
+create table $DATABASE.table_one_part (s string) partitioned by (i int);
+create table $DATABASE.table_many_part (s string) partitioned by
   (i0 int, i1 int, i2 int, i3 int, i4 int, i5 int, i6 int, i7 int, i8 int, i9 int);
-insert into alter_table_test_db.table_one_part partition (i=0) values ('a');
-insert into alter_table_test_db.table_one_part partition (i=1) values ('b');
-insert into alter_table_test_db.table_many_part partition
+insert into $DATABASE.table_one_part partition (i=0) values ('a');
+insert into $DATABASE.table_one_part partition (i=1) values ('b');
+insert into $DATABASE.table_many_part partition
   (i0=0, i1=1, i2=2, i3=3, i4=4, i5=5, i6=6, i7=7, i8=8, i9=9) values ('c');
-insert into alter_table_test_db.table_many_part partition
+insert into $DATABASE.table_many_part partition
   (i0=10, i1=11, i2=12, i3=13, i4=14, i5=15, i6=16, i7=17, i8=18, i9=19) values ('d');
-alter table alter_table_test_db.table_one_part partition (i=1)
-  set location '$FILESYSTEM_PREFIX/test-warehouse/alter_table_test_db.db/table_many_part/i0=10/i1=11/i2=12/i3=13/i4=14/i5=15/i6=16/i7=17/i8=18/i9=19';
-alter table alter_table_test_db.table_many_part partition
+alter table $DATABASE.table_one_part partition (i=1)
+  set location '$FILESYSTEM_PREFIX/test-warehouse/$DATABASE.db/table_many_part/i0=10/i1=11/i2=12/i3=13/i4=14/i5=15/i6=16/i7=17/i8=18/i9=19';
+alter table $DATABASE.table_many_part partition
   (i0=10, i1=11, i2=12, i3=13, i4=14, i5=15, i6=16, i7=17, i8=18, i9=19)
-  set location '$FILESYSTEM_PREFIX/test-warehouse/alter_table_test_db.db/table_one_part/i=0/';
-select i,s from alter_table_test_db.table_one_part order by i;
+  set location '$FILESYSTEM_PREFIX/test-warehouse/$DATABASE.db/table_one_part/i=0/';
+select i,s from $DATABASE.table_one_part order by i;
 ---- RESULTS
 0,'a'
 1,'d'
@@ -870,7 +826,7 @@ INT,STRING
 ====
 ---- QUERY
 select i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, s
-from alter_table_test_db.table_many_part order by i0;
+from $DATABASE.table_many_part order by i0;
 ---- RESULTS
 0,1,2,3,4,5,6,7,8,9,'c'
 10,11,12,13,14,15,16,17,18,19,'a'
@@ -878,28 +834,28 @@ from alter_table_test_db.table_many_part order by i0;
 INT,INT,INT,INT,INT,INT,INT,INT,INT,INT,STRING
 ====
 ---- QUERY
-show partitions alter_table_test_db.table_one_part
+show partitions $DATABASE.table_one_part
 ---- RESULTS
-'0',-1,1,regex:.+,regex:.+,regex:.+,regex:.+,regex:.+,regex:.*/test-warehouse/alter_table_test_db.db/table_one_part/i=0
-'1',-1,1,regex:.+,regex:.+,regex:.+,regex:.+,regex:.+,regex:.*/test-warehouse/alter_table_test_db.db/table_many_part/i0=10/i1=11/i2=12/i3=13/i4=14/i5=15/i6=16/i7=17/i8=18/i9=19
+'0',-1,1,regex:.+,regex:.+,regex:.+,regex:.+,regex:.+,regex:.*/test-warehouse/$DATABASE.db/table_one_part/i=0
+'1',-1,1,regex:.+,regex:.+,regex:.+,regex:.+,regex:.+,regex:.*/test-warehouse/$DATABASE.db/table_many_part/i0=10/i1=11/i2=12/i3=13/i4=14/i5=15/i6=16/i7=17/i8=18/i9=19
 'Total',-1,2,regex:.+,regex:.+,'','','',''
 ---- TYPES
 STRING, BIGINT, BIGINT, STRING, STRING, STRING, STRING, STRING, STRING
 ====
 ---- QUERY
-show partitions alter_table_test_db.table_many_part
+show partitions $DATABASE.table_many_part
 ---- RESULTS
-'0','1','2','3','4','5','6','7','8','9',-1,1,regex:.+,regex:.+,regex:.+,regex:.+,regex:.+,regex:.*/test-warehouse/alter_table_test_db.db/table_many_part/i0=0/i1=1/i2=2/i3=3/i4=4/i5=5/i6=6/i7=7/i8=8/i9=9
-'10','11','12','13','14','15','16','17','18','19',-1,1,regex:.+,regex:.+,regex:.+,regex:.+,regex:.+,regex:.*/test-warehouse/alter_table_test_db.db/table_one_part/i=0
+'0','1','2','3','4','5','6','7','8','9',-1,1,regex:.+,regex:.+,regex:.+,regex:.+,regex:.+,regex:.*/test-warehouse/$DATABASE.db/table_many_part/i0=0/i1=1/i2=2/i3=3/i4=4/i5=5/i6=6/i7=7/i8=8/i9=9
+'10','11','12','13','14','15','16','17','18','19',-1,1,regex:.+,regex:.+,regex:.+,regex:.+,regex:.+,regex:.*/test-warehouse/$DATABASE.db/table_one_part/i=0
 'Total','','','','','','','','','',-1,2,regex:.+,regex:.+,'','','',''
 ---- TYPES
 STRING, STRING, STRING, STRING, STRING, STRING, STRING, STRING, STRING, STRING, BIGINT, BIGINT, STRING, STRING, STRING, STRING, STRING, STRING
 ====
 ---- QUERY
 -- Refreshing the tables does not create invalid partition locations
-refresh alter_table_test_db.table_one_part;
-refresh alter_table_test_db.table_many_part;
-select i,s from alter_table_test_db.table_one_part order by i;
+refresh $DATABASE.table_one_part;
+refresh $DATABASE.table_many_part;
+select i,s from $DATABASE.table_one_part order by i;
 ---- RESULTS
 0,'a'
 1,'d'
@@ -908,7 +864,7 @@ INT,STRING
 ====
 ---- QUERY
 select i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, s
-from alter_table_test_db.table_many_part order by i0;
+from $DATABASE.table_many_part order by i0;
 ---- RESULTS
 0,1,2,3,4,5,6,7,8,9,'c'
 10,11,12,13,14,15,16,17,18,19,'a'
@@ -916,28 +872,28 @@ from alter_table_test_db.table_many_part order by i0;
 INT,INT,INT,INT,INT,INT,INT,INT,INT,INT,STRING
 ====
 ---- QUERY
-show partitions alter_table_test_db.table_one_part
+show partitions $DATABASE.table_one_part
 ---- RESULTS
-'0',-1,1,regex:.+,regex:.+,regex:.+,regex:.+,regex:.+,regex:.*/test-warehouse/alter_table_test_db.db/table_one_part/i=0
-'1',-1,1,regex:.+,regex:.+,regex:.+,regex:.+,regex:.+,regex:.*/test-warehouse/alter_table_test_db.db/table_many_part/i0=10/i1=11/i2=12/i3=13/i4=14/i5=15/i6=16/i7=17/i8=18/i9=19
+'0',-1,1,regex:.+,regex:.+,regex:.+,regex:.+,regex:.+,regex:.*/test-warehouse/$DATABASE.db/table_one_part/i=0
+'1',-1,1,regex:.+,regex:.+,regex:.+,regex:.+,regex:.+,regex:.*/test-warehouse/$DATABASE.db/table_many_part/i0=10/i1=11/i2=12/i3=13/i4=14/i5=15/i6=16/i7=17/i8=18/i9=19
 'Total',-1,2,regex:.+,regex:.+,'','','',''
 ---- TYPES
 STRING, BIGINT, BIGINT, STRING, STRING, STRING, STRING, STRING, STRING
 ====
 ---- QUERY
-show partitions alter_table_test_db.table_many_part
+show partitions $DATABASE.table_many_part
 ---- RESULTS
-'0','1','2','3','4','5','6','7','8','9',-1,1,regex:.+,regex:.+,regex:.+,regex:.+,regex:.+,regex:.*/test-warehouse/alter_table_test_db.db/table_many_part/i0=0/i1=1/i2=2/i3=3/i4=4/i5=5/i6=6/i7=7/i8=8/i9=9
-'10','11','12','13','14','15','16','17','18','19',-1,1,regex:.+,regex:.+,regex:.+,regex:.+,regex:.+,regex:.*/test-warehouse/alter_table_test_db.db/table_one_part/i=0
+'0','1','2','3','4','5','6','7','8','9',-1,1,regex:.+,regex:.+,regex:.+,regex:.+,regex:.+,regex:.*/test-warehouse/$DATABASE.db/table_many_part/i0=0/i1=1/i2=2/i3=3/i4=4/i5=5/i6=6/i7=7/i8=8/i9=9
+'10','11','12','13','14','15','16','17','18','19',-1,1,regex:.+,regex:.+,regex:.+,regex:.+,regex:.+,regex:.*/test-warehouse/$DATABASE.db/table_one_part/i=0
 'Total','','','','','','','','','',-1,2,regex:.+,regex:.+,'','','',''
 ---- TYPES
 STRING, STRING, STRING, STRING, STRING, STRING, STRING, STRING, STRING, STRING, BIGINT, BIGINT, STRING, STRING, STRING, STRING, STRING, STRING
 ====
 ---- QUERY
 -- Altering the table location does not alter the partition locations
-alter table alter_table_test_db.table_one_part set location '$FILESYSTEM_PREFIX/garbage/';
-alter table alter_table_test_db.table_many_part set location '$FILESYSTEM_PREFIX/garbage/';
-select i,s from alter_table_test_db.table_one_part order by i;
+alter table $DATABASE.table_one_part set location '$FILESYSTEM_PREFIX/garbage/';
+alter table $DATABASE.table_many_part set location '$FILESYSTEM_PREFIX/garbage/';
+select i,s from $DATABASE.table_one_part order by i;
 ---- RESULTS
 0,'a'
 1,'d'
@@ -946,7 +902,7 @@ INT,STRING
 ====
 ---- QUERY
 select i0, i1, i2, i3, i4, i5, i6, i7, i8, i9, s
-from alter_table_test_db.table_many_part order by i0;
+from $DATABASE.table_many_part order by i0;
 ---- RESULTS
 0,1,2,3,4,5,6,7,8,9,'c'
 10,11,12,13,14,15,16,17,18,19,'a'
@@ -954,19 +910,19 @@ from alter_table_test_db.table_many_part order by i0;
 INT,INT,INT,INT,INT,INT,INT,INT,INT,INT,STRING
 ====
 ---- QUERY
-show partitions alter_table_test_db.table_one_part
+show partitions $DATABASE.table_one_part
 ---- RESULTS
-'0',-1,1,regex:.+,regex:.+,regex:.+,regex:.+,regex:.+,regex:.*/test-warehouse/alter_table_test_db.db/table_one_part/i=0
-'1',-1,1,regex:.+,regex:.+,regex:.+,regex:.+,regex:.+,regex:.*/test-warehouse/alter_table_test_db.db/table_many_part/i0=10/i1=11/i2=12/i3=13/i4=14/i5=15/i6=16/i7=17/i8=18/i9=19
+'0',-1,1,regex:.+,regex:.+,regex:.+,regex:.+,regex:.+,regex:.*/test-warehouse/$DATABASE.db/table_one_part/i=0
+'1',-1,1,regex:.+,regex:.+,regex:.+,regex:.+,regex:.+,regex:.*/test-warehouse/$DATABASE.db/table_many_part/i0=10/i1=11/i2=12/i3=13/i4=14/i5=15/i6=16/i7=17/i8=18/i9=19
 'Total',-1,2,regex:.+,regex:.+,'','','',''
 ---- TYPES
 STRING, BIGINT, BIGINT, STRING, STRING, STRING, STRING, STRING, STRING
 ====
 ---- QUERY
-show partitions alter_table_test_db.table_many_part
+show partitions $DATABASE.table_many_part
 ---- RESULTS
-'0','1','2','3','4','5','6','7','8','9',-1,1,regex:.+,regex:.+,regex:.+,regex:.+,regex:.+,regex:.*/test-warehouse/alter_table_test_db.db/table_many_part/i0=0/i1=1/i2=2/i3=3/i4=4/i5=5/i6=6/i7=7/i8=8/i9=9
-'10','11','12','13','14','15','16','17','18','19',-1,1,regex:.+,regex:.+,regex:.+,regex:.+,regex:.+,regex:.*/test-warehouse/alter_table_test_db.db/table_one_part/i=0
+'0','1','2','3','4','5','6','7','8','9',-1,1,regex:.+,regex:.+,regex:.+,regex:.+,regex:.+,regex:.*/test-warehouse/$DATABASE.db/table_many_part/i0=0/i1=1/i2=2/i3=3/i4=4/i5=5/i6=6/i7=7/i8=8/i9=9
+'10','11','12','13','14','15','16','17','18','19',-1,1,regex:.+,regex:.+,regex:.+,regex:.+,regex:.+,regex:.*/test-warehouse/$DATABASE.db/table_one_part/i=0
 'Total','','','','','','','','','',-1,2,regex:.+,regex:.+,'','','',''
 ---- TYPES
 STRING, STRING, STRING, STRING, STRING, STRING, STRING, STRING, STRING, STRING, BIGINT, BIGINT, STRING, STRING, STRING, STRING, STRING, STRING

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/ab9e54bc/testdata/workloads/functional-query/queries/QueryTest/create-database.test
----------------------------------------------------------------------
diff --git a/testdata/workloads/functional-query/queries/QueryTest/create-database.test b/testdata/workloads/functional-query/queries/QueryTest/create-database.test
index d2dc7c4..1fcf85c 100644
--- a/testdata/workloads/functional-query/queries/QueryTest/create-database.test
+++ b/testdata/workloads/functional-query/queries/QueryTest/create-database.test
@@ -1,65 +1,58 @@
 ====
 ---- QUERY
-create database create_db_test comment "For testing"
+create database $DATABASE_2 comment "For testing"
 ---- RESULTS
 ====
 ---- QUERY
-show databases like "create_db_test"
+show databases like "$DATABASE_2"
 ---- RESULTS
-'create_db_test','For testing'
+'$DATABASE_2','For testing'
 ---- TYPES
 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 create_db_test
+create database if not exists $DATABASE_2
 ---- RESULTS
 ====
 ---- QUERY
 # Test dropping the database.
-drop database create_db_test
+drop database $DATABASE_2
 ---- RESULTS
 ====
 ---- QUERY
-show databases like "create_db_test"
+show databases like "$DATABASE_2"
 ---- RESULTS
 ---- TYPES
 STRING, STRING
 ====
 ---- QUERY
 # Dropping a non-existent databases is ok with IF EXISTS
-drop database if exists create_db_test
+drop database if exists $DATABASE_2
 ---- RESULTS
 ====
 ---- QUERY
 # Test DROP DATABASE ... CASCADE
-create database if not exists test_drop_cascade_db
+create database if not exists $DATABASE_cascade
 ====
 ---- QUERY
-show databases like 'test_drop_cascade_db'
----- RESULTS
-'test_drop_cascade_db',''
----- TYPES
-STRING,STRING
-====
----- QUERY
-create table if not exists test_drop_cascade_db.t1 (i int);
-create table if not exists test_drop_cascade_db.t2 (i int)
+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 test_drop_cascade_db.t2 partition (year=2015, month=8) values(1);
-create external table if not exists test_drop_cascade_db.t3 like functional.alltypes
+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 test_drop_cascade_db.v1 as
+create view if not exists $DATABASE_cascade.v1 as
   select int_col from functional.alltypes;
-create function if not exists test_drop_cascade_db.f1() returns string
+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 test_drop_cascade_db.f2(int, string) RETURNS int
+create aggregate function if not exists $DATABASE_cascade.f2(int, string) RETURNS int
   location '$FILESYSTEM_PREFIX/test-warehouse/libTestUdas.so' UPDATE_FN='TwoArgUpdate'
 ---- RESULTS
 ====
 ---- QUERY
-show tables in test_drop_cascade_db
+show tables in $DATABASE_cascade
 ---- RESULTS
 't1'
 't2'
@@ -69,14 +62,14 @@ show tables in test_drop_cascade_db
 STRING
 ====
 ---- QUERY
-show functions in test_drop_cascade_db
+show functions in $DATABASE_cascade
 ---- RESULTS
 'STRING','f1()','NATIVE','true'
 ---- TYPES
 STRING, STRING, STRING, STRING
 ====
 ---- QUERY
-show aggregate functions in test_drop_cascade_db
+show aggregate functions in $DATABASE_cascade
 ---- RESULTS
 'INT','f2(INT, STRING)','NATIVE','true'
 ---- TYPES
@@ -85,29 +78,29 @@ STRING, STRING, STRING, STRING
 ---- QUERY
 # Should drop all tables, functions, and aggregate functions, as well
 # as the database itself.
-drop database test_drop_cascade_db cascade
+drop database $DATABASE_cascade cascade
 ---- RESULTS
 ====
 ---- QUERY
-show databases like 'test_drop_cascade_db'
+show databases like '$DATABASE_cascade'
 ---- RESULTS
 ====
 ---- QUERY
 # Test that DROP DATABASE ... RESTRICT executes ok.
-create database if not exists test_drop_restrict_db
+create database if not exists $DATABASE_restrict
 ====
 ---- QUERY
-show databases like 'test_drop_restrict_db'
+show databases like '$DATABASE_restrict'
 ---- RESULTS
-'test_drop_restrict_db',''
+'$DATABASE_restrict',''
 ---- TYPES
 STRING,STRING
 ====
 ---- QUERY
-drop database test_drop_restrict_db restrict
+drop database $DATABASE_restrict restrict
 ---- RESULTS
 ====
 ---- QUERY
-show databases like 'test_drop_restrict_db'
+show databases like '$DATABASE_restrict'
 ---- RESULTS
 ====

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/ab9e54bc/testdata/workloads/functional-query/queries/QueryTest/create-table-as-select.test
----------------------------------------------------------------------
diff --git a/testdata/workloads/functional-query/queries/QueryTest/create-table-as-select.test b/testdata/workloads/functional-query/queries/QueryTest/create-table-as-select.test
index 4c626de..2178589 100644
--- a/testdata/workloads/functional-query/queries/QueryTest/create-table-as-select.test
+++ b/testdata/workloads/functional-query/queries/QueryTest/create-table-as-select.test
@@ -155,7 +155,7 @@ INT, BOOLEAN, TINYINT, TINYINT, TINYINT, TINYINT, TINYINT, TINYINT, STRING, STRI
 ====
 ---- QUERY
 # Test creating a partitioned Parquet table with CTAS.
-create table ddl_test_db.ctas_part_alltypestiny
+create table $DATABASE.ctas_part_alltypestiny
 partitioned by (year,month) stored as parquet
 as select * from functional.alltypestiny
 ---- RESULTS
@@ -163,7 +163,7 @@ as select * from functional.alltypestiny
 ====
 ---- QUERY
 select id, float_col, timestamp_col, string_col, year, month
-from ddl_test_db.ctas_part_alltypestiny
+from $DATABASE.ctas_part_alltypestiny
 ---- RESULTS
 0,0,2009-01-01 00:00:00,'0',2009,1
 1,1.100000023841858,2009-01-01 00:01:00,'1',2009,1
@@ -178,12 +178,8 @@ INT,FLOAT,TIMESTAMP,STRING,INT,INT
 ====
 ---- QUERY
 # IMPALA-2711: Make sure no memory leak from Rand().
-create table ddl_test_db.rand_ctas as select rand() from functional.alltypes;
+create table $DATABASE.rand_ctas as select rand() from functional.alltypes;
 ---- RESULTS
 'Inserted 7300 row(s)'
 ---- ERRORS
 ====
----- QUERY
-drop table if exists ddl_test_db.rand_ctas;
----- RESULTS
-====
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/ab9e54bc/testdata/workloads/functional-query/queries/QueryTest/create-table-like-file.test
----------------------------------------------------------------------
diff --git a/testdata/workloads/functional-query/queries/QueryTest/create-table-like-file.test b/testdata/workloads/functional-query/queries/QueryTest/create-table-like-file.test
index 79d16cc..313275c 100644
--- a/testdata/workloads/functional-query/queries/QueryTest/create-table-like-file.test
+++ b/testdata/workloads/functional-query/queries/QueryTest/create-table-like-file.test
@@ -1,11 +1,11 @@
 ====
 ---- QUERY
-create table ddl_test_db.temp_decimal_table like parquet
+create table $DATABASE.temp_decimal_table like parquet
 '$FILESYSTEM_PREFIX/test-warehouse/schemas/decimal.parquet'
 ---- RESULTS
 ====
 ---- QUERY
-describe ddl_test_db.temp_decimal_table
+describe $DATABASE.temp_decimal_table
 ---- RESULTS
 'd32','decimal(3,2)','Inferred from Parquet file.'
 'd11','decimal(1,1)','Inferred from Parquet file.'
@@ -14,12 +14,12 @@ describe ddl_test_db.temp_decimal_table
 STRING, STRING, STRING
 ====
 ---- QUERY
-create table ddl_test_db.like_zipcodes_file like parquet
+create table $DATABASE.like_zipcodes_file like parquet
 '$FILESYSTEM_PREFIX/test-warehouse/schemas/zipcode_incomes.parquet'
 ---- RESULTS
 ====
 ---- QUERY
-describe ddl_test_db.like_zipcodes_file
+describe $DATABASE.like_zipcodes_file
 ---- RESULTS
 'id','string','Inferred from Parquet file.'
 'zip','string','Inferred from Parquet file.'
@@ -30,12 +30,12 @@ describe ddl_test_db.like_zipcodes_file
 STRING, STRING, STRING
 ====
 ---- QUERY
-create table ddl_test_db.like_alltypestiny_file like parquet
+create table $DATABASE.like_alltypestiny_file like parquet
 '$FILESYSTEM_PREFIX/test-warehouse/schemas/alltypestiny.parquet'
 ---- RESULTS
 ====
 ---- QUERY
-describe ddl_test_db.like_alltypestiny_file
+describe $DATABASE.like_alltypestiny_file
 ---- RESULTS
 'id','int','Inferred from Parquet file.'
 'bool_col','boolean','Inferred from Parquet file.'
@@ -54,13 +54,13 @@ STRING, STRING, STRING
 ---- QUERY
 # Make sure creating a table with the same name doesn't throw an error when
 # IF NOT EXISTS is specified.
-create table if not exists ddl_test_db.like_alltypestiny_file like parquet
+create table if not exists $DATABASE.like_alltypestiny_file like parquet
 '$FILESYSTEM_PREFIX/test-warehouse/schemas/zipcode_incomes.parquet'
 ---- RESULTS
 ====
 ---- QUERY
 # Should not have changed since last statement was IF NOT EXISTS.
-describe ddl_test_db.like_alltypestiny_file
+describe $DATABASE.like_alltypestiny_file
 ---- RESULTS
 'id','int','Inferred from Parquet file.'
 'bool_col','boolean','Inferred from Parquet file.'
@@ -111,16 +111,16 @@ drop table allcomplextypes_clone
 ---- RESULTS
 ====
 ---- QUERY
-drop table if exists ddl_test_db.temp_legacy_table
+drop table if exists $DATABASE.temp_legacy_table
 ---- RESULTS
 ====
 ---- QUERY
-create table ddl_test_db.temp_legacy_table like parquet
+create table $DATABASE.temp_legacy_table like parquet
 '$FILESYSTEM_PREFIX/test-warehouse/schemas/legacy_nested.parquet'
 ---- RESULTS
 ====
 ---- QUERY
-describe ddl_test_db.temp_legacy_table
+describe $DATABASE.temp_legacy_table
 ---- RESULTS
 't_long','bigint','Inferred from Parquet file.'
 't_struct','struct<\n  f_int:int,\n  t_struct:struct<\n    f_int:int,\n    f_int2:int\n  >,\n  int_arr:array<int>,\n  int_map:map<string,int>\n>','Inferred from Parquet file.'
@@ -136,20 +136,20 @@ describe ddl_test_db.temp_legacy_table
 STRING, STRING, STRING
 ====
 ---- QUERY
-drop table if exists ddl_test_db.temp_legacy_table
+drop table if exists $DATABASE.temp_legacy_table
 ---- RESULTS
 ====
 ---- QUERY
-drop table if exists ddl_test_db.temp_modern_table
+drop table if exists $DATABASE.temp_modern_table
 ---- RESULTS
 ====
 ---- QUERY
-create table ddl_test_db.temp_modern_table like parquet
+create table $DATABASE.temp_modern_table like parquet
 '$FILESYSTEM_PREFIX/test-warehouse/schemas/modern_nested.parquet'
 ---- RESULTS
 ====
 ---- QUERY
-describe ddl_test_db.temp_modern_table
+describe $DATABASE.temp_modern_table
 ---- RESULTS
 't_long','bigint','Inferred from Parquet file.'
 't_struct','struct<\n  f_int:int,\n  t_struct:struct<\n    f_int:int,\n    f_int2:int\n  >,\n  int_arr:array<int>,\n  int_map:map<string,int>\n>','Inferred from Parquet file.'
@@ -165,6 +165,6 @@ describe ddl_test_db.temp_modern_table
 STRING, STRING, STRING
 ====
 ---- QUERY
-drop table if exists ddl_test_db.temp_modern_table
+drop table if exists $DATABASE.temp_modern_table
 ---- RESULTS
 ====

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/ab9e54bc/testdata/workloads/functional-query/queries/QueryTest/create-table.test
----------------------------------------------------------------------
diff --git a/testdata/workloads/functional-query/queries/QueryTest/create-table.test b/testdata/workloads/functional-query/queries/QueryTest/create-table.test
index f3b9dda..e66fb6f 100644
--- a/testdata/workloads/functional-query/queries/QueryTest/create-table.test
+++ b/testdata/workloads/functional-query/queries/QueryTest/create-table.test
@@ -1,24 +1,12 @@
 ====
 ---- QUERY
-# This database is expected to have been created.
-show databases like 'ddl_test_db'
----- RESULTS
-'ddl_test_db',''
----- TYPES
-STRING,STRING
-====
----- QUERY
-show tables in ddl_test_db
----- RESULTS
-====
----- QUERY
-create table ddl_test_db.testtbl(i int, s string COMMENT 'String col') STORED AS TEXTFILE
+create table $DATABASE.testtbl(i int, s string COMMENT 'String col') STORED AS TEXTFILE
 ---- RESULTS
 ====
 ---- QUERY
 # Make sure creating a table with the same name doesn't throw an error when
 # IF NOT EXISTS is specified.
-create table if not exists ddl_test_db.testtbl(i int, s string)
+create table if not exists $DATABASE.testtbl(i int, s string)
 ROW FORMAT DELIMITED
 FIELDS TERMINATED BY '\t'
 ESCAPED BY '\\'
@@ -27,14 +15,14 @@ STORED AS TEXTFILE
 ---- RESULTS
 ====
 ---- QUERY
-show tables in ddl_test_db
+show tables in $DATABASE
 ---- RESULTS
 'testtbl'
 ---- TYPES
 STRING
 ====
 ---- QUERY
-describe ddl_test_db.testtbl
+describe $DATABASE.testtbl
 ---- RESULTS
 'i','int',''
 's','string','String col'
@@ -42,13 +30,13 @@ describe ddl_test_db.testtbl
 STRING, STRING, STRING
 ====
 ---- QUERY
-insert overwrite table ddl_test_db.testtbl SELECT 1, 'Hi'
+insert overwrite table $DATABASE.testtbl SELECT 1, 'Hi'
 from functional.alltypes limit 10
 ---- RESULTS
 : 10
 ====
 ---- QUERY
-select * from ddl_test_db.testtbl
+select * from $DATABASE.testtbl
 ---- RESULTS
 1,'Hi'
 1,'Hi'
@@ -64,12 +52,12 @@ select * from ddl_test_db.testtbl
 INT, STRING
 ====
 ---- QUERY
-create table ddl_test_db.testtbl_part(i int, s string) PARTITIONED BY (id int comment 'C')
+create table $DATABASE.testtbl_part(i int, s string) PARTITIONED BY (id int comment 'C')
 ---- RESULTS
 ====
 ---- QUERY
 # Partition columns are displayed as part of DESCRIBE <table>
-describe ddl_test_db.testtbl_part
+describe $DATABASE.testtbl_part
 ---- RESULTS
 'i','int',''
 's','string',''
@@ -78,19 +66,19 @@ describe ddl_test_db.testtbl_part
 STRING, STRING, STRING
 ====
 ---- QUERY
-insert overwrite table ddl_test_db.testtbl_part partition(id=1)
+insert overwrite table $DATABASE.testtbl_part partition(id=1)
 select 10, 'Ten' from functional.alltypes limit 1
 ---- RESULTS
 id=1/: 1
 ====
 ---- QUERY
-insert overwrite table ddl_test_db.testtbl_part partition(id=2)
+insert overwrite table $DATABASE.testtbl_part partition(id=2)
 select 20, 'Twenty' from functional.alltypes limit 2
 ---- RESULTS
 id=2/: 2
 ====
 ---- QUERY
-select * from ddl_test_db.testtbl_part
+select * from $DATABASE.testtbl_part
 ---- RESULTS
 10,'Ten',1
 20,'Twenty',2
@@ -99,17 +87,13 @@ select * from ddl_test_db.testtbl_part
 INT, STRING, INT
 ====
 ---- QUERY
-select * from ddl_test_db.testtbl_part where id = 1
+select * from $DATABASE.testtbl_part where id = 1
 ---- RESULTS
 10,'Ten',1
 ---- TYPES
 INT, STRING, INT
 ====
 ---- QUERY
-use ddl_test_db
----- RESULTS
-====
----- QUERY
 show tables
 ---- RESULTS
 'testtbl'
@@ -224,7 +208,7 @@ drop table if exists non_existent_db.tbl
 ====
 ---- QUERY
 # Test table creation with tblproperty and serdeproperty lengths just within limits
-create table ddl_test_db.short_properties (i int)
+create table $DATABASE.short_properties (i int)
 with serdeproperties(
 'keykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeykeyk'
 =
@@ -237,10 +221,6 @@ with serdeproperties(
 ---- RESULTS
 ====
 ---- QUERY
-drop table if exists test_property_length_db.short_properties
----- RESULTS
-====
----- QUERY
 # IMPALA-1740: Test setting the skip.header.line.count tblproperty
 create table skip_header_test_a (i1 integer) tblproperties('skip.header.line.count'='2')
 ---- RESULTS
@@ -267,13 +247,13 @@ Invalid value for table property skip.header.line.count:
 # IMPALA-2820: Test keywords as struct-field names. All field names below are
 # Impala keywords, but only some of them are quoted to show that a mix of
 # quoted/unquoted identifiers is possible.
-create table ddl_test_db.struct_keywords (
+create table $DATABASE.struct_keywords (
   s struct<table:int,`comment`:string,`select`:decimal(8,2)>,
   a array<struct<`replace`:boolean,`location`:varchar(10)>>,
   m map<string,struct<`fields`:int,from:timestamp>>
 )
 partitioned by (year int, month int);
-describe ddl_test_db.struct_keywords;
+describe $DATABASE.struct_keywords;
 ---- RESULTS
 's','struct<\n  table:int,\n  comment:string,\n  select:decimal(8,2)\n>',''
 'a','array<struct<\n  replace:boolean,\n  location:varchar(10)\n>>',''
@@ -289,7 +269,7 @@ select
   a.`replace`, a.`location`,
   m.key, m.`fields`, m.`from`,
   year, month
-from ddl_test_db.struct_keywords t, t.a, t.m
+from $DATABASE.struct_keywords t, t.a, t.m
 ---- RESULTS
 ---- TYPES
 INT, STRING, DECIMAL, BOOLEAN, STRING, STRING, INT, TIMESTAMP, INT, INT

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/ab9e54bc/testdata/workloads/functional-query/queries/QueryTest/functions-ddl.test
----------------------------------------------------------------------
diff --git a/testdata/workloads/functional-query/queries/QueryTest/functions-ddl.test b/testdata/workloads/functional-query/queries/QueryTest/functions-ddl.test
index 754a19b..c1a80ff 100644
--- a/testdata/workloads/functional-query/queries/QueryTest/functions-ddl.test
+++ b/testdata/workloads/functional-query/queries/QueryTest/functions-ddl.test
@@ -1,85 +1,43 @@
 ====
 ---- QUERY
-# Drop the dummy udfs this test uses.
-drop function if exists default.fn();
-drop function if exists function_ddl_test.fn();
-drop function if exists function_ddl_test.fn(int);
-drop function if exists function_ddl_test.fn(int, string);
-drop function if exists function_ddl_test.fn(string, int);
-drop function if exists function_ddl_test.fn2(int);
-drop function if exists function_ddl_test.fn2(int, string);
-drop function if exists function_ddl_test.fn_var_arg(int...);
-drop function if exists function_ddl_test.agg_fn(int);
-drop function if exists function_ddl_test.agg_fn(int, string);
-====
----- QUERY
-# Verify all the test functions are removed
-show functions in function_ddl_test
----- LABELS
-return type, signature, binary type, is persistent
----- RESULTS
----- TYPES
-STRING, STRING, STRING, STRING
-====
----- QUERY
-# Verify all the test functions are removed
-show aggregate functions in function_ddl_test
----- RESULTS
----- TYPES
-STRING, STRING, STRING, STRING
-====
----- QUERY
-# Add them and test function overloading and scoping.
-create function default.fn() RETURNS int
-LOCATION '$FILESYSTEM_PREFIX/test-warehouse/libTestUdfs.so' SYMBOL='Fn'
-====
----- QUERY
-create function function_ddl_test.fn() RETURNS int
+# Add functions and test function overloading and scoping.
+create function $DATABASE.fn() RETURNS int
 LOCATION '$FILESYSTEM_PREFIX/test-warehouse/libTestUdfs.so' SYMBOL='Fn'
 ====
 ---- QUERY
-create function function_ddl_test.fn(int) RETURNS double
+create function $DATABASE.fn(int) RETURNS double
 LOCATION '$FILESYSTEM_PREFIX/test-warehouse/libTestUdfs.so' SYMBOL='Fn'
 ====
 ---- QUERY
-create function function_ddl_test.fn(int, string) RETURNS int
+create function $DATABASE.fn(int, string) RETURNS int
 LOCATION '$FILESYSTEM_PREFIX/test-warehouse/libTestUdfs.so' SYMBOL='Fn'
 ====
 ---- QUERY
-create function function_ddl_test.fn(string, int) RETURNS int
+create function $DATABASE.fn(string, int) RETURNS int
 LOCATION '$FILESYSTEM_PREFIX/test-warehouse/libTestUdfs.so' SYMBOL='Fn'
 ====
 ---- QUERY
-create function function_ddl_test.fn2(int) RETURNS int
+create function $DATABASE.fn2(int) RETURNS int
 LOCATION '$FILESYSTEM_PREFIX/test-warehouse/libTestUdfs.so' SYMBOL='Fn2'
 ====
 ---- QUERY
-create function function_ddl_test.fn2(int, string) RETURNS int
+create function $DATABASE.fn2(int, string) RETURNS int
 LOCATION '$FILESYSTEM_PREFIX/test-warehouse/libTestUdfs.so' SYMBOL='Fn2'
 ====
 ---- QUERY
-create function function_ddl_test.fn_var_arg(int...) RETURNS int
+create function $DATABASE.fn_var_arg(int...) RETURNS int
 LOCATION '$FILESYSTEM_PREFIX/test-warehouse/libTestUdfs.so' SYMBOL='VarSum'
 ====
 ---- QUERY
-create aggregate function function_ddl_test.agg_fn(int) RETURNS bigint
+create aggregate function $DATABASE.agg_fn(int) RETURNS bigint
 LOCATION '$FILESYSTEM_PREFIX/test-warehouse/libudasample.so' UPDATE_FN='CountUpdate'
 ====
 ---- QUERY
-create aggregate function function_ddl_test.agg_fn(int, string) RETURNS int
+create aggregate function $DATABASE.agg_fn(int, string) RETURNS int
 LOCATION '$FILESYSTEM_PREFIX/test-warehouse/libTestUdas.so' UPDATE_FN='TwoArgUpdate'
 ====
 ---- QUERY
-show functions in default
----- LABELS
-return type, signature, binary type, is persistent
----- RESULTS
-'INT','fn()','NATIVE','true'
----- TYPES
-STRING, STRING, STRING, STRING
-====
----- QUERY
-show functions in function_ddl_test
+show functions in $DATABASE
 ---- LABELS
 return type, signature, binary type, is persistent
 ---- RESULTS
@@ -94,7 +52,7 @@ return type, signature, binary type, is persistent
 STRING, STRING, STRING, STRING
 ====
 ---- QUERY
-show aggregate functions in function_ddl_test
+show aggregate functions in $DATABASE
 ---- RESULTS
 'BIGINT','agg_fn(INT)','NATIVE','true'
 'INT','agg_fn(INT, STRING)','NATIVE','true'
@@ -103,26 +61,15 @@ STRING, STRING, STRING, STRING
 ====
 ---- QUERY
 # Check that none of the functions show up as analytic functions.
-show analytic functions in function_ddl_test
+show analytic functions in $DATABASE
 ---- RESULTS
 ---- TYPES
 STRING, STRING, STRING, STRING
 ====
 ---- QUERY
-show create function default.fn
+show create function $DATABASE.fn_var_arg
 ---- RESULTS: MULTI_LINE
-['CREATE FUNCTION default.fn()
- RETURNS INT
- LOCATION '$NAMENODE/test-warehouse/libTestUdfs.so'
- SYMBOL='_Z2FnPN10impala_udf15FunctionContextE'
-']
----- TYPES
-STRING
-====
----- QUERY
-show create function function_ddl_test.fn_var_arg
----- RESULTS: MULTI_LINE
-['CREATE FUNCTION function_ddl_test.fn_var_arg(INT...)
+['CREATE FUNCTION $DATABASE.fn_var_arg(INT...)
  RETURNS INT
  LOCATION '$NAMENODE/test-warehouse/libTestUdfs.so'
  SYMBOL='_Z6VarSumPN10impala_udf15FunctionContextEiPKNS_6IntValE'
@@ -131,16 +78,16 @@ show create function function_ddl_test.fn_var_arg
 STRING
 ====
 ---- QUERY
-show create aggregate function function_ddl_test.agg_fn
+show create aggregate function $DATABASE.agg_fn
 ---- RESULTS: MULTI_LINE
-['CREATE AGGREGATE FUNCTION function_ddl_test.agg_fn(INT)
+['CREATE AGGREGATE FUNCTION $DATABASE.agg_fn(INT)
  RETURNS BIGINT
  LOCATION '$NAMENODE/test-warehouse/libudasample.so'
  UPDATE_FN='_Z11CountUpdatePN10impala_udf15FunctionContextERKNS_6IntValEPNS_9BigIntValE'
  INIT_FN='_Z9CountInitPN10impala_udf15FunctionContextEPNS_9BigIntValE'
  MERGE_FN='_Z10CountMergePN10impala_udf15FunctionContextERKNS_9BigIntValEPS2_'
  FINALIZE_FN='_Z13CountFinalizePN10impala_udf15FunctionContextERKNS_9BigIntValE'
-CREATE AGGREGATE FUNCTION function_ddl_test.agg_fn(INT, STRING)
+CREATE AGGREGATE FUNCTION $DATABASE.agg_fn(INT, STRING)
  RETURNS INT
  LOCATION '$NAMENODE/test-warehouse/libTestUdas.so'
  UPDATE_FN='_Z12TwoArgUpdatePN10impala_udf15FunctionContextERKNS_6IntValERKNS_9StringValEPS2_'
@@ -205,7 +152,7 @@ CREATE AGGREGATE FUNCTION _impala_builtins.avg(TIMESTAMP)
 STRING
 ====
 ---- QUERY
-drop function function_ddl_test.fn2(int, string)
+drop function $DATABASE.fn2(int, string)
 ====
 ---- QUERY
 show functions
@@ -222,10 +169,10 @@ return type, signature, binary type, is persistent
 STRING, STRING, STRING, STRING
 ====
 ---- QUERY
-drop function if exists function_ddl_test.fn2(int, string)
+drop function if exists $DATABASE.fn2(int, string)
 ====
 ---- QUERY
-show functions in function_ddl_test
+show functions in $DATABASE
 ---- LABELS
 return type, signature, binary type, is persistent
 ---- RESULTS
@@ -239,27 +186,7 @@ return type, signature, binary type, is persistent
 STRING, STRING, STRING, STRING
 ====
 ---- QUERY
-show functions in default;
----- LABELS
-return type, signature, binary type, is persistent
----- RESULTS
-'INT','fn()','NATIVE','true'
----- TYPES
-STRING, STRING, STRING, STRING
-====
----- QUERY
-drop function default.fn()
-====
----- QUERY
-show functions in default;
----- LABELS
-return type, signature, binary type, is persistent
----- RESULTS
----- TYPES
-STRING, STRING, STRING, STRING
-====
----- QUERY
-show functions in function_ddl_test;
+show functions in $DATABASE;
 ---- LABELS
 return type, signature, binary type, is persistent
 ---- RESULTS
@@ -314,37 +241,6 @@ show aggregate functions
 STRING, STRING, STRING, STRING
 ====
 ---- QUERY
-# Call invalidate metadata and make sure the functions are still there
-invalidate metadata
----- RESULTS
----- TYPES
-====
----- QUERY
-show functions
----- LABELS
-return type, signature, binary type, is persistent
----- RESULTS
-'INT','fn2(INT)','NATIVE','true'
-'DOUBLE','fn(INT)','NATIVE','true'
-'INT','fn(INT, STRING)','NATIVE','true'
-'INT','fn(STRING, INT)','NATIVE','true'
----- TYPES
-STRING, STRING, STRING, STRING
-====
----- QUERY
-show aggregate functions
----- RESULTS
-'INT','agg_fn(INT, STRING)','NATIVE','true'
----- TYPES
-STRING, STRING, STRING, STRING
-====
----- QUERY
-show analytic functions
----- RESULTS
----- TYPES
-STRING, STRING, STRING, STRING
-====
----- QUERY
 # Negative test for showing builtin scalar functions. The result
 # should not contain aggregate or analytic functions. Note that
 # the result must be non-empty for the test to suceed.

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/ab9e54bc/testdata/workloads/functional-query/queries/QueryTest/truncate-table.test
----------------------------------------------------------------------
diff --git a/testdata/workloads/functional-query/queries/QueryTest/truncate-table.test b/testdata/workloads/functional-query/queries/QueryTest/truncate-table.test
index 19480ff..9a4c16e 100644
--- a/testdata/workloads/functional-query/queries/QueryTest/truncate-table.test
+++ b/testdata/workloads/functional-query/queries/QueryTest/truncate-table.test
@@ -1,7 +1,8 @@
 ====
 ---- QUERY
 # First create a partitioned table
-create table t1 like functional.alltypes location '$FILESYSTEM_PREFIX/test-warehouse/t1';
+create table t1 like functional.alltypes
+location '$FILESYSTEM_PREFIX/test-warehouse/$DATABASE.db/t1';
 insert into t1 partition(year, month) select * from functional.alltypes;
 compute incremental stats t1;
 show table stats t1;
@@ -117,7 +118,8 @@ STRING, STRING, BIGINT, BIGINT, INT, DOUBLE
 ====
 ---- QUERY
 # Create an unpartitioned table.
-create table t2 like functional.tinytable location '$FILESYSTEM_PREFIX/test-warehouse/t2';
+create table t2 like functional.tinytable
+location '$FILESYSTEM_PREFIX/test-warehouse/$DATABASE.db/t2';
 insert into t2 select * from functional.tinytable;
 compute incremental stats t2;
 show table stats t2;
@@ -167,7 +169,8 @@ truncate table if exists non_existent;
 ====
 ---- QUERY
 # Create an unpartitioned table.
-create table t3 like functional.tinytable location '$FILESYSTEM_PREFIX/test-warehouse/t3';
+create table t3 like functional.tinytable
+location '$FILESYSTEM_PREFIX/test-warehouse/$DATABASE.db/t3';
 insert into t3 select * from functional.tinytable;
 select count(*) from t3;
 ---- RESULTS

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/ab9e54bc/testdata/workloads/functional-query/queries/QueryTest/views-ddl.test
----------------------------------------------------------------------
diff --git a/testdata/workloads/functional-query/queries/QueryTest/views-ddl.test b/testdata/workloads/functional-query/queries/QueryTest/views-ddl.test
index a30a668..b62955e 100644
--- a/testdata/workloads/functional-query/queries/QueryTest/views-ddl.test
+++ b/testdata/workloads/functional-query/queries/QueryTest/views-ddl.test
@@ -1,13 +1,13 @@
 ====
 ---- QUERY
 # Create a simple view without renaming the columns.
-create view ddl_test_db.simple_view as
+create view $DATABASE.simple_view as
 select * from functional.alltypes
 ---- RESULTS
 ====
 ---- QUERY
 # Test that 'if not exists' swallows the error (view already exists)
-create view if not exists ddl_test_db.simple_view as
+create view if not exists $DATABASE.simple_view as
 select * from functional.alltypesagg
 ---- RESULTS
 ====
@@ -15,19 +15,19 @@ select * from functional.alltypesagg
 # Create another simple view with 'if not exists' on a subset of
 # alltypes' columns using custom column names and comments
 create view if not exists
-ddl_test_db.simple_view_sub (x, y comment 'hello', z) as
+$DATABASE.simple_view_sub (x, y comment 'hello', z) as
 select int_col, string_col, timestamp_col from functional.alltypes
 ---- RESULTS
 ====
 ---- QUERY
 # Create a view on a parquet table (Hive cannot create/read/write parquet)
-create view ddl_test_db.parquet_view as
+create view $DATABASE.parquet_view as
 select * from functional_parquet.alltypes where id < 20
 ---- RESULTS
 ====
 ---- QUERY
 # Create a complex view with predicates, joins, aggregates and order by
-create view ddl_test_db.complex_view (abc comment 'agg', xyz comment 'gby') as
+create view $DATABASE.complex_view (abc comment 'agg', xyz comment 'gby') as
 select count(a.bigint_col), b.string_col from
 functional.alltypesagg a inner join functional.alltypestiny b
 on a.id = b.id where a.bigint_col < 50
@@ -37,13 +37,13 @@ order by b.string_col limit 100
 ====
 ---- QUERY
 # Create a view on a view
-create view ddl_test_db.view_view (aaa, bbb) as
-select * from ddl_test_db.complex_view
+create view $DATABASE.view_view (aaa, bbb) as
+select * from $DATABASE.complex_view
 ---- RESULTS
 ====
 ---- QUERY
 # Test that the views are displayed by 'show tables'
-show tables in ddl_test_db
+show tables in $DATABASE
 ---- RESULTS
 'complex_view'
 'parquet_view'
@@ -53,7 +53,7 @@ show tables in ddl_test_db
 ====
 ---- QUERY
 # Test that the views can be described
-describe ddl_test_db.simple_view
+describe $DATABASE.simple_view
 ---- RESULTS
 'id','int',''
 'bool_col','boolean',''
@@ -72,7 +72,7 @@ describe ddl_test_db.simple_view
 string,string,string
 ====
 ---- QUERY
-describe ddl_test_db.simple_view_sub
+describe $DATABASE.simple_view_sub
 ---- RESULTS
 'x','int',''
 'y','string','hello'
@@ -81,7 +81,7 @@ describe ddl_test_db.simple_view_sub
 string,string,string
 ====
 ---- QUERY
-describe ddl_test_db.complex_view
+describe $DATABASE.complex_view
 ---- RESULTS
 'abc','bigint','agg'
 'xyz','string','gby'
@@ -89,7 +89,7 @@ describe ddl_test_db.complex_view
 string,string,string
 ====
 ---- QUERY
-describe ddl_test_db.parquet_view
+describe $DATABASE.parquet_view
 ---- RESULTS
 'id','int',''
 'bool_col','boolean',''
@@ -108,7 +108,7 @@ describe ddl_test_db.parquet_view
 string,string,string
 ====
 ---- QUERY
-describe ddl_test_db.view_view
+describe $DATABASE.view_view
 ---- RESULTS
 'aaa','bigint',''
 'bbb','string',''
@@ -117,35 +117,35 @@ string,string,string
 ====
 ---- QUERY
 # Test that the views can be queried.
-select count(*) from ddl_test_db.simple_view
+select count(*) from $DATABASE.simple_view
 ---- RESULTS
 7300
 ---- TYPES
 bigint
 ====
 ---- QUERY
-select count(*) from ddl_test_db.simple_view_sub
+select count(*) from $DATABASE.simple_view_sub
 ---- RESULTS
 7300
 ---- TYPES
 bigint
 ====
 ---- QUERY
-select count(*) from ddl_test_db.complex_view
+select count(*) from $DATABASE.complex_view
 ---- RESULTS
 2
 ---- TYPES
 bigint
 ====
 ---- QUERY
-select count(*) from ddl_test_db.parquet_view
+select count(*) from $DATABASE.parquet_view
 ---- RESULTS
 20
 ---- TYPES
 bigint
 ====
 ---- QUERY
-select count(*) from ddl_test_db.view_view
+select count(*) from $DATABASE.view_view
 ---- RESULTS
 2
 ---- TYPES
@@ -153,12 +153,12 @@ bigint
 ====
 ---- QUERY
 # Test dropping a view
-drop view ddl_test_db.simple_view_sub
+drop view $DATABASE.simple_view_sub
 ---- RESULTS
 ====
 ---- QUERY
 # Test that the view is gone
-show tables in ddl_test_db
+show tables in $DATABASE
 ---- RESULTS
 'complex_view'
 'parquet_view'
@@ -167,28 +167,28 @@ show tables in ddl_test_db
 ====
 ---- QUERY
 # Test 'if exists' for dropping a view (view does not exist)
-drop view if exists ddl_test_db.bad_view
+drop view if exists $DATABASE.bad_view
 ---- RESULTS
 ====
 ---- QUERY
 # Test 'if exists' does not drop a table with same name
-create table ddl_test_db.drop_tbl_test(a int)
+create table $DATABASE.drop_tbl_test(a int)
 ---- RESULTS
 ====
 ---- QUERY
-drop view if exists ddl_test_db.drop_tbl_test
+drop view if exists $DATABASE.drop_tbl_test
 ---- RESULTS
 ====
 ---- QUERY
 # Test drop table 'if exists' does not drop a view with same name.
 # We try to drop a table with name complex_view and it should should
 # still be listed in the subsequent show tables output (as a view).
-drop table if exists ddl_test_db.complex_view
+drop table if exists $DATABASE.complex_view
 ---- RESULTS
 ====
 ---- QUERY
 # Test that the table is present
-show tables in ddl_test_db
+show tables in $DATABASE
 ---- RESULTS
 'drop_tbl_test'
 'complex_view'
@@ -198,17 +198,17 @@ show tables in ddl_test_db
 ====
 ---- QUERY
 # Test renaming a view
-alter view ddl_test_db.view_view rename to ddl_test_db.view_on_view
+alter view $DATABASE.view_view rename to $DATABASE.view_on_view
 ---- RESULTS
 ====
 ---- QUERY
 # Test renaming a parquet view
-alter view ddl_test_db.parquet_view rename to ddl_test_db.new_parquet_view
+alter view $DATABASE.parquet_view rename to $DATABASE.new_parquet_view
 ---- RESULTS
 ====
 ---- QUERY
 # Test that the view was renamed
-show tables in ddl_test_db
+show tables in $DATABASE
 ---- RESULTS
 'drop_tbl_test'
 'complex_view'
@@ -218,14 +218,14 @@ show tables in ddl_test_db
 ====
 ---- QUERY
 # Test altering a with a new definition
-alter view ddl_test_db.new_parquet_view as
+alter view $DATABASE.new_parquet_view as
 select bigint_col, string_col from functional_parquet.alltypesagg
 where bigint_col is null limit 10
 ---- RESULTS
 ====
 ---- QUERY
 # Test querying the altered view
-select count(bigint_col), count(string_col) from ddl_test_db.new_parquet_view
+select count(bigint_col), count(string_col) from $DATABASE.new_parquet_view
 ---- RESULTS
 0,10
 ---- TYPES
@@ -233,12 +233,12 @@ bigint,bigint
 ====
 ---- QUERY
 # Create a view on a constant select and try to query it.
-create view ddl_test_db.const_view
+create view $DATABASE.const_view
 as select 1, 'a', cast(10.0 as float)
 ---- RESULTS
 ====
 ---- QUERY
-select * from ddl_test_db.const_view
+select * from $DATABASE.const_view
 ---- RESULTS
 1,'a',10
 ---- TYPES
@@ -247,14 +247,14 @@ tinyint,string,float
 ---- QUERY
 # Test that parentheses are preserved in view creation.
 # If the parentheses were ignored the query would return a count > 0.
-create view ddl_test_db.paren_view as
+create view $DATABASE.paren_view as
 select count(*) from functional.alltypessmall
 where true and (true or false) and false
 ---- RESULTS
 ====
 ---- QUERY
 # Test that parentheses are preserved in view creation.
-select * from ddl_test_db.paren_view
+select * from $DATABASE.paren_view
 ---- RESULTS
 0
 ---- TYPES
@@ -262,13 +262,13 @@ bigint
 ====
 ---- QUERY
 # Create a view with decimal columns. Regression test for IMPALA-1021.
-create view ddl_test_db.decimal_view as
+create view $DATABASE.decimal_view as
 select * from functional.decimal_tbl
 ---- RESULTS
 ====
 ---- QUERY
 # Query a view with decimal columns. Regression test for IMPALA-1021.
-select * from ddl_test_db.decimal_view
+select * from $DATABASE.decimal_view
 ---- RESULTS
 1234,2222,1.2345678900,0.12345678900000000000000000000000000000,12345.78900,1
 12345,333,123.4567890000,0.12345678900000000000000000000000000000,11.22000,1
@@ -281,14 +281,14 @@ decimal,decimal,decimal,decimal,decimal,decimal
 ---- QUERY
 # Test that plan hints are stored in the view as end-of-line commented hints
 # for view-compatibility with Hive.
-create view ddl_test_db.hints_test as
+create view $DATABASE.hints_test as
 select /* +straight_join */ a.* from functional.alltypestiny a
 inner join /* +broadcast */ functional.alltypes b on a.id = b.id
 inner join /* +shuffle */ functional.alltypessmall c on b.id = c.id
 ---- RESULTS
 ====
 ---- QUERY
-describe formatted ddl_test_db.hints_test
+describe formatted $DATABASE.hints_test
 ---- TYPES
 string,string,string
 ---- RESULTS: VERIFY_IS_SUBSET
@@ -310,7 +310,7 @@ string,string,string
 ====
 ---- QUERY
 # Test querying the hinted view.
-select count(*) from ddl_test_db.hints_test
+select count(*) from $DATABASE.hints_test
 ---- RESULTS
 8
 ---- TYPES

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/ab9e54bc/tests/common/parametrize.py
----------------------------------------------------------------------
diff --git a/tests/common/parametrize.py b/tests/common/parametrize.py
index 02cf707..0ba4205 100644
--- a/tests/common/parametrize.py
+++ b/tests/common/parametrize.py
@@ -25,10 +25,19 @@ from tests.common.patterns import is_valid_impala_identifier
 class UniqueDatabase(object):
 
   @staticmethod
-  def parametrize(name_prefix='test_db'):
-    name_prefix = str(name_prefix)
-    if not is_valid_impala_identifier(name_prefix):
-      raise ValueError('name_prefix "{0}" is not a valid Impala identifier; check '
-                       'value for long length or invalid '
-                       'characters.'.format(name_prefix))
-    return pytest.mark.parametrize('unique_database', [name_prefix], indirect=True)
+  def parametrize(name_prefix=None, sync_ddl=False, num_dbs=1):
+    named_params = {}
+    if name_prefix is not None:
+      name_prefix = str(name_prefix)
+      if not is_valid_impala_identifier(name_prefix):
+        raise ValueError('name_prefix "{0}" is not a valid Impala identifier; check '
+                         'value for long length or invalid '
+                         'characters.'.format(name_prefix))
+      named_params["name_prefix"] = name_prefix
+    if not isinstance(sync_ddl, bool):
+      raise ValueError('value {0} of sync_ddl is be a boolean'.format(sync_ddl))
+    named_params["sync_ddl"] = sync_ddl
+    if not isinstance(num_dbs, int) or num_dbs <= 0:
+      raise ValueError("num_dbs must be an integer >= 1 but '{0}' given".format(num_dbs))
+    named_params["num_dbs"] = num_dbs
+    return pytest.mark.parametrize('unique_database', [named_params], indirect=True)

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/ab9e54bc/tests/conftest.py
----------------------------------------------------------------------
diff --git a/tests/conftest.py b/tests/conftest.py
index 259f43f..3193c9e 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -213,18 +213,26 @@ def unique_database(request, testid_checksum):
 
     from tests.common.parametrize import UniqueDatabase
 
-    @UniqueDatabase.parametrize(name_prefix='mydb')
+    @UniqueDatabase.parametrize(name_prefix='mydb', num_dbs=3, sync_ddl=True)
     def test_something(self, vector, unique_database):
-      # fixture creates database mydb_48A80F
+      # fixture creates databases mydb_48A80F, mydb_48A80F2, mydb_48A80F3 with sync_ddl
       self.client.execute('DROP TABLE IF EXISTS `{0}`.`mytable`'.format(unique_database))
       # test does other stuff with the unique_database name as needed
 
-  The supported parameter:
+  The supported parameters:
 
-    name_prefix: string (defaults to test function __name__) - prefix to be used for the
-    database name
+    name_prefix: string (defaults to test function __name__)
+      - prefix to be used for the database name
 
-  For a similar DB-API 2 compliant connection/cursor that use HS2 see the 'conn' and
+    num_dbs: integer (defaults to 1)
+      - number of unique databases to create
+      - the name of the 2nd, 3rd, etc. databases are generated by appending "2", "3",
+        etc., to the first database name (which does not have a "1" suffix)
+
+    sync_ddl: boolean (defaults to False)
+      - indicates whether the unique database should be created with sync_ddl
+
+  For a similar DB-API 2 compliant connection/cursor that uses HS2 see the 'conn' and
   'unique_cursor' fixtures below.
   """
 
@@ -233,32 +241,47 @@ def unique_database(request, testid_checksum):
                                        'the fixture must guarantee unique per-test '
                                        'databases.')
 
-  db_name_prefix = getattr(request, 'param', request.function.__name__)
-
-  db_name = '{0}_{1}'.format(db_name_prefix, testid_checksum)
-  if not is_valid_impala_identifier(db_name):
-    raise ValueError('Unique database name "{0}" is not a valid Impala identifer; check '
-                     'test function name or any prefixes for long length or invalid '
-                     'characters.'.format(db_name))
+  db_name_prefix = request.function.__name__
+  sync_ddl = False
+  num_dbs = 1
+  fixture_params = getattr(request, 'param', None)
+  if fixture_params is not None:
+    if "name_prefix" in fixture_params: db_name_prefix = fixture_params["name_prefix"]
+    if "sync_ddl" in fixture_params: sync_ddl = fixture_params["sync_ddl"]
+    if "num_dbs" in fixture_params: num_dbs = fixture_params["num_dbs"]
+
+  first_db_name = '{0}_{1}'.format(db_name_prefix, testid_checksum)
+  db_names = [first_db_name]
+  for i in range(2, num_dbs + 1):
+    db_names.append(first_db_name + str(i))
+  for db_name in db_names:
+    if not is_valid_impala_identifier(db_name):
+      raise ValueError('Unique database name "{0}" is not a valid Impala identifer; check '
+                       'test function name or any prefixes for long length or invalid '
+                       'characters.'.format(db_name))
 
   def cleanup():
     # Make sure we don't try to drop the current session database
     request.instance.execute_query_expect_success(request.instance.client, "use default")
-    request.instance.execute_query_expect_success(
-        request.instance.client, 'DROP DATABASE `{0}` CASCADE'.format(db_name))
-    LOG.info('Dropped database "{0}" for test ID "{1}"'.format(db_name,
-                                                               str(request.node.nodeid)))
+    for db_name in db_names:
+      request.instance.execute_query_expect_success(
+          request.instance.client, 'DROP DATABASE `{0}` CASCADE'.format(db_name),
+          {'sync_ddl': sync_ddl})
+      LOG.info('Dropped database "{0}" for test ID "{1}"'.format(db_name,
+                                                          str(request.node.nodeid)))
 
   request.addfinalizer(cleanup)
 
-  request.instance.execute_query_expect_success(
-      request.instance.client, 'DROP DATABASE IF EXISTS `{0}` CASCADE'.format(db_name))
-  request.instance.execute_query_expect_success(
-      request.instance.client, 'CREATE DATABASE `{0}`'.format(db_name))
-  LOG.info('Created database "{0}" for test ID "{1}"'.format(db_name,
-                                                             str(request.node.nodeid)))
-  return db_name
-
+  for db_name in db_names:
+    request.instance.execute_query_expect_success(
+        request.instance.client, 'DROP DATABASE IF EXISTS `{0}` CASCADE'.format(db_name),
+        {'sync_ddl': sync_ddl})
+    request.instance.execute_query_expect_success(
+        request.instance.client, 'CREATE DATABASE `{0}`'.format(db_name),
+        {'sync_ddl': sync_ddl})
+    LOG.info('Created database "{0}" for test ID "{1}"'.format(db_name,
+                                                               str(request.node.nodeid)))
+  return first_db_name
 
 @pytest.yield_fixture
 def kudu_client():


Mime
View raw message