Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,9 @@ class ClickHouseTestSettings extends BackendTestSettings {
.exclude("cast from boolean")
.exclude("data type casting")
.excludeGlutenTest("data type casting")
// The Gluten rewrite of "cast from timestamp II" is not vetted on ClickHouse;
// the vanilla case is excluded separately in this block.
.excludeGlutenTest("cast from timestamp II")
.exclude("cast between string and interval")
.exclude("SPARK-27671: cast from nested null type in struct")
.exclude("Process Infinity, -Infinity, NaN in case insensitive manner")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ class VeloxTestSettings extends BackendTestSettings {
.exclude("data type casting")
// Revised by setting timezone through config and commented unsupported cases.
.exclude("cast string to timestamp")
// Excluded in favour of the GlutenCastSuite rewrite, which drops the Long.MinValue
// assertion: collect() -> toJavaTimestamp -> rebaseGregorianToJulianMicros overflows.
.exclude("cast from timestamp II")
.exclude("SPARK-36286: invalid string cast to timestamp")
.exclude("SPARK-39749: cast Decimal to string")
Expand Down Expand Up @@ -629,6 +631,8 @@ class VeloxTestSettings extends BackendTestSettings {
enableSuite[GlutenInsertSuite]
// the native write staing dir is differnt with vanilla Spark for coustom partition paths
.exclude("SPARK-35106: Throw exception when rename custom partition paths returns false")
// The case expects a SparkException; Gluten surfaces the raw
// FileAlreadyExistsException instead.
.exclude("Stop task set if FileAlreadyExistsException was thrown")
// Rewrite: Additional support for file scan with default values has been added in Spark-3.4.
// It appends the default value in record if it is not present while scanning.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,18 @@ class GlutenCastSuite extends CastWithAnsiOffSuite with GlutenTestsTrait {
checkEvaluation(cast(false, TimestampType), tsFalse)
}

// Gluten's glutenCheckExpression uses collect(), which triggers
// toJavaTimestamp -> rebaseGregorianToJulianMicros. Long.MinValue micros (~292000 BC) overflows
// during rebase, so the vanilla case's Long.MinValue assertion is dropped here.
testGluten("cast from timestamp II") {
checkEvaluation(cast(Double.NaN, TimestampType), null)
checkEvaluation(cast(1.0 / 0.0, TimestampType), null)
checkEvaluation(cast(Float.NaN, TimestampType), null)
checkEvaluation(cast(1.0f / 0.0f, TimestampType), null)
checkEvaluation(cast(Literal(Long.MaxValue), TimestampType), Long.MaxValue)
// Long.MinValue is not asserted; see the comment above the test.
}

testGluten("cast string to timestamp") {
DebuggableThreadUtils.parmap(
ALL_TIMEZONES
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,9 @@ class ClickHouseTestSettings extends BackendTestSettings {
.excludeCH("SPARK-33291: Cast struct with null elements to string")
.excludeCH("SPARK-35111: Cast string to year-month interval")
.excludeCH("Gluten - data type casting")
// The Gluten rewrite of "cast from timestamp II" is not vetted on ClickHouse;
// the vanilla case is excluded separately in this block.
.excludeGlutenTest("cast from timestamp II")
.exclude("cast string to date #2")
.exclude("casting to fixed-precision decimals")
.exclude("SPARK-28470: Cast should honor nullOnOverflow property")
Expand Down Expand Up @@ -1180,6 +1183,8 @@ class ClickHouseTestSettings extends BackendTestSettings {
enableSuite[GlutenMathExpressionsSuite]
// Spark round UT for round(3.1415,3) is not correct.
.exclude("round/bround/floor/ceil")
// TANH(-0.1) returns -0.0996695958408681 on ClickHouse; the case expects
// -0.09966799462495582.
.excludeCH("tanh")
.excludeCH("unhex")
.excludeCH("atan2")
Expand Down Expand Up @@ -2195,8 +2200,14 @@ class ClickHouseTestSettings extends BackendTestSettings {
.excludeCH("cast from timestamp II")
.excludeCH("cast a timestamp before the epoch 1970-01-01 00:00:00Z II")
.excludeCH("cast a timestamp before the epoch 1970-01-01 00:00:00Z")
// Casting the string array ("123", "true", "f") to array<boolean> should yield
// [null, true, false] under try_cast; ClickHouse throws instead.
.excludeCH("cast from array II")
// TRY-mode overflow inside a complex type wraps instead of yielding null on
// ClickHouse: try_cast([2.147483648E9] as array<int>) returns [-2147483648].
.excludeCH("cast from array III")
// Same as "cast from array III": try_cast([2.147483648E9] as struct<a:int>)
// returns [-2147483648] on ClickHouse.
.excludeCH("cast from struct III")
.excludeCH("ANSI mode: cast string to timestamp with parse error")
.excludeCH("ANSI mode: cast string to date with parse error")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ class VeloxTestSettings extends BackendTestSettings {
.exclude("data type casting")
// Revised by setting timezone through config and commented unsupported cases.
.exclude("cast string to timestamp")
// Excluded in favour of the GlutenCastSuite rewrite, which drops the Long.MinValue
// assertion: collect() -> toJavaTimestamp -> rebaseGregorianToJulianMicros overflows.
.exclude("cast from timestamp II")
.exclude("SPARK-36286: invalid string cast to timestamp")
.exclude("SPARK-39749: cast Decimal to string")
Expand Down Expand Up @@ -589,6 +591,8 @@ class VeloxTestSettings extends BackendTestSettings {
enableSuite[GlutenInsertSuite]
// the native write staing dir is differnt with vanilla Spark for coustom partition paths
.exclude("SPARK-35106: Throw exception when rename custom partition paths returns false")
// The case expects a SparkException; Gluten surfaces the raw
// FileAlreadyExistsException instead.
.exclude("Stop task set if FileAlreadyExistsException was thrown")
// Rewrite: Additional support for file scan with default values has been added in Spark-3.4.
// It appends the default value in record if it is not present while scanning.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,18 @@ class GlutenCastSuite extends CastWithAnsiOffSuite with GlutenTestsTrait {
checkEvaluation(cast(false, TimestampType), tsFalse)
}

// Gluten's glutenCheckExpression uses collect(), which triggers
// toJavaTimestamp -> rebaseGregorianToJulianMicros. Long.MinValue micros (~292000 BC) overflows
// during rebase, so the vanilla case's Long.MinValue assertion is dropped here.
testGluten("cast from timestamp II") {
checkEvaluation(cast(Double.NaN, TimestampType), null)
checkEvaluation(cast(1.0 / 0.0, TimestampType), null)
checkEvaluation(cast(Float.NaN, TimestampType), null)
checkEvaluation(cast(1.0f / 0.0f, TimestampType), null)
checkEvaluation(cast(Literal(Long.MaxValue), TimestampType), Long.MaxValue)
// Long.MinValue is not asserted; see the comment above the test.
}

testGluten("cast string to timestamp") {
DebuggableThreadUtils.parmap(
ALL_TIMEZONES
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ class VeloxTestSettings extends BackendTestSettings {
.exclude("data type casting")
// Revised by setting timezone through config and commented unsupported cases.
.exclude("cast string to timestamp")
// Excluded in favour of the GlutenCastWithAnsiOffSuite rewrite, which drops the Long.MinValue
// assertion: collect() -> toJavaTimestamp -> rebaseGregorianToJulianMicros overflows.
.exclude("cast from timestamp II")
.exclude("SPARK-36286: invalid string cast to timestamp")
.exclude("SPARK-39749: cast Decimal to string")
Expand Down Expand Up @@ -859,6 +861,8 @@ class VeloxTestSettings extends BackendTestSettings {
.exclude("SPARK-24583 Wrong schema type in InsertIntoDataSourceCommand")
// the native write staing dir is differnt with vanilla Spark for coustom partition paths
.exclude("SPARK-35106: Throw exception when rename custom partition paths returns false")
// The case expects a SparkException; Gluten surfaces the raw
// FileAlreadyExistsException instead.
.exclude("Stop task set if FileAlreadyExistsException was thrown")
// Rewrite: Additional support for file scan with default values has been added in Spark-3.4.
// It appends the default value in record if it is not present while scanning.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,15 +134,14 @@ class GlutenCastWithAnsiOffSuite extends CastWithAnsiOffSuite with GlutenExpress

// Gluten's glutenCheckExpression uses collect(), which triggers
// toJavaTimestamp -> rebaseGregorianToJulianMicros. Long.MinValue micros (~292000 BC) overflows
// during rebase. Velox computes correctly; only the collect path fails. Skip Long.MinValue.
// during rebase, so the vanilla case's Long.MinValue assertion is dropped here.
testGluten("cast from timestamp II") {
checkEvaluation(cast(Double.NaN, TimestampType), null)
checkEvaluation(cast(1.0 / 0.0, TimestampType), null)
checkEvaluation(cast(Float.NaN, TimestampType), null)
checkEvaluation(cast(1.0f / 0.0f, TimestampType), null)
checkEvaluation(cast(Literal(Long.MaxValue), TimestampType), Long.MaxValue)
// Skip Long.MinValue: Velox result is correct but collect() path overflows in
// rebaseGregorianToJulianMicros when converting extreme timestamp to java.sql.Timestamp.
// Long.MinValue is not asserted; see the comment above the test.
}

// Sync session timezone with per-expression timezone and run single-threaded.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ class VeloxTestSettings extends BackendTestSettings {
.exclude("data type casting")
// Revised by setting timezone through config and commented unsupported cases.
.exclude("cast string to timestamp")
// Excluded in favour of the GlutenCastWithAnsiOffSuite rewrite, which drops the Long.MinValue
// assertion: collect() -> toJavaTimestamp -> rebaseGregorianToJulianMicros overflows.
.exclude("cast from timestamp II")
.exclude("SPARK-36286: invalid string cast to timestamp")
.exclude("SPARK-39749: cast Decimal to string")
Expand Down Expand Up @@ -840,6 +842,8 @@ class VeloxTestSettings extends BackendTestSettings {
.exclude("SPARK-24583 Wrong schema type in InsertIntoDataSourceCommand")
// the native write staing dir is differnt with vanilla Spark for coustom partition paths
.exclude("SPARK-35106: Throw exception when rename custom partition paths returns false")
// The case expects a SparkException; Gluten surfaces the raw
// FileAlreadyExistsException instead.
.exclude("Stop task set if FileAlreadyExistsException was thrown")
// Rewrite: Additional support for file scan with default values has been added in Spark-3.4.
// It appends the default value in record if it is not present while scanning.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,15 +132,14 @@ class GlutenCastWithAnsiOffSuite

// Gluten's glutenCheckExpression uses collect(), which triggers
// toJavaTimestamp -> rebaseGregorianToJulianMicros. Long.MinValue micros (~292000 BC) overflows
// during rebase. Velox computes correctly; only the collect path fails. Skip Long.MinValue.
// during rebase, so the vanilla case's Long.MinValue assertion is dropped here.
testGluten("cast from timestamp II") {
checkEvaluation(cast(Double.NaN, TimestampType), null)
checkEvaluation(cast(1.0 / 0.0, TimestampType), null)
checkEvaluation(cast(Float.NaN, TimestampType), null)
checkEvaluation(cast(1.0f / 0.0f, TimestampType), null)
checkEvaluation(cast(Literal(Long.MaxValue), TimestampType), Long.MaxValue)
// Skip Long.MinValue: Velox result is correct but collect() path overflows in
// rebaseGregorianToJulianMicros when converting extreme timestamp to java.sql.Timestamp.
// Long.MinValue is not asserted; see the comment above the test.
}

// Sync session timezone with per-expression timezone and run single-threaded.
Expand Down