MCPcopy Create free account
hub / github.com/apache/paimon-rust / predicate_to_vortex_expr

Function predicate_to_vortex_expr

crates/paimon/src/arrow/format/vortex.rs:244–278  ·  view source on GitHub ↗

Convert a single Paimon `Predicate` tree node into a Vortex `Expression`.

(
    predicate: &Predicate,
    file_fields: &[DataField],
)

Source from the content-addressed store, hash-verified

242
243/// Convert a single Paimon `Predicate` tree node into a Vortex `Expression`.
244fn predicate_to_vortex_expr(
245 predicate: &Predicate,
246 file_fields: &[DataField],
247) -> Option<Expression> {
248 match predicate {
249 Predicate::AlwaysTrue => Some(lit(true)),
250 Predicate::AlwaysFalse => Some(lit(false)),
251 Predicate::And(children) => {
252 // Dropping unconvertible children is safe for AND: it makes the filter
253 // less restrictive, so no matching rows are incorrectly excluded.
254 let exprs: Vec<Expression> = children
255 .iter()
256 .filter_map(|c| predicate_to_vortex_expr(c, file_fields))
257 .collect();
258 and_collect(exprs)
259 }
260 Predicate::Or(children) => {
261 // All children must be convertible; otherwise skip the entire OR
262 // to avoid incorrectly filtering out rows that match unconverted branches.
263 let exprs: Vec<Expression> = children
264 .iter()
265 .map(|c| predicate_to_vortex_expr(c, file_fields))
266 .collect::<Option<Vec<_>>>()?;
267 or_collect(exprs)
268 }
269 Predicate::Not(inner) => predicate_to_vortex_expr(inner, file_fields).map(not),
270 Predicate::Leaf {
271 column,
272 index,
273 op,
274 literals,
275 ..
276 } => leaf_to_vortex_expr(column, *index, *op, literals, file_fields),
277 }
278}
279
280/// Convert a leaf predicate to a Vortex expression.
281fn leaf_to_vortex_expr(

Calls 2

leaf_to_vortex_exprFunction · 0.85
iterMethod · 0.45