hive分區(qū)iceberg表,添加iceberg.mr.table.schema bug

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'
);

報(bào)錯:

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


image.png

把iceberg.mr.table.schema 里面的字段作為了hive表的字段描述,導(dǎo)致hive字段也認(rèn)為是hive表的字段,hive判斷出錯
image.png

hive分區(qū)表,在字段定義不能定義分區(qū)字段,刪除iceberg.mr.table.schema里面的分區(qū)字段則會報(bào)錯:

FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. java.lang.IllegalArgumentException: Cannot find source column: pppppp

此處場景是要設(shè)置主鍵的required屬性為true

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容