Files
impala/testdata/workloads/functional-query/queries/QueryTest/kudu_create.test
Matthew Jacobs 9b507b6ed6 IMPALA-4379: Fix and test Kudu table type checking
Creating Kudu tables shouldn't allow types not supported by
Kudu (e.g. VARCHAR/CHAR, DECIMAL, TIMESTAMP, collection types).
The behavior is inconsistent: for some types it throws in
the catalog, for VARCHAR/CHAR these become strings. This changes
behavior so that all fail during analysis. Analysis tests
were added.

Similarly, external tables cannot contain Kudu types that
Impala doesn't support (e.g. UNIXTIME_MICROS, BINARY). Tests
were added to validate this behavior. Note that this
required upgrading the python Kudu client.

This also fixes a small corner case with ALTER TABLE:
ALTER TABLE shouldn't allow Kudu tables to change the
storage descriptor tblproperty, otherwise the table metadata
gets in an inconsistent state.

Tests were added for all of the above.

Change-Id: I475273cbbf4110db8d0f78ddf9a56abfc6221e3e
Reviewed-on: http://gerrit.cloudera.org:8080/4857
Reviewed-by: Dimitris Tsirogiannis <dtsirogiannis@cloudera.com>
Tested-by: Tim Armstrong <tarmstrong@cloudera.com>
2016-10-31 16:03:54 +00:00

81 lines
2.3 KiB
Plaintext

====
---- QUERY
create table t primary key (id) distribute by hash (id) into 3 buckets
stored as kudu
as select id, int_col from functional.alltypestiny;
select * from t;
---- RESULTS
0,0
1,1
2,0
3,1
4,0
5,1
6,0
7,1
---- TYPES
INT,INT
====
---- QUERY
# Boolean primary key column
create table tab (x int, y boolean, primary key(x, y))
distribute by hash (x) into 3 buckets stored as kudu
---- CATCH
NonRecoverableException: Key column may not have type of BOOL, FLOAT, or DOUBLE
====
---- QUERY
# Float primary key column
create table tab (x int, y float, primary key(x, y))
distribute by hash (x) into 3 buckets stored as kudu
---- CATCH
NonRecoverableException: Key column may not have type of BOOL, FLOAT, or DOUBLE
====
---- QUERY
# Primary keys should be declared first
# TODO: See KUDU-1709 for improving Kudu error messages.
create table tab (x int, y int, primary key(y))
distribute by hash (y) into 3 buckets stored as kudu
---- CATCH
NonRecoverableException: Got out-of-order key column: name: "y" type: INT32 is_key: true is_nullable: false cfile_block_size: 0
====
---- QUERY
# Small number of hash buckets
create table tab (a int, b int, c int, d int, primary key(a, b, c))
distribute by hash(a,b) into 8 buckets, hash(c) into 1 buckets stored as kudu
---- CATCH
NonRecoverableException: must have at least two hash buckets
====
---- QUERY
# Same column in multiple hash based distributions
create table tab (a int, b int, primary key (a))
distribute by hash (a) into 3 buckets, hash (a) into 2 buckets stored as kudu
---- CATCH
NonRecoverableException: hash bucket schema components must not contain columns in common
====
---- QUERY
# Same column referenced multiple times in the same hash-based distribution
create table tab (a int primary key) distribute by hash (a, a, a) into 3 buckets
stored as kudu
---- CATCH
NonRecoverableException: hash bucket schema components must not contain columns in common
====
---- QUERY
# Kudu table that uses Impala keywords as table name and column names
create table `add`(`analytic` int, `function` int, primary key(`analytic`, `function`))
distribute by hash (`analytic`) into 4 buckets, range (`function`) split rows ((1), (10))
stored as kudu;
insert into `add` select id, int_col from functional.alltypestiny;
select * from `add`
---- RESULTS
0,0
1,1
2,0
3,1
4,0
5,1
6,0
7,1
---- TYPES
INT,INT
====