1

我正在尝试通过信封将数据加载到 Kudu 表中。主键列之一是时间戳。DDL : CREATE TABLE BAL (client_id int bal_id int, effective_time timestamp, prsn_id int, bal_amount double, prsn_name string, PRIMARY KEY (client_id, bal_id, effective_time) ) PARTITION BY HASH(client_id) PARTITIONS 8 存储为 KUDU;

但它抛出错误 Java.lang.illelegalArgumentException

所以我的问题很简单 - 时间戳列可能是主键的一部分吗?

4

1 回答 1

1

是的,将时间戳作为主键的一部分包含在内是完全可以的。请找到代码:

use ${var:db_name};
CREATE TABLE test (
  table_name STRING NOT NULL ENCODING AUTO_ENCODING COMPRESSION DEFAULT_COMPRESSION,
  table_id BIGINT NOT NULL ENCODING AUTO_ENCODING COMPRESSION DEFAULT_COMPRESSION,
  last_read_timestamp TIMESTAMP NOT NULL ENCODING AUTO_ENCODING COMPRESSION DEFAULT_COMPRESSION,
  window STRING NOT NULL ENCODING AUTO_ENCODING COMPRESSION DEFAULT_COMPRESSION,
  ext_gen_timestamp timestamp NOT NULL ENCODING AUTO_ENCODING COMPRESSION DEFAULT_COMPRESSION,
  extract_date timestamp NOT NULL ENCODING AUTO_ENCODING COMPRESSION DEFAULT_COMPRESSION,
  manual_rerun STRING NULL ENCODING AUTO_ENCODING COMPRESSION DEFAULT_COMPRESSION,
  PRIMARY KEY (table_name, table_id, last_read_timestamp)
)
STORED AS KUDU;

*

于 2018-11-02T08:48:33.520 回答