-
Notifications
You must be signed in to change notification settings - Fork 169
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 Spark-compatible CAST float/double to string #346
feat: Implement Spark-compatible CAST float/double to string #346
Conversation
0.0, | ||
-0.0) | ||
).toDF("a") | ||
castTest(testValues, DataTypes.StringType, testAnsiModeThrows = false) |
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.
#351 will add some data generation function with random number. May need to rebase on it
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.
I will take a look
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.
If there are still some inputs that produce different results, we can document that in the compatibility guide and skip fuzz testing (or have some reduced form of fuzz testing). We could also consider adding a config so that the user can opt in or out of enabling this particular cast, depending on the severity of any incompatibilities.
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.
Also see #362 which improves how we handle casts that are not compatible with Spark
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.
9f2dc41
to
f9e46c1
Compare
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.
Thans @mattharder91. I left some feedback. I think this is nearly ready to approve.
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.
LGTM. Thanks @mattharder91
@@ -329,9 +329,22 @@ class CometCastSuite extends CometTestBase with AdaptiveSparkPlanHelper { | |||
castTest(generateFloats(), DataTypes.createDecimalType(10, 2)) | |||
} | |||
|
|||
ignore("cast FloatType to StringType") { | |||
test("cast FloatType to StringType") { | |||
// https://github.com/apache/datafusion-comet/issues/312 |
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.
We should remove the references to the issue now that we are resolving the issue
// https://github.com/apache/datafusion-comet/issues/312 |
@@ -374,9 +387,18 @@ class CometCastSuite extends CometTestBase with AdaptiveSparkPlanHelper { | |||
castTest(generateDoubles(), DataTypes.createDecimalType(10, 2)) | |||
} | |||
|
|||
ignore("cast DoubleType to StringType") { | |||
test("cast DoubleType to StringType") { | |||
// https://github.com/apache/datafusion-comet/issues/312 |
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.
// https://github.com/apache/datafusion-comet/issues/312 |
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.
We can remove these comments in a future PR
Which issue does this PR close?
Closes #312
Rationale for this change
Improve compatibility with Apache Spark
What changes are included in this PR?
How are these changes tested?
Further Considerations
A potential problem could be there for denormalized precision values.
Scalas
Double.MinPositiveValue
is4.9E-324
the denormalized value and parses correctly to4.9E-324
while rust outputs5E-324
.