sql:
CREATE TABLE `adfaa22wqsq2`(
`adf` STRING COMMENT 'adf',
`asdf` STRUCT < a: DECIMAL(18, 2) >,
`bb` ARRAY < DECIMAL(18, 2) >,
`cc` STRUCT < b: DECIMAL(18, 2) >,
`bbb` DECIMAL(12, 2),
primary key (`adf`) disable novalidate
)
PARTITIONED BY (`pppppp` STRING)
STORED BY 'org.apache.iceberg.mr.hive.HiveIcebergStorageHandler'
TBLPROPERTIES (
'engine.hive.enabled' = 'true',
'iceberg.primary-key' = '`adf`',
'external.table.purge' = 'TRUE',
'iceberg.mr.table.schema' = '{
"type":"struct",
"schema-id":0,
"identifier-field-ids":[1],
"fields":[
{"id":1,"name":"adf","required":true,"type":"string","doc":"adf"},
{"id":2,"name":"asdf","required":false,"type":{"type":"struct","fields":[{"id":7,"name":"a","required":false,"type":"decimal(18, 2)"}]}},
{"id":3,"name":"bb","required":false,"type":{"element-id":8,"element":"decimal(18, 2)","element-required":false,"type":"list"}},
{"id":4,"name":"cc","required":false,"type":{"type":"struct","fields":[{"id":9,"name":"b","required":false,"type":"decimal(18, 2)"}]}},
{"id":5,"name":"bbb","required":false,"type":"decimal(12, 2)"}
]
}',
'write.upsert.enabled' = 'true',
'format-version' = '2',
'identifier-field-ids' = '[1]',
'table_type' = 'ICEBERG'
);
报错:
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. org.apache.hadoop.hive.ql.metadata.HiveException: Partition column name pppppp conflicts with table columns.
原因:
采取的是iceberg的deserializer
把iceberg.mr.table.schema 里面的字段作为了hive表的字段描述,导致hive字段也认为是hive表的字段,hive判断出错
hive分区表,在字段定义不能定义分区字段,删除iceberg.mr.table.schema里面的分区字段则会报错:
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. java.lang.IllegalArgumentException: Cannot find source column: pppppp
此处场景是要设置主键的required属性为true