Skip to content

[Bug] [core] Fix chain table anchor lookup for multi partition keys #8153

@juntaozhang

Description

@juntaozhang

Search before asking

  • I searched in the issues and found nothing similar.

Paimon version

master

Compute Engine

spark

Minimal reproduce step

CREATE TABLE `chain_test` (
  `t1` BIGINT COMMENT 't1',
  `t2` BIGINT COMMENT 't2',
  `t3` STRING COMMENT 't3'
) PARTITIONED BY (`dt` STRING, `hr` STRING)
TBLPROPERTIES (
  'bucket-key' = 't1',
  'primary-key' = 'dt,hr,t1',
  'partition.timestamp-pattern' = '$dt $hr:00:00',
  'partition.timestamp-formatter' = 'yyyyMMdd HH:mm:ss',
  'chain-table.enabled' = 'true',
  'bucket' = '1',
  'merge-engine' = 'deduplicate',
  'sequence.field' = 't2',
  'chain-table.chain-partition-keys' = 'dt,hr'
);

INSERT INTO TABLE `my_db1`.`chain_test$branch_snapshot` PARTITION (dt = '20250809', hr='01') VALUES (3, 1, '3');
INSERT INTO TABLE `my_db1`.`chain_test$branch_snapshot` PARTITION (dt = '20250809', hr='02') VALUES (4, 1, '4');
INSERT INTO TABLE `my_db1`.`chain_test$branch_delta` PARTITION (dt = '20250810', hr='03') VALUES (5, 1, '5');
INSERT INTO TABLE `my_db1`.`chain_test$branch_delta` PARTITION (dt = '20250810', hr='05') VALUES (6, 1, '6');
SELECT * FROM `my_db1`.`chain_test` WHERE dt='20250810' AND hr='05';

What doesn't meet your expectations?

Expect:

+---+---+---+--------+---+
| t1| t2| t3|      dt| hr|
+---+---+---+--------+---+
|  4|  1|  4|20250810| 05|
|  5|  1|  5|20250810| 05|
|  6|  1|  6|20250810| 05|
+---+---+---+--------+---+

Actual:

+---+---+---+--------+---+
| t1| t2| t3|      dt| hr|
+---+---+---+--------+---+
|  3|  1|  3|20250810| 05|
|  5|  1|  5|20250810| 05|
|  6|  1|  6|20250810| 05|
+---+---+---+--------+---+

Anything else?

No response

Are you willing to submit a PR?

  • I'm willing to submit a PR!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions