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: Implement to_string for subtype #980

Closed
wants to merge 6 commits into from
Closed

Conversation

adi-kmt
Copy link

@adi-kmt adi-kmt commented Sep 29, 2024

Which issue does this PR close?

Closes #814

Rationale for this change

What changes are included in this PR?

Adding the To string cast

How are these changes tested?

Rust tests are written and tested.

@adi-kmt adi-kmt marked this pull request as ready for review September 29, 2024 10:01
@adi-kmt
Copy link
Author

adi-kmt commented Oct 18, 2024

Hey @andygrove @parthchandra @viirya let me know if this is good enough or something has to be improved

@andygrove
Copy link
Member

Apologies @adi-kmt I had not seen this PR. I will start reviewing today.

@andygrove
Copy link
Member

There is a build error:

Error:  /__w/datafusion-comet/datafusion-comet/spark/src/main/scala/org/apache/comet/serde/QueryPlanSerde.scala:1333: not found: value StructsToString

@@ -662,6 +662,10 @@ impl PhysicalPlanner {
let child = self.create_expr(expr.child.as_ref().unwrap(), input_schema)?;
Ok(Arc::new(ToJson::new(child, &expr.timezone)))
}
ExprStruct::ToString(expr) => {
let child = self.create_expr(expr.child.as_ref().unwrap(), input_schema)?;
Ok(Arc::new(To_String::new(child, &expr.timezone)))
Copy link
Member

Choose a reason for hiding this comment

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

Could you change the name to ToString without the underscore?

Comment on lines +1333 to +1334
case StructsToString(options, child, timezoneId) =>
if (options.nonEmpty) {
Copy link
Member

Choose a reason for hiding this comment

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

It looks like the formatting is off here. You can run make format to fix this,

@andygrove
Copy link
Member

Hi @adi-kmt. I just spent some time looking through this PR and I think there is some confusion that I can help with. The issue #814 is for implementing CAST from struct to string. In SQL, this would look like CAST(struct_value AS string) rather than to_string (which does not seem to exist in Spark?). There should be no need to add additional protobuf types since we already have CAST supported there.

CometCastSuite may be a good place to start with adding a test. Let me know if you have questions.

@andygrove
Copy link
Member

This is now implemented in #1066

@andygrove andygrove closed this Nov 8, 2024
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.

Implement cast from struct type to string
2 participants