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

Cast string to timestamp not compatible with Spark logic #14

Closed
andygrove opened this issue Feb 13, 2024 · 2 comments
Closed

Cast string to timestamp not compatible with Spark logic #14

andygrove opened this issue Feb 13, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@andygrove
Copy link
Member

I was manually experimenting with some cast operations based on my experience of implementing them in Spark RAPIDS and found the following example of incorrect behavior. I would recommend implementing some fuzz tests to find these kind of issues.

Test data

scala> robots.show
+------+
|  name|
+------+
|WALL-E|
|  R2D2|
|    T2|
+------+

Test with Comet

scala> import org.apache.spark.sql.types._

scala> val df = robots.withColumn("date", col("name").cast(DataTypes.TimestampType))

scala> df.show
+------+----+
|  name|date|
+------+----+
|WALL-E|null|
|  R2D2|null|
|    T2|null|
+------+----+

Test with Spark

scala> spark.conf.set("spark.comet.enabled", false)

scala> df.show
+------+-------------------+
|  name|               date|
+------+-------------------+
|WALL-E|               null|
|  R2D2|               null|
|    T2|2024-02-09 02:00:00|
+------+-------------------+

T2 is a valid timestamp because T is the separator between the optional date and the time portion. 2 is a valid time because some time fields are optional.

@andygrove andygrove added the bug Something isn't working label Feb 13, 2024
@sunchao
Copy link
Member

sunchao commented Feb 13, 2024

cc @parthchandra this might be of interest to you

@parthchandra parthchandra self-assigned this Feb 13, 2024
snmvaughan pushed a commit to snmvaughan/arrow-datafusion-comet that referenced this issue Apr 4, 2024
@andygrove
Copy link
Member Author

Closing this because there is a new more detailed issue for this:

#328

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants