Skip to content

Commit 9c1f0ee

Browse files
authored
fix: cast timestamp to decimal is unsupported (#1281)
* fix: cast timestamp to decimal is unsupported * fix style * revert test name and mark as ignore * add comment
1 parent 08d892a commit 9c1f0ee

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

spark/src/main/scala/org/apache/comet/expressions/CometCast.scala

-1
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,6 @@ object CometCast {
204204
Compatible()
205205
case DataTypes.StringType => Compatible()
206206
case DataTypes.DateType => Compatible()
207-
case _: DecimalType => Compatible()
208207
case _ => Unsupported
209208
}
210209
}

spark/src/test/scala/org/apache/comet/CometCastSuite.scala

+4-2
Original file line numberDiff line numberDiff line change
@@ -838,8 +838,10 @@ class CometCastSuite extends CometTestBase with AdaptiveSparkPlanHelper {
838838
castTest(generateTimestamps(), DataTypes.DoubleType)
839839
}
840840

841-
test("cast TimestampType to DecimalType(10,2)") {
842-
castTest(generateTimestamps(), DataTypes.TimestampType)
841+
ignore("cast TimestampType to DecimalType(10,2)") {
842+
// https://github.com/apache/datafusion-comet/issues/1280
843+
// Native cast invoked for unsupported cast from Timestamp(Microsecond, Some("Etc/UTC")) to Decimal128(10, 2)
844+
castTest(generateTimestamps(), DataTypes.createDecimalType(10, 2))
843845
}
844846

845847
test("cast TimestampType to StringType") {

0 commit comments

Comments
 (0)