paimon
paimon copied to clipboard
[Bug] In Crosspartition table,KeyPartPartitionKeyExtractor throw exception as Field names must be unique. Found duplicates
Search before asking
- [x] I searched in the issues and found nothing similar.
Paimon version
v1.0.1 v1.1.1
Compute Engine
Flink SQL
Minimal reproduce step
create a primary-key partition table,ensure the primary-key fields not contain all partition fields,and write data to table.
-- 1.准备source数据
CREATE CATALOG my_catalog WITH(
'type'='paimon',
'warehouse'='file:/home/data/paimon'
):
USE CATALOG my_catalog;
CREATE TEMPORARY TABLE source_table (
id INT,
product_name STRING,
price DECIMAL(10, 2),
category STRING,
create_time TIMESTAMP
)WITH (
'connector' = 'datagen',
'rows-per-second' =''5',
'fields.id.kind' = 'sequence'
'fields.id.start' = '1'
'fields.id.end' = '1000'
'fields.product_name.length' = '10'
'fields.price.min' = '10'
'fields.price.max' = '1000',
'fields.category.length' = '3'
);
-- 2.创建Paimon目标表
CREATE TABLE paimon_sink (
id INT COMMENT 'PK ID'
product_name STRING COMMENT 'product name',
price DECIMAL(10, 2) COMMENT 'price',
category STRING COMMENT 'category',
create_time TIMESTAMP COMMENT 'create time',
dt STRING COMMENT 'dt',
PRIMARY KEY (id,category,create_time) NOT ENFORCED
) COMMENT 'product price table'
PARTITIoNED BY (category,dt);
-- 3.执行数据写入
INSERT INTO paimon_sink
SELECT
id,
product_name,
price,
category.
create_time,
DATE_FORMAT(create_time, 'yyyy-MM-dd') AS dt
FROM source_table;
What doesn't meet your expectations?
the project throw a exception in running, exception message:
Anything else?
No response
Are you willing to submit a PR?
- [x] #5779
KeyPartPartitionKeyExtractor会将所有主键字段和分区字段放到一个List里面,并获取到他们的DataField,但是在projectedLogicalRowType里面的校验,会判断这个list是否有同名字段。
I see that this problem has already been solved by this merge : https://github.com/apache/paimon/pull/5588