You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@paimon.apache.org by "QuakeWang (via GitHub)" <gi...@apache.org> on 2026/04/02 03:26:52 UTC
[PR] feat(datafusion): support partition predicate pushdown [paimon-rust]
QuakeWang opened a new pull request, #190:
URL: https://github.com/apache/paimon-rust/pull/190
<!--
Thank you very much for contributing to Paimon Rust - we are happy that you want to help us improve it. To help the community review your contribution in the best possible way, please go through the checklist below, which will get the contribution into a shape in which it can be best reviewed.
## Contribution Checklist
- Make sure that the pull request corresponds to a [GitHub issue](https://github.com/apache/paimon-rust/issues). Exceptions are made for typos in documentation or comments, which need no issue.
- Fill out the template below to describe the changes contributed by the pull request. That will give reviewers the context they need to do the review.
- Make sure that the change passes the automated tests, i.e., `cargo test` passes.
- Each pull request should address only one issue, not mix up code from multiple issues.
**(The sections below can be removed for hotfixes or typos)**
-->
### Purpose
<!-- Linking this pull request to the issue -->
Linked issue: close #172
<!-- What is the purpose of the change -->
### Brief change log
<!-- Please describe the changes made in this pull request and explain how they address the issue -->
### Tests
<!-- List unit tests or integration cases to verify this change -->
### API and Format
<!-- Does this change affect API or storage format -->
### Documentation
<!-- Does this change introduce a new feature or require documentation updates -->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(datafusion): support partition predicate pushdown [paimon-rust]
Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi commented on code in PR #190:
URL: https://github.com/apache/paimon-rust/pull/190#discussion_r3026510733
##########
crates/integrations/datafusion/src/filter_pushdown.rs:
##########
@@ -0,0 +1,525 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use datafusion::common::{Column, ScalarValue};
+use datafusion::logical_expr::expr::InList;
+use datafusion::logical_expr::{Between, BinaryExpr, Expr, Operator, TableProviderFilterPushDown};
+use paimon::spec::{DataField, DataType, Datum, Predicate, PredicateBuilder};
+
+pub(crate) fn classify_filter_pushdown(
+ filter: &Expr,
+ fields: &[DataField],
+ partition_keys: &[String],
+) -> TableProviderFilterPushDown {
+ let translator = PartitionFilterTranslator::new(fields, partition_keys);
+ if translator.translate(filter).is_some() {
+ TableProviderFilterPushDown::Exact
+ } else if split_conjunction(filter)
+ .into_iter()
+ .any(|expr| translator.translate(expr).is_some())
+ {
+ TableProviderFilterPushDown::Inexact
+ } else {
+ TableProviderFilterPushDown::Unsupported
+ }
+}
+
+pub(crate) fn build_pushed_predicate(
+ filters: &[Expr],
+ fields: &[DataField],
+ partition_keys: &[String],
+) -> Option<Predicate> {
+ let translator = PartitionFilterTranslator::new(fields, partition_keys);
Review Comment:
Cool~
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(datafusion): support partition predicate pushdown [paimon-rust]
Posted by "QuakeWang (via GitHub)" <gi...@apache.org>.
QuakeWang commented on code in PR #190:
URL: https://github.com/apache/paimon-rust/pull/190#discussion_r3026280593
##########
crates/integrations/datafusion/src/filter_pushdown.rs:
##########
@@ -0,0 +1,525 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use datafusion::common::{Column, ScalarValue};
+use datafusion::logical_expr::expr::InList;
+use datafusion::logical_expr::{Between, BinaryExpr, Expr, Operator, TableProviderFilterPushDown};
+use paimon::spec::{DataField, DataType, Datum, Predicate, PredicateBuilder};
+
+pub(crate) fn classify_filter_pushdown(
+ filter: &Expr,
+ fields: &[DataField],
+ partition_keys: &[String],
+) -> TableProviderFilterPushDown {
+ let translator = PartitionFilterTranslator::new(fields, partition_keys);
+ if translator.translate(filter).is_some() {
+ TableProviderFilterPushDown::Exact
+ } else if split_conjunction(filter)
+ .into_iter()
+ .any(|expr| translator.translate(expr).is_some())
+ {
+ TableProviderFilterPushDown::Inexact
+ } else {
+ TableProviderFilterPushDown::Unsupported
+ }
+}
+
+pub(crate) fn build_pushed_predicate(
+ filters: &[Expr],
+ fields: &[DataField],
+ partition_keys: &[String],
+) -> Option<Predicate> {
+ let translator = PartitionFilterTranslator::new(fields, partition_keys);
Review Comment:
> Why we just limit this to partition filter? Just pass all filters and let scan deal with this.
@JingsongLi Thanks for the review. You're right, this is the wrong boundary.
The current implementation couples "which filters are translated/passed to scan" with "which filters are currently used for partition pruning". `TableScan` already accepts a full table-schema `Predicate` and extracts partition conjuncts internally, so restricting translation here to partition columns is too narrow.
I'll update the DataFusion side to pass all translatable filters down to scan, while keeping `Exact` only for predicates we can evaluate exactly today. Filters that are translatable but not fully enforced by the scan yet will remain `Inexact`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(datafusion): support partition predicate pushdown [paimon-rust]
Posted by "QuakeWang (via GitHub)" <gi...@apache.org>.
QuakeWang commented on code in PR #190:
URL: https://github.com/apache/paimon-rust/pull/190#discussion_r3026609783
##########
crates/integrations/datafusion/src/filter_pushdown.rs:
##########
@@ -0,0 +1,525 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use datafusion::common::{Column, ScalarValue};
+use datafusion::logical_expr::expr::InList;
+use datafusion::logical_expr::{Between, BinaryExpr, Expr, Operator, TableProviderFilterPushDown};
+use paimon::spec::{DataField, DataType, Datum, Predicate, PredicateBuilder};
+
+pub(crate) fn classify_filter_pushdown(
+ filter: &Expr,
+ fields: &[DataField],
+ partition_keys: &[String],
+) -> TableProviderFilterPushDown {
+ let translator = PartitionFilterTranslator::new(fields, partition_keys);
+ if translator.translate(filter).is_some() {
+ TableProviderFilterPushDown::Exact
+ } else if split_conjunction(filter)
+ .into_iter()
+ .any(|expr| translator.translate(expr).is_some())
+ {
+ TableProviderFilterPushDown::Inexact
+ } else {
+ TableProviderFilterPushDown::Unsupported
+ }
+}
+
+pub(crate) fn build_pushed_predicate(
+ filters: &[Expr],
+ fields: &[DataField],
+ partition_keys: &[String],
+) -> Option<Predicate> {
+ let translator = PartitionFilterTranslator::new(fields, partition_keys);
Review Comment:
@JingsongLi I have updated, PTAL~
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(datafusion): support partition predicate pushdown [paimon-rust]
Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi merged PR #190:
URL: https://github.com/apache/paimon-rust/pull/190
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(datafusion): support partition predicate pushdown [paimon-rust]
Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi commented on code in PR #190:
URL: https://github.com/apache/paimon-rust/pull/190#discussion_r3026102968
##########
crates/integrations/datafusion/src/filter_pushdown.rs:
##########
@@ -0,0 +1,525 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use datafusion::common::{Column, ScalarValue};
+use datafusion::logical_expr::expr::InList;
+use datafusion::logical_expr::{Between, BinaryExpr, Expr, Operator, TableProviderFilterPushDown};
+use paimon::spec::{DataField, DataType, Datum, Predicate, PredicateBuilder};
+
+pub(crate) fn classify_filter_pushdown(
+ filter: &Expr,
+ fields: &[DataField],
+ partition_keys: &[String],
+) -> TableProviderFilterPushDown {
+ let translator = PartitionFilterTranslator::new(fields, partition_keys);
+ if translator.translate(filter).is_some() {
+ TableProviderFilterPushDown::Exact
+ } else if split_conjunction(filter)
+ .into_iter()
+ .any(|expr| translator.translate(expr).is_some())
+ {
+ TableProviderFilterPushDown::Inexact
+ } else {
+ TableProviderFilterPushDown::Unsupported
+ }
+}
+
+pub(crate) fn build_pushed_predicate(
+ filters: &[Expr],
+ fields: &[DataField],
+ partition_keys: &[String],
+) -> Option<Predicate> {
+ let translator = PartitionFilterTranslator::new(fields, partition_keys);
Review Comment:
Why we just limit this to partition filter? Just pass all filters and let scan deal with this.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org