mirror of
https://github.com/apache/impala.git
synced 2026-01-04 09:00:56 -05:00
IMPALA-3724: Support Kudu non-covering range partitions
This commit adds support for non-covering range partitions in Kudu
tables. The SPLIT ROWS clause is now deprecated and no longer supported.
The following new syntax provides more flexibility in creating range
partitions and it supports bounded and unbounded ranges as well as single value
partitions; multi-column range partitions are supported as well.
The new syntax is:
DISTRIBUTE BY RANGE (col_list)
(
PARTITION lower_1 <[=] VALUES <[=] upper_1,
PARTITION lower_2 <[=] VALUES <[=] upper_2,
....
PARTITION lower_n <[=] VALUES <[=] upper_n,
PARTITION VALUE = val_1,
....
PARTITION VALUE = val_n
)
Multi-column range partitions are specified as follows:
DISTRIBUTE BY RANGE (col1, col2,..., coln)
(
PARTITION VALUE = (col1_val, col2_val, ..., coln_val),
....
PARTITION VALUE = (col1_val, col2_val, ..., coln_val)
)
Change-Id: I6799c01a37003f0f4c068d911a13e3f060110a06
Reviewed-on: http://gerrit.cloudera.org:8080/4856
Reviewed-by: Dimitris Tsirogiannis <dtsirogiannis@cloudera.com>
Tested-by: Internal Jenkins
This commit is contained in:
committed by
Internal Jenkins
parent
5f27ae0c2f
commit
d802f321b2
@@ -62,8 +62,8 @@ NonRecoverableException: hash bucket schema components must not contain columns
|
||||
---- 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;
|
||||
distribute by hash (`analytic`) into 4 buckets, range (`function`)
|
||||
(partition values <= 1, partition 1 < values <= 10, partition 10 < values) stored as kudu;
|
||||
insert into `add` select id, int_col from functional.alltypestiny;
|
||||
select * from `add`
|
||||
---- RESULTS
|
||||
@@ -78,3 +78,9 @@ select * from `add`
|
||||
---- TYPES
|
||||
INT,INT
|
||||
====
|
||||
---- QUERY
|
||||
# Test implicit casting/folding of partition values.
|
||||
create table tab (a int primary key) distribute by range (a) (partition value = false)
|
||||
stored as kudu
|
||||
---- RESULTS
|
||||
====
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
---- QUERY
|
||||
-- Invalid hostname
|
||||
create table tdata_bogus_host (id int primary key, name string, valf float, vali bigint)
|
||||
DISTRIBUTE BY RANGE SPLIT ROWS ((10), (30)) STORED AS KUDU
|
||||
DISTRIBUTE BY RANGE (PARTITION 10 <= VALUES <= 30) STORED AS KUDU
|
||||
TBLPROPERTIES('kudu.master_addresses' = 'bogus host name')
|
||||
---- CATCH
|
||||
Couldn't resolve this master's address bogus host name:7051
|
||||
@@ -11,7 +11,7 @@ Couldn't resolve this master's address bogus host name:7051
|
||||
-- Non-existing host
|
||||
create table tdata_non_existing_host
|
||||
(id int primary key, name string, valf float, vali bigint)
|
||||
DISTRIBUTE BY RANGE SPLIT ROWS ((10), (30)) STORED AS KUDU
|
||||
DISTRIBUTE BY RANGE (PARTITION 10 <= VALUES <= 30) STORED AS KUDU
|
||||
TBLPROPERTIES('kudu.master_addresses' = 'bogus.host.name')
|
||||
---- CATCH
|
||||
Couldn't resolve this master's address bogus.host.name:7051
|
||||
@@ -19,13 +19,14 @@ Couldn't resolve this master's address bogus.host.name:7051
|
||||
---- QUERY
|
||||
create table tdata
|
||||
(id int primary key, name string, valf float, vali bigint, valv string, valb boolean)
|
||||
DISTRIBUTE BY RANGE SPLIT ROWS ((10), (30)) STORED AS KUDU
|
||||
DISTRIBUTE BY RANGE (PARTITION VALUES < 10, PARTITION 10 <= VALUES < 30,
|
||||
PARTITION 30 <= VALUES) STORED AS KUDU
|
||||
---- RESULTS
|
||||
====
|
||||
---- QUERY
|
||||
insert into tdata values
|
||||
(1, "martin", 1.0, 232232323, cast('a' as VARCHAR(20)), true),
|
||||
(2, "david", cast(1.0 as float), 99398493939, cast('b' as CHAR(1)), false),
|
||||
(1, "martin", 1.0, 232232323, cast('a' as string), true),
|
||||
(2, "david", cast(1.0 as float), 99398493939, cast('b' as string), false),
|
||||
(3, "todd", cast(1.0 as float), 993393939, "c", true)
|
||||
---- RESULTS
|
||||
: 3
|
||||
@@ -52,7 +53,7 @@ INT,STRING,FLOAT,BIGINT,STRING,BOOLEAN
|
||||
---- QUERY
|
||||
# Try updating a string col where casting a value that is bigger than the varchar in the
|
||||
# cast. The value gets truncated and stored to the string col.
|
||||
update tdata set valv=cast('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' as VARCHAR(20)) where id = 1
|
||||
update tdata set valv=cast('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' as varchar(20)) where id = 1
|
||||
---- RESULTS
|
||||
---- RUNTIME_PROFILE
|
||||
row_regex: .*NumModifiedRows: 1.*
|
||||
@@ -113,8 +114,8 @@ INT,STRING,FLOAT,BIGINT,STRING,BOOLEAN
|
||||
====
|
||||
---- QUERY
|
||||
insert into tdata values
|
||||
(40, "he", cast(0.0 as float), 43, cast('e' as VARCHAR(20)), false),
|
||||
(120, "she", cast(0.0 as float), 99, cast('f' as VARCHAR(20)), true)
|
||||
(40, "he", cast(0.0 as float), 43, cast('e' as string), false),
|
||||
(120, "she", cast(0.0 as float), 99, cast('f' as string), true)
|
||||
---- RESULTS
|
||||
: 2
|
||||
---- RUNTIME_PROFILE
|
||||
@@ -168,7 +169,7 @@ INT,STRING,FLOAT,BIGINT,STRING,BOOLEAN
|
||||
---- QUERY
|
||||
# Make sure we can insert empty strings into string columns and that we can scan them
|
||||
# back.
|
||||
insert into tdata values (320, '', 2.0, 932, cast('' as VARCHAR(20)), false)
|
||||
insert into tdata values (320, '', 2.0, 932, cast('' as string), false)
|
||||
---- RESULTS
|
||||
: 1
|
||||
---- RUNTIME_PROFILE
|
||||
@@ -184,7 +185,7 @@ INT,STRING,STRING,BOOLEAN
|
||||
---- QUERY
|
||||
-- Test that string case is ignored
|
||||
create table ignore_column_case (Id int, NAME string, vAlf float, vali bigint,
|
||||
primary key (Id, NAME)) DISTRIBUTE BY RANGE SPLIT ROWS ((10, 'b'), (30, 'a'))
|
||||
primary key (Id, NAME)) DISTRIBUTE BY RANGE (PARTITION VALUE = (1, 'Martin'))
|
||||
STORED AS KUDU
|
||||
---- RESULTS
|
||||
====
|
||||
@@ -204,7 +205,7 @@ INT,STRING,FLOAT,BIGINT
|
||||
====
|
||||
---- QUERY
|
||||
insert into tdata values
|
||||
(666, "The Devil", cast(1.2 as float), 43, cast('z' as VARCHAR(20)), true)
|
||||
(666, "The Devil", cast(1.2 as float), 43, cast('z' as string), true)
|
||||
---- RESULTS
|
||||
: 1
|
||||
---- RUNTIME_PROFILE
|
||||
@@ -212,13 +213,13 @@ row_regex: .*NumModifiedRows: 1.*
|
||||
====
|
||||
---- QUERY
|
||||
insert into tdata values
|
||||
(666, "The Devil", cast(1.2 as float), 43, cast('z' as VARCHAR(20)), true)
|
||||
(666, "The Devil", cast(1.2 as float), 43, cast('z' as string), true)
|
||||
---- CATCH
|
||||
Kudu error(s) reported, first error: Already present
|
||||
====
|
||||
---- QUERY
|
||||
insert ignore into tdata values
|
||||
(666, "The Devil", cast(1.2 as float), 43, cast('z' as VARCHAR(20)), true)
|
||||
(666, "The Devil", cast(1.2 as float), 43, cast('z' as string), true)
|
||||
---- RESULTS
|
||||
: 0
|
||||
---- RUNTIME_PROFILE
|
||||
@@ -249,7 +250,7 @@ Kudu error(s) reported, first error: Not found: key not found
|
||||
---- QUERY
|
||||
-- Re-insert the data
|
||||
insert into tdata values
|
||||
(666, "The Devil", cast(1.2 as float), 43, cast('z' as VARCHAR(20)), true)
|
||||
(666, "The Devil", cast(1.2 as float), 43, cast('z' as string), true)
|
||||
---- RESULTS
|
||||
: 1
|
||||
====
|
||||
@@ -289,7 +290,7 @@ TINYINT,BIGINT
|
||||
====
|
||||
---- QUERY
|
||||
CREATE TABLE kudu_test_tbl PRIMARY KEY(id)
|
||||
DISTRIBUTE BY RANGE(id) SPLIT ROWS ((100000000))
|
||||
DISTRIBUTE BY RANGE(id) (PARTITION VALUES < 100, PARTITION 100 <= VALUES <= 10000)
|
||||
STORED AS KUDU AS
|
||||
SELECT * FROM functional_kudu.alltypes WHERE id < 100;
|
||||
---- RESULTS
|
||||
@@ -334,6 +335,36 @@ DELETE FROM kudu_test_tbl WHERE id > -1;
|
||||
row_regex: .*NumModifiedRows: 7300.*
|
||||
====
|
||||
---- QUERY
|
||||
# Insert rows that are not covered by any of the existing range partitions
|
||||
INSERT INTO kudu_test_tbl SELECT cast(id + 10000 as int), bool_col, tinyint_col,
|
||||
smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col,
|
||||
timestamp_col, year, month
|
||||
FROM functional_kudu.alltypes
|
||||
---- CATCH
|
||||
Kudu error(s) reported, first error: Not found: No tablet covering the requested range partition: NonCoveredRange { lower_bound: (int32 id=10001), upper_bound: (<end>)
|
||||
====
|
||||
---- QUERY
|
||||
# Insert rows that are not covered by any of the existing range partitions
|
||||
INSERT IGNORE INTO kudu_test_tbl SELECT cast(id + 10000 as int), bool_col, tinyint_col,
|
||||
smallint_col, int_col, bigint_col, float_col, double_col, date_string_col, string_col,
|
||||
timestamp_col,year, month
|
||||
FROM functional_kudu.alltypes
|
||||
---- CATCH
|
||||
Kudu error(s) reported, first error: Not found: No tablet covering the requested range partition: NonCoveredRange { lower_bound: (int32 id=10001), upper_bound: (<end>)
|
||||
====
|
||||
---- QUERY
|
||||
# Try to delete a row with a primary key value that is not covered by the existing range
|
||||
# partitions
|
||||
DELETE FROM kudu_test_tbl WHERE id = 10001
|
||||
---- RESULTS
|
||||
====
|
||||
---- QUERY
|
||||
# Try to update a row with a primary key value that is not covered by the existing range
|
||||
# partitions
|
||||
UPDATE kudu_test_tbl SET int_col = 10 WHERE id = 10001
|
||||
---- RESULTS
|
||||
====
|
||||
---- QUERY
|
||||
# IMPALA-2521: clustered insert into table.
|
||||
create table impala_2521
|
||||
(id bigint primary key, name string, zip int)
|
||||
@@ -366,3 +397,18 @@ select * from impala_2521
|
||||
---- TYPES
|
||||
BIGINT,STRING,INT
|
||||
====
|
||||
---- QUERY
|
||||
# Table with all supported types as primary key and distribution columns
|
||||
create table allkeytypes (i1 tinyint, i2 smallint, i3 int, i4 bigint, name string,
|
||||
valf float, vald double, primary key (i1, i2, i3, i4, name)) distribute by
|
||||
hash into 3 buckets, range (partition value = (1,1,1,1,'1'),
|
||||
partition value = (2,2,2,2,'2'), partition value = (3,3,3,3,'3')) stored as kudu
|
||||
---- RESULTS
|
||||
====
|
||||
---- QUERY
|
||||
insert into allkeytypes select cast(id as tinyint), smallint_col, int_col,
|
||||
cast (bigint_col/10 as bigint), string_col, float_col, double_col
|
||||
from functional.alltypes where id > 0 and id < 4
|
||||
---- RESULTS
|
||||
: 3
|
||||
====
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
====
|
||||
---- QUERY
|
||||
-- Test HASH partitioning
|
||||
-- Test hash partitioning
|
||||
create table simple_hash (id int, name string, valf float, vali bigint,
|
||||
PRIMARY KEY (id, name)) DISTRIBUTE BY HASH(id) INTO 4 BUCKETS,
|
||||
HASH(name) INTO 2 BUCKETS STORED AS KUDU
|
||||
primary key (id, name)) distribute by hash(id) INTO 4 buckets,
|
||||
hash(name) INTO 2 buckets stored as kudu
|
||||
---- RESULTS
|
||||
====
|
||||
---- QUERY
|
||||
@@ -23,10 +23,109 @@ show table stats simple_hash
|
||||
INT,STRING,STRING,STRING,INT
|
||||
====
|
||||
---- QUERY
|
||||
-- Test HASH and RANGE partitioning
|
||||
-- Test single column range partitioning with bounded and unbounded partitions
|
||||
create table range_part_bounds (id int, name string, valf float, vali bigint,
|
||||
primary key (id, name)) distribute by range (id)
|
||||
(partition values <= 10, partition 10 < values <= 20, partition 20 < values)
|
||||
stored as kudu
|
||||
---- RESULTS
|
||||
====
|
||||
---- QUERY
|
||||
show table stats range_part_bounds
|
||||
---- LABELS
|
||||
# Rows,Start Key,Stop Key,Leader Replica,# Replicas
|
||||
---- RESULTS
|
||||
-1,'','8000000B',regex:.*?:\d+,3
|
||||
-1,'8000000B','80000015',regex:.*?:\d+,3
|
||||
-1,'80000015','',regex:.*?:\d+,3
|
||||
---- TYPES
|
||||
INT,STRING,STRING,STRING,INT
|
||||
====
|
||||
---- QUERY
|
||||
-- Test single column range partitioning with single value partitions
|
||||
create table range_part_single (id int, name string, valf float, vali bigint,
|
||||
primary key (id, name)) distribute by range (id)
|
||||
(partition value = 1, partition value = 10, partition value = 100)
|
||||
stored as kudu
|
||||
---- RESULTS
|
||||
====
|
||||
---- QUERY
|
||||
show table stats range_part_single
|
||||
---- LABELS
|
||||
# Rows,Start Key,Stop Key,Leader Replica,# Replicas
|
||||
---- RESULTS
|
||||
-1,'80000001','80000002',regex:.*?:\d+,3
|
||||
-1,'8000000A','8000000B',regex:.*?:\d+,3
|
||||
-1,'80000064','80000065',regex:.*?:\d+,3
|
||||
---- TYPES
|
||||
INT,STRING,STRING,STRING,INT
|
||||
====
|
||||
---- QUERY
|
||||
-- Test single column range partitioning with bounded, unbounded and single
|
||||
-- value partitions
|
||||
create table range_part_multiple_bounds (id int, name string, valf float,
|
||||
primary key (id, name)) distribute by range (id)
|
||||
(partition values <= 10, partition 10 < values <= 20, partition 20 < values <= 30,
|
||||
partition value = 40, partition value = 50) stored as kudu
|
||||
---- RESULTS
|
||||
====
|
||||
---- QUERY
|
||||
show table stats range_part_multiple_bounds
|
||||
---- LABELS
|
||||
# Rows,Start Key,Stop Key,Leader Replica,# Replicas
|
||||
---- RESULTS
|
||||
-1,'','8000000B',regex:.*?:\d+,3
|
||||
-1,'8000000B','80000015',regex:.*?:\d+,3
|
||||
-1,'80000015','8000001F',regex:.*?:\d+,3
|
||||
-1,'80000028','80000029',regex:.*?:\d+,3
|
||||
-1,'80000032','80000033',regex:.*?:\d+,3
|
||||
---- TYPES
|
||||
INT,STRING,STRING,STRING,INT
|
||||
====
|
||||
---- QUERY
|
||||
-- Test multiple column range partitioning
|
||||
create table range_part_multiple_cols (id int, name string, valf float, vali bigint,
|
||||
primary key (id, name)) distribute by range (id, name)
|
||||
(partition value = (10, 'martin'), partition value = (20, 'dimitris'),
|
||||
partition value = (30, 'matthew')) stored as kudu
|
||||
---- RESULTS
|
||||
====
|
||||
---- QUERY
|
||||
show table stats range_part_multiple_cols
|
||||
---- LABELS
|
||||
# Rows,Start Key,Stop Key,Leader Replica,# Replicas
|
||||
---- RESULTS
|
||||
-1,'8000000A6D617274696E','8000000A6D617274696E00',regex:.*?:\d+,3
|
||||
-1,'8000001464696D6974726973','8000001464696D697472697300',regex:.*?:\d+,3
|
||||
-1,'8000001E6D617474686577','8000001E6D61747468657700',regex:.*?:\d+,3
|
||||
---- TYPES
|
||||
INT,STRING,STRING,STRING,INT
|
||||
====
|
||||
---- QUERY
|
||||
-- Test single column range partitioning with string partition column
|
||||
create table range_part_single_string_col (id int, name string, valf float,
|
||||
primary key (id, name)) distribute by range(name)
|
||||
(partition values <= 'aaa', partition 'aaa' < values <= 'bbb',
|
||||
partition 'bbb' < values <= 'ccc', partition value = 'ddd') stored as kudu
|
||||
---- RESULTS
|
||||
====
|
||||
---- QUERY
|
||||
show table stats range_part_single_string_col
|
||||
---- LABELS
|
||||
# Rows,Start Key,Stop Key,Leader Replica,# Replicas
|
||||
---- RESULTS
|
||||
-1,'','61616100',regex:.*?:\d+,3
|
||||
-1,'61616100','62626200',regex:.*?:\d+,3
|
||||
-1,'62626200','63636300',regex:.*?:\d+,3
|
||||
-1,'646464','64646400',regex:.*?:\d+,3
|
||||
---- TYPES
|
||||
INT,STRING,STRING,STRING,INT
|
||||
====
|
||||
---- QUERY
|
||||
-- Test hash and range partitioning
|
||||
create table simple_hash_range (id int, name string, valf float, vali bigint,
|
||||
PRIMARY KEY (id, name)) DISTRIBUTE BY HASH(id) INTO 4 BUCKETS,
|
||||
RANGE(id, name) SPLIT ROWS ((10, 'martin'), (20, 'Peter')) STORED AS KUDU
|
||||
primary key (id, name)) distribute by hash(id) into 4 buckets, range(id, name)
|
||||
(partition value = (10, 'martin'), partition value = (20, 'alex')) stored as kudu
|
||||
---- RESULTS
|
||||
====
|
||||
---- QUERY
|
||||
@@ -34,25 +133,22 @@ show table stats simple_hash_range
|
||||
---- LABELS
|
||||
# Rows,Start Key,Stop Key,Leader Replica,# Replicas
|
||||
---- RESULTS
|
||||
-1,'','000000008000000A6D617274696E',regex:.*?:\d+,3
|
||||
-1,'000000008000000A6D617274696E','00000000800000145065746572',regex:.*?:\d+,3
|
||||
-1,'00000000800000145065746572','00000001',regex:.*?:\d+,3
|
||||
-1,'00000001','000000018000000A6D617274696E',regex:.*?:\d+,3
|
||||
-1,'000000018000000A6D617274696E','00000001800000145065746572',regex:.*?:\d+,3
|
||||
-1,'00000001800000145065746572','00000002',regex:.*?:\d+,3
|
||||
-1,'00000002','000000028000000A6D617274696E',regex:.*?:\d+,3
|
||||
-1,'000000028000000A6D617274696E','00000002800000145065746572',regex:.*?:\d+,3
|
||||
-1,'00000002800000145065746572','00000003',regex:.*?:\d+,3
|
||||
-1,'00000003','000000038000000A6D617274696E',regex:.*?:\d+,3
|
||||
-1,'000000038000000A6D617274696E','00000003800000145065746572',regex:.*?:\d+,3
|
||||
-1,'00000003800000145065746572','',regex:.*?:\d+,3
|
||||
-1,'000000008000000A6D617274696E','000000008000000A6D617274696E00',regex:.*?:\d+,3
|
||||
-1,'0000000080000014616C6578','0000000080000014616C657800',regex:.*?:\d+,3
|
||||
-1,'000000018000000A6D617274696E','000000018000000A6D617274696E00',regex:.*?:\d+,3
|
||||
-1,'0000000180000014616C6578','0000000180000014616C657800',regex:.*?:\d+,3
|
||||
-1,'000000028000000A6D617274696E','000000028000000A6D617274696E00',regex:.*?:\d+,3
|
||||
-1,'0000000280000014616C6578','0000000280000014616C657800',regex:.*?:\d+,3
|
||||
-1,'000000038000000A6D617274696E','000000038000000A6D617274696E00',regex:.*?:\d+,3
|
||||
-1,'0000000380000014616C6578','0000000380000014616C657800',regex:.*?:\d+,3
|
||||
---- TYPES
|
||||
INT,STRING,STRING,STRING,INT
|
||||
====
|
||||
---- QUERY
|
||||
create table simple_hash_range_ctas
|
||||
PRIMARY KEY (id, name) DISTRIBUTE BY HASH(id) INTO 4 BUCKETS,
|
||||
RANGE(id, name) SPLIT ROWS ((10, 'martin'), (20, 'Peter')) STORED AS KUDU
|
||||
primary key (id, name) distribute by hash(id) into 4 buckets,
|
||||
range(id, name) (partition value = (10, 'casey'), partition value = (20, 'marcel'))
|
||||
stored as kudu
|
||||
as select * from simple_hash
|
||||
---- RESULTS
|
||||
'Inserted 0 row(s)'
|
||||
@@ -62,25 +158,21 @@ show table stats simple_hash_range_ctas
|
||||
---- LABELS
|
||||
# Rows,Start Key,Stop Key,Leader Replica,# Replicas
|
||||
---- RESULTS
|
||||
-1,'','000000008000000A6D617274696E',regex:.*?:\d+,3
|
||||
-1,'000000008000000A6D617274696E','00000000800000145065746572',regex:.*?:\d+,3
|
||||
-1,'00000000800000145065746572','00000001',regex:.*?:\d+,3
|
||||
-1,'00000001','000000018000000A6D617274696E',regex:.*?:\d+,3
|
||||
-1,'000000018000000A6D617274696E','00000001800000145065746572',regex:.*?:\d+,3
|
||||
-1,'00000001800000145065746572','00000002',regex:.*?:\d+,3
|
||||
-1,'00000002','000000028000000A6D617274696E',regex:.*?:\d+,3
|
||||
-1,'000000028000000A6D617274696E','00000002800000145065746572',regex:.*?:\d+,3
|
||||
-1,'00000002800000145065746572','00000003',regex:.*?:\d+,3
|
||||
-1,'00000003','000000038000000A6D617274696E',regex:.*?:\d+,3
|
||||
-1,'000000038000000A6D617274696E','00000003800000145065746572',regex:.*?:\d+,3
|
||||
-1,'00000003800000145065746572','',regex:.*?:\d+,3
|
||||
-1,'000000008000000A6361736579','000000008000000A636173657900',regex:.*?:\d+,3
|
||||
-1,'00000000800000146D617263656C','00000000800000146D617263656C00',regex:.*?:\d+,3
|
||||
-1,'000000018000000A6361736579','000000018000000A636173657900',regex:.*?:\d+,3
|
||||
-1,'00000001800000146D617263656C','00000001800000146D617263656C00',regex:.*?:\d+,3
|
||||
-1,'000000028000000A6361736579','000000028000000A636173657900',regex:.*?:\d+,3
|
||||
-1,'00000002800000146D617263656C','00000002800000146D617263656C00',regex:.*?:\d+,3
|
||||
-1,'000000038000000A6361736579','000000038000000A636173657900',regex:.*?:\d+,3
|
||||
-1,'00000003800000146D617263656C','00000003800000146D617263656C00',regex:.*?:\d+,3
|
||||
---- TYPES
|
||||
INT,STRING,STRING,STRING,INT
|
||||
====
|
||||
---- QUERY
|
||||
-- Test HASH defaults to all columns
|
||||
-- Test hash defaults to all columns
|
||||
create table simple_hash_all_columns (id int, name string, valf float, vali bigint,
|
||||
PRIMARY KEY (id, name)) DISTRIBUTE BY HASH INTO 4 BUCKETS STORED AS KUDU
|
||||
primary key (id, name)) distribute by hash into 4 buckets stored as kudu
|
||||
---- RESULTS
|
||||
====
|
||||
---- QUERY
|
||||
@@ -96,10 +188,11 @@ show table stats simple_hash_all_columns
|
||||
INT,STRING,STRING,STRING,INT
|
||||
====
|
||||
---- QUERY
|
||||
-- Test RANGE defaults to all columns
|
||||
-- Test range defaults to all columns
|
||||
create table simple_range_all_columns (id int, name string, valf float, vali bigint,
|
||||
PRIMARY KEY (id, name)) DISTRIBUTE BY RANGE SPLIT ROWS ((1, 'a'), (2, 'b'))
|
||||
STORED AS KUDU
|
||||
primary key (id, name)) distribute by range
|
||||
(partition value = (1, 'a'), partition value = (2, 'b'))
|
||||
stored as kudu
|
||||
---- RESULTS
|
||||
====
|
||||
---- QUERY
|
||||
@@ -107,9 +200,52 @@ show table stats simple_range_all_columns
|
||||
---- LABELS
|
||||
# Rows,Start Key,Stop Key,Leader Replica,# Replicas
|
||||
---- RESULTS
|
||||
-1,'','8000000161',regex:.*?:\d+,3
|
||||
-1,'8000000161','8000000262',regex:.*?:\d+,3
|
||||
-1,'8000000262','',regex:.*?:\d+,3
|
||||
-1,'8000000161','800000016100',regex:.*?:\d+,3
|
||||
-1,'8000000262','800000026200',regex:.*?:\d+,3
|
||||
---- TYPES
|
||||
INT,STRING,STRING,STRING,INT
|
||||
====
|
||||
---- QUERY
|
||||
-- Test using non-literal constant values in range-partition bounds
|
||||
create table range_complex_const_boundary_vals (x int, y int, primary key (x))
|
||||
distribute by range (x) (partition values < 1 + 1, partition (1+3) + 2 < values < 10,
|
||||
partition factorial(4) < values < factorial(5), partition value = factorial(6))
|
||||
stored as kudu
|
||||
---- RESULTS
|
||||
====
|
||||
---- QUERY
|
||||
show table stats range_complex_const_boundary_vals
|
||||
---- LABELS
|
||||
# Rows,Start Key,Stop Key,Leader Replica,# Replicas
|
||||
---- RESULTS
|
||||
-1,'','80000002',regex:.*?:\d+,3
|
||||
-1,'80000007','8000000A',regex:.*?:\d+,3
|
||||
-1,'80000019','80000078',regex:.*?:\d+,3
|
||||
-1,'800002D0','800002D1',regex:.*?:\d+,3
|
||||
---- TYPES
|
||||
INT,STRING,STRING,STRING,INT
|
||||
====
|
||||
---- QUERY
|
||||
-- Test range partitioning with overlapping partitions
|
||||
create table simple_range_with_overlapping (id int, name string, valf float, vali bigint,
|
||||
primary key (id, name)) distribute by range (id)
|
||||
(partition values <= 10, partition values < 20, partition value = 5) stored as kudu
|
||||
---- CATCH
|
||||
NonRecoverableException: overlapping range partitions: first range partition: [<start>, (int32 id=11)), second range partition: [<start>, (int32 id=20))
|
||||
====
|
||||
---- QUERY
|
||||
-- Test range partitioning with the same partition specified multiple times
|
||||
create table simple_range_duplicate_parts (id int, name string, valf float, vali bigint,
|
||||
primary key(id, name)) distribute by range (id)
|
||||
(partition 10 < values <= 20, partition 10 < values <= 20) stored as kudu
|
||||
---- CATCH
|
||||
NonRecoverableException: overlapping range partitions: first range partition: [(int32 id=11), (int32 id=21)), second range partition: [(int32 id=11), (int32 id=21))
|
||||
====
|
||||
---- QUERY
|
||||
-- Test multi-column range partitioning with the same partition specified multiple times
|
||||
create table range_multi_col_duplicate_parts (id int, name string, valf float,
|
||||
vali bigint, primary key (id, name)) distribute by range (id, name)
|
||||
(partition value = (10, 'dimitris'), partition value = (10, 'dimitris')) stored as kudu
|
||||
---- CATCH
|
||||
NonRecoverableException: overlapping range partitions: first range partition: [(int32 id=10, string name=dimitris), (int32 id=10, string name=dimitris\000)), second range partition: [(int32 id=10, string name=dimitris), (int32 id=10, string name=dimitris\000))
|
||||
====
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
====
|
||||
---- QUERY
|
||||
create table simple (id int primary key, name string, valf float, vali bigint)
|
||||
DISTRIBUTE BY RANGE SPLIT ROWS ((10), (30)) STORED AS KUDU
|
||||
TBLPROPERTIES('kudu.num_tablet_replicas' = '2')
|
||||
distribute by range (partition values < 10, partition 10 <= values < 30,
|
||||
partition 30 <= values) stored as kudu tblproperties('kudu.num_tablet_replicas' = '2')
|
||||
---- RESULTS
|
||||
====
|
||||
---- QUERY
|
||||
|
||||
Reference in New Issue
Block a user