Skip to content

Support predicate pruning on Expr::Case expressions #1692

Open

Description

@alamb

Is your feature request related to a problem or challenge? Please describe what you are trying to do.
In certain situations , IOx is likely going to make predicates that look like the following

CASE 
  WHEN col IS NULL THEN '' 
  ELSE col 
END

that basically map null to the empty string

We would like to use such predicates in order to prune out Chunks (or parquet record groups)

Describe the solution you'd like
I would like CaseExpr to be added to the list of expression types supported by predicate pruning in build_predicate_expression:
https://github.com/apache/arrow-datafusion/blob/03075d5f4b3fdfd8f82144fcd409418832a4bf69/datafusion/src/physical_optimizer/pruning.rs#L640-L699

The tricky bit of this PR would be figuring out what the transformation is and in what circumstances it can be applied

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
See https://github.com/influxdata/influxdb_iox/pull/3557 for more details

Activity

  1. changed the title [-]Support predicate pruning on `CaseExpr` expressions[/-] [+]Support predicate pruning on `Expr::Case` expressions[/+] on Jan 28, 2022
  2. tustvold commented on Jan 31, 2022

    @tustvold
    Contributor

    @alamb could you assign this ticket to me please 😄

  3. removed their assignment
    on Dec 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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