You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datafusion.apache.org by ag...@apache.org on 2025/01/14 16:57:55 UTC

(datafusion-comet) branch main updated: fix: cast timestamp to decimal is unsupported (#1281)

This is an automated email from the ASF dual-hosted git repository.

agrove pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/datafusion-comet.git


The following commit(s) were added to refs/heads/main by this push:
     new 9c1f0ee1 fix: cast timestamp to decimal is unsupported (#1281)
9c1f0ee1 is described below

commit 9c1f0ee1934e030ad73cd04971f8a3d8755dce58
Author: Zhen Wang <64...@qq.com>
AuthorDate: Wed Jan 15 00:57:52 2025 +0800

    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
---
 spark/src/main/scala/org/apache/comet/expressions/CometCast.scala | 1 -
 spark/src/test/scala/org/apache/comet/CometCastSuite.scala        | 6 ++++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/spark/src/main/scala/org/apache/comet/expressions/CometCast.scala b/spark/src/main/scala/org/apache/comet/expressions/CometCast.scala
index 859cb13b..6b0b10d8 100644
--- a/spark/src/main/scala/org/apache/comet/expressions/CometCast.scala
+++ b/spark/src/main/scala/org/apache/comet/expressions/CometCast.scala
@@ -204,7 +204,6 @@ object CometCast {
         Compatible()
       case DataTypes.StringType => Compatible()
       case DataTypes.DateType => Compatible()
-      case _: DecimalType => Compatible()
       case _ => Unsupported
     }
   }
diff --git a/spark/src/test/scala/org/apache/comet/CometCastSuite.scala b/spark/src/test/scala/org/apache/comet/CometCastSuite.scala
index f8c1a8b0..27d8e235 100644
--- a/spark/src/test/scala/org/apache/comet/CometCastSuite.scala
+++ b/spark/src/test/scala/org/apache/comet/CometCastSuite.scala
@@ -838,8 +838,10 @@ class CometCastSuite extends CometTestBase with AdaptiveSparkPlanHelper {
     castTest(generateTimestamps(), DataTypes.DoubleType)
   }
 
-  test("cast TimestampType to DecimalType(10,2)") {
-    castTest(generateTimestamps(), DataTypes.TimestampType)
+  ignore("cast TimestampType to DecimalType(10,2)") {
+    // https://github.com/apache/datafusion-comet/issues/1280
+    // Native cast invoked for unsupported cast from Timestamp(Microsecond, Some("Etc/UTC")) to Decimal128(10, 2)
+    castTest(generateTimestamps(), DataTypes.createDecimalType(10, 2))
   }
 
   test("cast TimestampType to StringType") {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datafusion.apache.org
For additional commands, e-mail: commits-help@datafusion.apache.org