Skip to content

Commit

Permalink
removing trycast var and comment
Browse files Browse the repository at this point in the history
  • Loading branch information
vaibhawvipul committed May 15, 2024
1 parent 63c0c14 commit 1c50315
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions spark/src/test/scala/org/apache/comet/CometCastSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -948,11 +948,8 @@ class CometCastSuite extends CometTestBase with AdaptiveSparkPlanHelper {

private def castTest(input: DataFrame, toType: DataType): Unit = {

// we do not support the TryCast expression in Spark 3.2 and 3.3
// we now support the TryCast expression in Spark 3.2 and 3.3
// https://github.com/apache/datafusion-comet/issues/374
// val testTryCast = CometSparkSessionExtensions.isSpark34Plus
val testTryCast = true

withTempPath { dir =>
val data = roundtripParquet(input, dir).coalesce(1)
data.createOrReplaceTempView("t")
Expand All @@ -963,11 +960,9 @@ class CometCastSuite extends CometTestBase with AdaptiveSparkPlanHelper {
checkSparkAnswerAndOperator(df)

// try_cast() should always return null for invalid inputs
if (testTryCast) {
val df2 =
spark.sql(s"select a, try_cast(a as ${toType.sql}) from t order by a")
checkSparkAnswerAndOperator(df2)
}
val df2 =
spark.sql(s"select a, try_cast(a as ${toType.sql}) from t order by a")
checkSparkAnswerAndOperator(df2)
}

// with ANSI enabled, we should produce the same exception as Spark
Expand Down Expand Up @@ -1026,11 +1021,10 @@ class CometCastSuite extends CometTestBase with AdaptiveSparkPlanHelper {
}

// try_cast() should always return null for invalid inputs
if (testTryCast) {
val df2 =
spark.sql(s"select a, try_cast(a as ${toType.sql}) from t order by a")
checkSparkAnswerAndOperator(df2)
}
val df2 =
spark.sql(s"select a, try_cast(a as ${toType.sql}) from t order by a")
checkSparkAnswerAndOperator(df2)

}
}
}
Expand Down

0 comments on commit 1c50315

Please sign in to comment.