apache / paimon-trino

Trino Connector for Apache Paimon.
https://paimon.apache.org/
Apache License 2.0
27 stars 26 forks source link

Support predicate pushdown for partitioned table #11

Closed ly9chee closed 1 year ago

ly9chee commented 1 year ago

Description

When executing a query with a partition key filter, there is no effect of predicate pushdown, the ScanFilter operator still performs a full table scan.

paimon version: 0.4 trino version: 412

JingsongLi commented 1 year ago

@ly9chee thanks for reporting. Can you show the sql?

ly9chee commented 1 year ago

sure, bellow are the steps to reproduce:

create a partition table

CREATE TABLE `activity_daily` (
  `dt` CHAR(10) NOT NULL,
  `tenant_id` STRING NOT NULL,
  `order_count` BIGINT,
  PRIMARY KEY (`dt`, `tenant_id`) NOT ENFORCED
) PARTITIONED BY (`dt`)
WITH (
  'bucket' = '1',
  'bucket-key' = 'tenant_id'
);

write some test data

INSERT OVERWRITE `activity_daily` (`dt`, `tenant_id`, `order_count`) VALUES
    ('2023-06-01', '001', 1),
    ('2023-06-02', '001', 20),
    ('2023-06-02', '002', 5),
    ('2023-06-03', '002', 3),
    ('2023-06-04', '003', 6),
    ('2023-06-05', '001', 2),
    ('2023-06-05', '002', 3);

(trino) query this table with a filter key

select * from activity_daily where dt = '2023-06-02';
image