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: Add support for CreateNamedStruct #620

Merged
merged 4 commits into from
Jul 5, 2024

Conversation

eejbyfeldt
Copy link
Contributor

Which issue does this PR close?

Closes #619.

Rationale for this change

Add support for one more expression.

What changes are included in this PR?

Adds a custom PhysicalExpr that implements the behavior of the CreateNamedStruct in spark.

How are these changes tested?

New unit tests in the CometExpressionSuite.

@eejbyfeldt eejbyfeldt force-pushed the support-create-named-struct branch from b232326 to 5cf3264 Compare July 1, 2024 20:06
.setCreateNamedStruct(structBuilder)
.build())
} else {
withInfo(expr, struct.valExprs: _*)
Copy link
Member

Choose a reason for hiding this comment

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

I think we need to specify an info string here otherwise the user will not see the reason for falling back to Spark (perhaps @parthchandra can confirm).

Suggested change
withInfo(expr, struct.valExprs: _*)
withInfo(expr, "unsupported arguments for CreateNamedStruct", struct.valExprs: _*)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Based on this comment here

* Information text. Optional, may be null or empty. If not provided, then only information
* from child nodes will be included.
it sounds like we would still get the errors from the children which should contain the root issue. So it not clear to me we would be able to provide any additional useful information here.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we need to specify an info string here otherwise the user will not see the reason for falling back to Spark (perhaps @parthchandra can confirm).

The user will get the reason from the child nodes. We could add the additional message as @andygrove has suggested, but it is not strictly necessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Resolved, by adding the message. I think there is some argument to made around this making it harder to figure out the root cause since there is more information in the info log.

@eejbyfeldt eejbyfeldt force-pushed the support-create-named-struct branch from 7d6ad4b to 9463dde Compare July 2, 2024 18:40
@eejbyfeldt eejbyfeldt marked this pull request as ready for review July 2, 2024 18:41
@eejbyfeldt eejbyfeldt force-pushed the support-create-named-struct branch from 350e8d7 to 9a71e40 Compare July 3, 2024 20:26
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 @eejbyfeldt

@viirya
Copy link
Member

viirya commented Jul 5, 2024

Thanks @eejbyfeldt

@andygrove andygrove merged commit d8fef2b into apache:main Jul 5, 2024
73 checks passed
himadripal pushed a commit to himadripal/datafusion-comet that referenced this pull request Sep 7, 2024
* Add support for CreateNamedStruct

* Exclude HashJoins using struct keys as this is currently unsupported in datafusion

* Add CreateNamedStruct to docs

* Add message
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 CreateNamedStruct expression
4 participants