Skip to content

ExprPlanner not propagated to SqlToRel #11477

@wjones127

Description

@wjones127

Describe the bug

When upgrading to DataFusion 40, I kept on encountering this error:

Internal error: Expected a simplified result, but none was found.

This happened when parsing a array literal. It seems in order to parse it, we need to register the proper ExprPlanner on the SessionState. We use SessionState::default(), which registers it for us. But then it's not being propagated to SqlToRel, so it fails. (Note the planners: vec![])

pub fn new_with_options(context_provider: &'a S, options: ParserOptions) -> Self {
let normalize = options.enable_ident_normalization;
SqlToRel {
context_provider,
options,
normalizer: IdentNormalizer::new(normalize),
planners: vec![],

To Reproduce

No response

Expected behavior

I'm not sure I understand the design, but it seems odd we don't propagate these. At the very least, we should provide a warning in the docs.

Additional context

Current workaround:

for planner in context_provider.state.expr_planners() {
    sql_to_rel = sql_to_rel.with_user_defined_planner(planner.clone());
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions