This is an automated email from the ASF dual-hosted git repository.
philo-he pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/gluten.git
The following commit(s) were added to refs/heads/main by this push:
new 359729202a [GLUTEN-13436][VL][UT] Re-enable Spark 4.2 TruncTimestamp
overflow test by normalizing the exception type (#13267)
359729202a is described below
commit 359729202a82ccc2cc23b4508adcffb254b7c9ed
Author: rdtr <[email protected]>
AuthorDate: Sat Nov 7 23:08:26 2026 -0800
[GLUTEN-13436][VL][UT] Re-enable Spark 4.2 TruncTimestamp overflow test by
normalizing the exception type (#13267)
---
.../gluten/utils/velox/VeloxTestSettings.scala | 3 ---
.../expressions/GlutenDateExpressionsSuite.scala | 23 +++++++++++++++++++++-
2 files changed, 22 insertions(+), 4 deletions(-)
diff --git
a/gluten-ut/spark42/src/test/scala/org/apache/gluten/utils/velox/VeloxTestSettings.scala
b/gluten-ut/spark42/src/test/scala/org/apache/gluten/utils/velox/VeloxTestSettings.scala
index cbe607088d..fc5743a6af 100644
---
a/gluten-ut/spark42/src/test/scala/org/apache/gluten/utils/velox/VeloxTestSettings.scala
+++
b/gluten-ut/spark42/src/test/scala/org/apache/gluten/utils/velox/VeloxTestSettings.scala
@@ -186,9 +186,6 @@ class VeloxTestSettings extends BackendTestSettings {
.excludeGlutenTest("from_unixtime")
// Replaced by a gluten test to pass timezone through config.
.exclude("months_between")
- .exclude(
- "TruncTimestamp of Long.MinValue overflows with ArithmeticException"
- ) // GLUTEN-12569 Spark 4.2 UT enablement (CI-confirmed)
enableSuite[GlutenDecimalExpressionSuite]
enableSuite[GlutenDecimalPrecisionSuite]
enableSuite[GlutenGeneratorExpressionSuite]
diff --git
a/gluten-ut/spark42/src/test/scala/org/apache/spark/sql/catalyst/expressions/GlutenDateExpressionsSuite.scala
b/gluten-ut/spark42/src/test/scala/org/apache/spark/sql/catalyst/expressions/GlutenDateExpressionsSuite.scala
index ae485c4051..4746f79122 100644
---
a/gluten-ut/spark42/src/test/scala/org/apache/spark/sql/catalyst/expressions/GlutenDateExpressionsSuite.scala
+++
b/gluten-ut/spark42/src/test/scala/org/apache/spark/sql/catalyst/expressions/GlutenDateExpressionsSuite.scala
@@ -16,7 +16,7 @@
*/
package org.apache.spark.sql.catalyst.expressions
-import org.apache.spark.sql.GlutenExpressionOffloadTracker
+import org.apache.spark.sql.{DataFrame, GlutenExpressionOffloadTracker}
import org.apache.spark.sql.catalyst.InternalRow
import
org.apache.spark.sql.catalyst.expressions.codegen.GenerateUnsafeProjection
import org.apache.spark.sql.catalyst.util.DateTimeConstants._
@@ -28,6 +28,8 @@ import org.apache.spark.sql.shim.GlutenTestsTrait
import org.apache.spark.sql.types._
import org.apache.spark.unsafe.types.UTF8String
+import org.scalatest.exceptions.TestFailedException
+
import java.sql.{Date, Timestamp}
import java.text.SimpleDateFormat
import java.time.{LocalDateTime, ZoneId}
@@ -38,6 +40,25 @@ class GlutenDateExpressionsSuite
extends DateExpressionsSuite
with GlutenExpressionOffloadTracker
with GlutenTestsTrait {
+
+ // Velox raises the TruncTimestamp overflow with Spark's "long overflow"
message, but it reaches
+ // the driver as a GlutenException instead of an ArithmeticException.
Rethrow it as the
+ // ArithmeticException that Spark's test expects.
+ override protected def doCheckExpression(
+ expression: Expression,
+ expected: Any,
+ inputRow: InternalRow,
+ resultDF: DataFrame): Unit = {
+ try {
+ super.doCheckExpression(expression, expected, inputRow, resultDF)
+ } catch {
+ case e: TestFailedException
+ if expression.isInstanceOf[TruncTimestamp] &&
+ String.valueOf(e.getCause).contains("long overflow") =>
+ fail(e.getMessage, new ArithmeticException("long overflow"))
+ }
+ }
+
override protected def offloadCategory: String = "datetime"
override def testIntegralInput(testFunc: Number => Unit): Unit = {
def checkResult(input: Long): Unit = {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]