Description
Kudu currently supports unique constraints via primary keys but some times a unique value constraint on (nullable) arbitrary column(s) independent of the primary key column(s) may also be required.
Example impala syntax:
CREATE TABLE my_first_table ( id BIGINT, name STRING, unique_val_1 BIGINT, unique_val_2 BIGINT, PRIMARY KEY(id) UNIQUE CONSTRAINT(unique_val_1,unique_val_2) ) PARTITION BY HASH PARTITIONS 16 STORED AS KUDU;
Example api syntax:
val kuduTableSchema = StructType( StructField("id", IntegerType , false) :: StructField("name" , IntegerType, true ) :: StructField("unique_val_1", IntegerType , true ) :: StructField("unique_val_2", IntegerType , true ) :: Nil) val kuduPrimaryKey = Seq("id") val kuduTableOptions = new CreateTableOptions() kuduTableOptions. setUniqueConstraintColumns(List("unique_val_1", "unique_val_2").asJava). setRangePartitionColumns(List("name").asJava). setNumReplicas(3) kuduContext.createTable(kuduTableName, kuduTableSchema, kuduPrimaryKey, kuduTableOptions)
Attachments
Issue Links
- is blocked by
-
KUDU-2613 Implement secondary indexes
- Resolved