-
Notifications
You must be signed in to change notification settings - Fork 258
feat: Support casting string non int numeric types #2835
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
base: main
Are you sure you want to change the base?
feat: Support casting string non int numeric types #2835
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2835 +/- ##
============================================
- Coverage 56.12% 54.39% -1.74%
- Complexity 976 1435 +459
============================================
Files 119 167 +48
Lines 11743 15185 +3442
Branches 2251 2523 +272
============================================
+ Hits 6591 8260 +1669
- Misses 4012 5709 +1697
- Partials 1140 1216 +76 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| testAnsi = false) | ||
| test("cast StringType to DoubleType") { | ||
| Seq(true, false).foreach { v => | ||
| castTest(specialValues.toDF("a"), DataTypes.FloatType, testAnsi = v) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| castTest(specialValues.toDF("a"), DataTypes.FloatType, testAnsi = v) | |
| castTest(specialValues.toDF("a"), DataTypes.DoubleType, testAnsi = v) |
| ) -> SparkResult<ArrayRef> { | ||
| let string_array = array | ||
| .as_any() | ||
| .downcast_ref::<StringArray>() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| .downcast_ref::<StringArray>() | |
| .downcast_ref::<GenericStringArray>() |
To support LargeUtf8
e7a1144 to
79d0ea9
Compare
Which issue does this PR close?
Closes #326
Rationale for this change
Comet surrently supports some basic string -> non int casts and this PR essentially extends on that to support all possible casts from string to non-int numeric (float, double and decimal) types
What changes are included in this PR?
Updates to cast logic to support exhaustive casts from string to numeric (non-int) types
How are these changes tested?
Unit tests and fuzz tests