Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error on NULL["field_name"]: The expression to get an indexed field is only valid for List, Struct, or Map types, got Null #10654

Closed
alamb opened this issue May 24, 2024 · 0 comments · Fixed by #10655
Labels
bug Something isn't working regression

Comments

@alamb
Copy link
Contributor

alamb commented May 24, 2024

Describe the bug

Expr::field is broken for ScalarValue::Null

After #10375 merged Expr::field is broken when we try and do it on ScalarValue::Null (in addition to #10565)

If you try to use it, you get an error:

The expression to get an indexed field is only valid for List, Struct, or Map types, got Null

To Reproduce

Add this test to expr_fn

#[test]
fn test_get_field_null() {
    evaluate_expr_test(
        lit(ScalarValue::Null).field("a"),
        vec![
            "+------------+",
            "| NULL literal",
        ],
    );
}

Fails with:

called Result::unwrap() on an Err value: Plan("The expression to get an indexed field is only valid for List, Struct, or Map types, got Null")

Expected behavior

Result should also be a NULL scalar

Additional context

No response

@alamb alamb added the bug Something isn't working label May 24, 2024
@jayzhan211 jayzhan211 assigned jayzhan211 and unassigned jayzhan211 May 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working regression
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants