Skip to content

feat: Implement CAST from struct to string#1066

Merged
andygrove merged 10 commits intoapache:mainfrom
andygrove:cast-struct-to-utf8
Nov 8, 2024
Merged

feat: Implement CAST from struct to string#1066
andygrove merged 10 commits intoapache:mainfrom
andygrove:cast-struct-to-utf8

Conversation

@andygrove
Copy link
Member

Which issue does this PR close?

Closes #814

Rationale for this change

As we add support for complex types, we will need to support CASTing them to string, so that users can run df.show() for example.

What changes are included in this PR?

Implement CAST from struct to string

How are these changes tested?

@andygrove andygrove marked this pull request as ready for review November 7, 2024 23:57
// https://github.com/apache/datafusion-comet/issues/1067 is resolved
// checkSparkAnswerAndOperator(
// "SELECT CAST(struct(_9, _10, _11, _12) as string) FROM tbl")
// decimals (_16 intentionally excluded due to formatting difference with scientific notation)
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's file an issue for _16? Not sure if it is related to struct or independent decimal issue.;

Copy link
Member Author

Choose a reason for hiding this comment

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

@codecov-commenter
Copy link

codecov-commenter commented Nov 8, 2024

Codecov Report

Attention: Patch coverage is 66.66667% with 5 lines in your changes missing coverage. Please review.

Project coverage is 54.82%. Comparing base (845b654) to head (7cf7ab7).
Report is 354 commits behind head on main.

Files with missing lines Patch % Lines
...scala/org/apache/comet/expressions/CometCast.scala 66.66% 2 Missing and 3 partials ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##               main    #1066       +/-   ##
=============================================
+ Coverage     34.46%   54.82%   +20.35%     
+ Complexity      888      858       -30     
=============================================
  Files           113      110        -3     
  Lines         43580    10760    -32820     
  Branches       9658     2089     -7569     
=============================================
- Hits          15021     5899     -9122     
+ Misses        25507     3807    -21700     
+ Partials       3052     1054     -1998     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@andygrove andygrove merged commit 4f2a80d into apache:main Nov 8, 2024
@andygrove andygrove deleted the cast-struct-to-utf8 branch November 8, 2024 15:46
coderfender pushed a commit to coderfender/datafusion-comet that referenced this pull request Dec 13, 2025
* rough out solution based on to_json

* simple test passes

* cover more types

* format

* improve checks

* update

* update

* update

* add comment

* add link to issue
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

3 participants