Skip to content

Expose and document a simpler public API for simplify expressions #3709

@alamb

Description

@alamb

Is your feature request related to a problem or challenge? Please describe what you are trying to do.
Similarly to #3708,

We programmatically create Exprs and would like to take advantage of the simplify + const evaluation code.

In IOx we have a SimplifyAdapter that does this https://github.com/influxdata/influxdb_iox/blob/alamb%2Fmass_upgrade/predicate/src/rpc_predicate.rs#L279 but it would be better to get this API more visible

Describe the solution you'd like
I think I would like a interface like:

/// Apply simplification and constant propagation to `expr` 
/// for example `X + (1 + 3)` is rewritten to `X + 4`
pub fn simplify_expr(expr: Expr, schema: &DfSchema, props: &ExecutionProps) -> Result<Expr> {
...
}

Describe alternatives you've considered
Can keep doing SimplifyAdapter type

Additional context
N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions