You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(physical-expr-common): add proto helpers for variant match, outer node, required scalar field
Expressions migrating to `try_to_proto` / `try_from_proto` (#22418)
keep hand-rolling three shapes that don't fit the existing
`encode_child` / `decode_required_expression` helpers from #22513:
- the outer `match &node.expr_type { ... }` that opens every
`try_from_proto`,
- the `PhysicalExprNode { expr_id: None, expr_type: Some(_) }`
wrapper every built-in `try_to_proto` returns, and
- the `ok_or_else(|| internal_datafusion_err!("X is missing required
field 'Y'"))` for non-expression fields like `arrow_type` on
`CastExpr` / `TryCastExpr`.
This commit adds three thin helpers, all gated on `feature = "proto"`:
- `expect_expr_variant!` macro — matches the outer `Option<ExprType>`
and returns the inner payload (auto-derefs through `Box`), or
returns an `internal_err!` naming the expected variant.
- `proto_encode::expr_node` — constructs a `PhysicalExprNode` with no
`expr_id` set from an `ExprType`. `expr_id` is a dedup tag used
only by `DynamicFilterPhysicalExpr` (#22434); every other
expression's `try_to_proto` reduces to `expr_node(ExprType::Foo(_))`.
- `proto_decode::require_proto_field<T>` — mirrors
`decode_required_expression` for non-`PhysicalExprNode` fields,
keeping the "missing required field" message format in one place.
No existing call sites are migrated in this commit; the follow-up
ports the already-migrated expressions onto these helpers.
0 commit comments