Skip to content

feat: Add support for CreateNamedStruct#620

Merged
andygrove merged 4 commits intoapache:mainfrom
eejbyfeldt:support-create-named-struct
Jul 5, 2024
Merged

feat: Add support for CreateNamedStruct#620
andygrove merged 4 commits intoapache:mainfrom
eejbyfeldt:support-create-named-struct

Conversation

@eejbyfeldt
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Comment thread spark/src/main/scala/org/apache/comet/serde/QueryPlanSerde.scala
@eejbyfeldt eejbyfeldt marked this pull request as ready for review July 2, 2024 18:41
Comment thread spark/src/test/scala/org/apache/comet/CometExpressionSuite.scala
@eejbyfeldt eejbyfeldt force-pushed the support-create-named-struct branch from 9463dde to 350e8d7 Compare July 3, 2024 12:39
@eejbyfeldt eejbyfeldt force-pushed the support-create-named-struct branch from 350e8d7 to 9a71e40 Compare July 3, 2024 20:26
@eejbyfeldt eejbyfeldt force-pushed the support-create-named-struct branch from 9a71e40 to 45d913c Compare July 3, 2024 20:31
Copy link
Copy Markdown
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
Copy Markdown
Member

viirya commented Jul 5, 2024

Thanks @eejbyfeldt

@andygrove andygrove merged commit d8fef2b into apache:main Jul 5, 2024
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