Skip to content

Conversation

@alamb
Copy link
Contributor

@alamb alamb commented May 24, 2024

Which issue does this PR close?

Closes #10654

Rationale for this change

This used to work (and we used it in IOx when we were programatically creating expressions):

lit(ScalarValue::Null).field("foo")

Now it returns an error:

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

What changes are included in this PR?

Support NULL["field"

Are these changes tested?

Yes, new unit tests are added

Are there any user-facing changes?

Fix regression

@github-actions github-actions bot added the core Core DataFusion crate label May 24, 2024
@alamb alamb changed the title Fix Support field access for literal Null Fix NULL["field"] for expr_API May 24, 2024
@alamb alamb marked this pull request as ready for review May 24, 2024 19:30
if arg_dt.is_null() {
return Ok(DataType::Null);
}
access_schema
Copy link
Contributor

@jayzhan211 jayzhan211 May 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I quickly fixed it before noticing that there was already a PR

I think we can remove GetFieldAccessSchema, get_accessed_field. 6cb45b5

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @jayzhan211

I agree the change in 6cb45b5 to inline things looks nice -- shall we make another PR?

@alamb
Copy link
Contributor Author

alamb commented May 25, 2024

Thank you for the speedy review @jayzhan211

@alamb alamb merged commit 0f994af into apache:main May 25, 2024
jayzhan211 pushed a commit to jayzhan211/datafusion that referenced this pull request May 26, 2024
appletreeisyellow pushed a commit to influxdata/arrow-datafusion that referenced this pull request May 28, 2024
findepi pushed a commit to findepi/datafusion that referenced this pull request Jul 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Core DataFusion crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants