mirror of
https://github.com/apache/impala.git
synced 2026-01-01 09:00:42 -05:00
This is the first in a series of patches to clean up test_ddl.py
Summary of changes:
- Break up test_create() and corresponding .test files into:
* test_create_database()
* test_create_table()
* test_create_table_like_table()
* test_create_table_like_file()
* test_create_table_as_select()
- Merge test_nested() into the tests above
- Move a test into test_hms_integration.py
- Add a new test_ddl_base.py as base class for DDL tests.
The plan is to split up test_ddl.py into several smaller
.py files in subsequent patches.
Testing: I tested test_ddl.py and test_hms_integration.py on
exhaustive locally as well as in private builds on all filesystems.
Change-Id: I5f4c044d39e165c2535961b8d0a765c8dbbd051c
Reviewed-on: http://gerrit.cloudera.org:8080/3044
Reviewed-by: Alex Behm <alex.behm@cloudera.com>
Tested-by: Alex Behm <alex.behm@cloudera.com>
114 lines
2.7 KiB
Plaintext
114 lines
2.7 KiB
Plaintext
====
|
|
---- QUERY
|
|
create database create_db_test comment "For testing"
|
|
---- RESULTS
|
|
====
|
|
---- QUERY
|
|
show databases like "create_db_test"
|
|
---- RESULTS
|
|
'create_db_test','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
|
|
---- RESULTS
|
|
====
|
|
---- QUERY
|
|
# Test dropping the database.
|
|
drop database create_db_test
|
|
---- RESULTS
|
|
====
|
|
---- QUERY
|
|
show databases like "create_db_test"
|
|
---- RESULTS
|
|
---- TYPES
|
|
STRING, STRING
|
|
====
|
|
---- QUERY
|
|
# Dropping a non-existent databases is ok with IF EXISTS
|
|
drop database if exists create_db_test
|
|
---- RESULTS
|
|
====
|
|
---- QUERY
|
|
# Test DROP DATABASE ... CASCADE
|
|
create database if not exists test_drop_cascade_db
|
|
====
|
|
---- 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)
|
|
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
|
|
location '$FILESYSTEM_PREFIX/test-warehouse/alltypes_external';
|
|
create view if not exists test_drop_cascade_db.v1 as
|
|
select int_col from functional.alltypes;
|
|
create function if not exists test_drop_cascade_db.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
|
|
location '$FILESYSTEM_PREFIX/test-warehouse/libTestUdas.so' UPDATE_FN='TwoArgUpdate'
|
|
---- RESULTS
|
|
====
|
|
---- QUERY
|
|
show tables in test_drop_cascade_db
|
|
---- RESULTS
|
|
't1'
|
|
't2'
|
|
't3'
|
|
'v1'
|
|
---- TYPES
|
|
STRING
|
|
====
|
|
---- QUERY
|
|
show functions in test_drop_cascade_db
|
|
---- RESULTS
|
|
'STRING','f1()','NATIVE','true'
|
|
---- TYPES
|
|
STRING, STRING, STRING, STRING
|
|
====
|
|
---- QUERY
|
|
show aggregate functions in test_drop_cascade_db
|
|
---- 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 test_drop_cascade_db cascade
|
|
---- RESULTS
|
|
====
|
|
---- QUERY
|
|
show databases like 'test_drop_cascade_db'
|
|
---- RESULTS
|
|
====
|
|
---- QUERY
|
|
# Test that DROP DATABASE ... RESTRICT executes ok.
|
|
create database if not exists test_drop_restrict_db
|
|
====
|
|
---- QUERY
|
|
show databases like 'test_drop_restrict_db'
|
|
---- RESULTS
|
|
'test_drop_restrict_db',''
|
|
---- TYPES
|
|
STRING,STRING
|
|
====
|
|
---- QUERY
|
|
drop database test_drop_restrict_db restrict
|
|
---- RESULTS
|
|
====
|
|
---- QUERY
|
|
show databases like 'test_drop_restrict_db'
|
|
---- RESULTS
|
|
====
|