vigneshsiva11 commented on code in PR #3278:
URL: https://github.com/apache/datafusion-comet/pull/3278#discussion_r2758968498
##########
spark/src/test/scala/org/apache/spark/sql/comet/ParquetDatetimeRebaseSuite.scala:
##########
@@ -116,6 +116,33 @@ abstract class ParquetDatetimeRebaseSuite extends
CometTestBase {
}
}
+ test("COMET-XXXX: datediff works with dictionary-encoded timestamp columns")
{
+ withTempPath { path =>
+ withSQLConf(
+ CometConf.COMET_NATIVE_SCAN_IMPL.key -> CometConf.SCAN_NATIVE_COMET,
+ CometConf.COMET_ENABLED.key -> "true",
+ "spark.sql.parquet.enableDictionary" -> "true") {
+ val df = spark
+ .createDataFrame(
+ Seq(
+ ("a", java.sql.Timestamp.valueOf("2024-01-02 10:00:00")),
+ ("b", java.sql.Timestamp.valueOf("2024-01-03 11:00:00"))))
+ .toDF("id", "ts")
+
+ df.write.mode("overwrite").parquet(path.getAbsolutePath)
+
+ val readDf = spark.read.parquet(path.getAbsolutePath)
+
+ val result = readDf
+ .selectExpr("datediff(current_date(), ts) as diff")
+ .collect()
+
+ // Just verify it executes correctly (no CometNativeException)
+ assert(result.length == 2)
Review Comment:
Thanks for the suggestion! For this regression test I focused on reproducing
the original failure and ensuring "datediff" executes correctly without a
CometNativeException. I can switch to "checkSparkAnswerAndOperator" if plan
verification is preferred.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]