Files
impala/testdata/workloads/functional-query/queries/QueryTest/create_kudu.test
Martin Grund 55f6457a28 Kudu Table and Kudu Scan Node
This patch adds a basic implementation for a Kudu table, scan node and
supports simple DDL operations. Similar to "normal" HDFS tables, the
DDL statements executed in the Hive metastore can be propagated to
Kudu. Othewise, the Kudu table behaves similarily to a HBase table.

The syntax to create a table stored in Kudu is:

    create table kudu (id int, name string, age int)
      tblproperties (
        'storage_handler' =
          'com.cloudera.kudu.hive.KuduStorageHandler',
        'kudu.table_name' = 'kudu',
        'kudu.master_addresses' = '0.0.0.0:7051',
        'kudu.key_columns' = 'id,name');

The 'storage_handler' attribute is fixed and used to identify a table
backed by Kudu. The storage handler attribute is required, to make sure
that Hive will not create a directory on HDFS for this table.

The 'table_name' and 'master_addresses' properties define
the properties of the physical persistence in Kudu. The 'key_columns'
defines a list of columns that should be used as a (composite) key.

A Kudu table can be created either as a managed or un-managed (external)
table. Creating an external table behaves similar to an external HDFS
table, if the table does not exist in Kudu create it, if it exists use
it and check schema compatibility. If an external table is deleted, only
delete the Hive table. If a managed table is created, the Kudu table
must not exist and if it is deleted the Kudu table is deleted as well.

TODO: Allow creation of external table without specifying columns.

Change-Id: I794abf6abe30ace4426c53f77676ae1dcb4341ec
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/6358
Tested-by: jenkins
Reviewed-by: Martin Grund <mgrund@cloudera.com>
2015-06-01 16:51:53 -07:00

90 lines
2.2 KiB
Plaintext

====
---- QUERY
# Create managed Kudu table
create table managed_kudu
( id int, f float, d double, s string, v varchar(10), t tinyint, m smallint )
tblproperties
(
'storage_handler' = 'com.cloudera.kudu.hive.KuduStorageHandler',
'kudu.table_name' = 'managed_kudu',
'kudu.master_addresses' = '0.0.0.0:7051',
'kudu.key_columns' = 'id'
)
---- RESULTS
====
---- QUERY
describe managed_kudu
---- RESULTS
'id','int',''
'f','float',''
'd','double',''
's','string',''
'v','varchar(10)',''
't','tinyint',''
'm','smallint',''
---- TYPES
STRING,STRING,STRING
====
---- QUERY
# Create external kudu table with non-matching schema (name)
create external table external_kudu
( id int, f float, do double, s string, v varchar(10), t tinyint, m smallint )
tblproperties
(
'storage_handler' = 'com.cloudera.kudu.hive.KuduStorageHandler',
'kudu.table_name' = 'managed_kudu',
'kudu.master_addresses' = '0.0.0.0:7051',
'kudu.key_columns' = 'id'
)
---- CATCH
ImpalaRuntimeException: Table external_kudu (managed_kudu) has a different schema in Kudu than in Hive.
====
---- QUERY
# Create external kudu table with non-matching schema (type)
create external table external_kudu
( id bigint, f float, d double, s string, v varchar(10), t tinyint, m smallint )
tblproperties
(
'storage_handler' = 'com.cloudera.kudu.hive.KuduStorageHandler',
'kudu.table_name' = 'managed_kudu',
'kudu.master_addresses' = '0.0.0.0:7051',
'kudu.key_columns' = 'id'
)
---- CATCH
ImpalaRuntimeException: Table external_kudu (managed_kudu) has a different schema in Kudu than in Hive.
====
---- QUERY
# Create external kudu table with matching schema
create external table external_kudu
( id int, f float, d double, s string, v varchar(10), t tinyint, m smallint )
tblproperties
(
'storage_handler' = 'com.cloudera.kudu.hive.KuduStorageHandler',
'kudu.table_name' = 'managed_kudu',
'kudu.master_addresses' = '0.0.0.0:7051',
'kudu.key_columns' = 'id'
)
---- RESULTS
====
---- QUERY
describe external_kudu
---- RESULTS
'id','int',''
'f','float',''
'd','double',''
's','string',''
'v','varchar(10)',''
't','tinyint',''
'm','smallint',''
---- TYPES
STRING,STRING,STRING
====
---- QUERY
drop table external_kudu
---- RESULTS
=====
---- QUERY
drop table managed_kudu
---- RESULTS
=====