Skip to content

Commit 02a0d89

Browse files
committed
fix clippy
1 parent 843a7c3 commit 02a0d89

File tree

3 files changed

+25
-13
lines changed

3 files changed

+25
-13
lines changed

crates/iceberg/src/expr/predicate.rs

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,16 @@ impl<T: Bind> Bind for UnaryExpression<T> {
132132
}
133133

134134
impl<T> UnaryExpression<T> {
135-
/// Create a unary expression
135+
/// Creates a unary expression with the given operator and term.
136+
///
137+
///
138+
/// # Example
139+
///
140+
/// ```rust
141+
/// use iceberg::expr::{PredicateOperator, Reference, UnaryExpression};
142+
///
143+
/// UnaryExpression::new(PredicateOperator::IsNull, Reference::new("c"));
144+
/// ```
136145
pub fn new(op: PredicateOperator, term: T) -> Self {
137146
debug_assert!(op.is_unary());
138147
Self { op, term }
@@ -172,7 +181,17 @@ impl<T: Debug> Debug for BinaryExpression<T> {
172181
}
173182

174183
impl<T> BinaryExpression<T> {
175-
/// Create a new BinaryExpression
184+
/// Creates a binary expression with the given operator and term.
185+
///
186+
/// # Example
187+
///
188+
/// ```rust
189+
/// use iceberg::expr::Datum;
190+
/// use iceberg::expr::PredicateOperator;
191+
/// use iceberg::expr::Reference;
192+
///
193+
/// BinaryExpression::new(PredicateOperator::LessThanOrEq, Reference::new("a"), Datum::int(10);
194+
/// ```
176195
pub fn new(op: PredicateOperator, term: T, literal: Datum) -> Self {
177196
debug_assert!(op.is_binary());
178197
Self { op, term, literal }

crates/integrations/datafusion/src/physical_plan/expr_to_predicate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use datafusion::scalar::ScalarValue;
2222
use iceberg::expr::{BinaryExpression, Predicate, PredicateOperator, Reference, UnaryExpression};
2323
use iceberg::spec::Datum;
2424

25-
// A datafusion expression could be an Iceberg predicate, reference, or dataum.
25+
// A datafusion expression could be an Iceberg predicate, column, or literal.
2626
enum TransformedResult {
2727
Predication(Predicate),
2828
Column(Reference),

crates/integrations/datafusion/src/table.rs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use datafusion::arrow::datatypes::SchemaRef as ArrowSchemaRef;
2323
use datafusion::catalog::Session;
2424
use datafusion::datasource::{TableProvider, TableType};
2525
use datafusion::error::Result as DFResult;
26-
use datafusion::logical_expr::{BinaryExpr, Expr, TableProviderFilterPushDown};
26+
use datafusion::logical_expr::{Expr, TableProviderFilterPushDown};
2727
use datafusion::physical_plan::ExecutionPlan;
2828
use iceberg::arrow::schema_to_arrow_schema;
2929
use iceberg::table::Table;
@@ -92,14 +92,7 @@ impl TableProvider for IcebergTableProvider {
9292
filters: &[&Expr],
9393
) -> std::result::Result<Vec<TableProviderFilterPushDown>, datafusion::error::DataFusionError>
9494
{
95-
let filter_support = filters
96-
.iter()
97-
.map(|e| match e {
98-
Expr::BinaryExpr(BinaryExpr { .. }) => TableProviderFilterPushDown::Inexact,
99-
_ => TableProviderFilterPushDown::Unsupported,
100-
})
101-
.collect::<Vec<TableProviderFilterPushDown>>();
102-
103-
Ok(filter_support)
95+
// Push down all filters, as a single source of truth, the scanner will drop the filters which couldn't be push down
96+
Ok(vec![TableProviderFilterPushDown::Inexact; filters.len()])
10497
}
10598
}

0 commit comments

Comments
 (0)