Wenzhe Zhou created IMPALA-11906:
------------------------------------
Summary: Impala Doc: Support non unique primary key for Kudu table
Key: IMPALA-11906
URL: https://issues.apache.org/jira/browse/IMPALA-11906
Project: IMPALA
Issue Type: Documentation
Components: Docs
Affects Versions: Impala 4.3.0
Reporter: Wenzhe Zhou
IMPALA-11809 Added support non unique primary key for Kudu table. We should
document the syntax for non unique primary key.
- We added syntactic support for creating Kudu table with non unique primary
key.
For example:
CREATE TABLE tbl (id INT NON UNIQUE PRIMARY KEY, name STRING)
PARTITION BY HASH (id) PARTITIONS 3
STORED as KUDU;
More samples could be found in the commit messages of
https://issues.apache.org/jira/browse/IMPALA-11809
- Kudu engine appends a system generated auto-incrementing column to the non
unique primary key columns to guarantee the uniqueness on primary key. This
auto-incrementing column is named as 'auto_incrementing_id' with bigint type.
The assignment to it during insertion is automatic.
'auto_incrementing_id' column cannot be added, removed or renamed with
ALTER TABLE statements.
- When creating a Kudu table, specifying PRIMARY KEY is optional now. If there
is no primary key attribute specified, the partition key columns could be
promoted as non unique primary key if those columns are the beginning columns
of the table.
In following sample, 'a' and 'b' will be promoted as non unique primary key,
'auto_incrementing_id' column will be added by Kudu engine. 'a', 'b' and
'auto_incrementing_id' form the effective unique composite primary key.
CREATE TABLE tbl (a INT, b STRING, c FLOAT)
PARTITION BY HASH (a, b) PARTITIONS 3
STORED as KUDU;
- New column "key_unique" is added to the output of 'describe' table command
for Kudu table, which shows if the primary key is unique.
- SELECT statement does not show the system generated auto-incrementing column
unless the column is explicitly specified in the select list.
- UPSERT operation is not supported for Kudu tables with non unique primary key.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)