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

feat: Array element extraction #899

Merged
merged 24 commits into from
Sep 5, 2024
Merged

Conversation

Kimahriman
Copy link
Contributor

@Kimahriman Kimahriman commented Aug 30, 2024

Which issue does this PR close?

Closes #898

Rationale for this change

More array/list support. Implemented a custom PhysicalExpr rather than using DataFusion's ArrayElement to support ANSI fail on error, default value, and GetArrayItem's zero based indexing.

What changes are included in this PR?

Support for array extraction via the Spark GetArrayItem and ElementAt expressions.

How are these changes tested?

New UT

@Kimahriman Kimahriman changed the title Array element extraction feat: Array element extraction Aug 30, 2024
self: Arc<Self>,
children: Vec<Arc<dyn PhysicalExpr>>,
) -> datafusion_common::Result<Arc<dyn PhysicalExpr>> {
Ok(Arc::new(ListExtract::new(
Copy link
Member

Choose a reason for hiding this comment

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

nit: perhaps add an assertion that children is of the expected length

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure. Out of curiosity is this part of physical expressions (with_new_children) actually used in how Comet is using DataFusion?

Copy link
Member

Choose a reason for hiding this comment

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

It will be once #907 is merged

Copy link
Member

@andygrove andygrove left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks @Kimahriman

@andygrove andygrove merged commit 0f80df2 into apache:main Sep 5, 2024
74 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support array extraction
2 participants