Skip to content

Fallible constructor for nested_case_when #11425

Open

Description

@gatesn

nested_case_when (vortex-array/src/expr/exprs.rs) panics on input a caller may not control:

  • no WHEN/THEN pairs: assert!(!when_then_pairs.is_empty(), ...);
  • more pairs than fit in u32: vortex_panic!("nested_case_when has too many when/then pairs").

Callers that build a CASE from user or query input (for example a list of branches translated from SQL) have to repeat both checks before calling it, or wrap it to turn the panics into errors.

Proposal: add try_nested_case_when(when_then_pairs, else_value) -> VortexResult<Expression> that returns an error in both cases, and have nested_case_when call it and vortex_expect the result, as the bound_* constructors already do.

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions