Skip to content

Commit

Permalink
compilation fix
Browse files Browse the repository at this point in the history
  • Loading branch information
vaibhawvipul committed May 12, 2024
1 parent 39d5ca1 commit 57dfe84
Showing 1 changed file with 1 addition and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
package org.apache.comet.serde

import scala.collection.JavaConverters._
import scala.reflect.macros.whitebox.Context

import org.apache.spark.internal.Logging
import org.apache.spark.sql.catalyst.expressions._
Expand Down Expand Up @@ -663,16 +664,13 @@ object QueryPlanSerde extends Logging with ShimQueryPlanSerde with CometExprShim
val value = cast.eval()
exprToProtoInternal(Literal(value, dataType), inputs)

// do the following only for spark 3.2 and 3.3
case TryCast(child, dt, timeZoneId) =>
handleCast(child, inputs, dt, timeZoneId, "TRY")

case Cast(child, dt, timeZoneId, evalMode) =>
val evalModeStr = if (evalMode.isInstanceOf[Boolean]) {
// Spark 3.2 & 3.3 has ansiEnabled boolean
if (evalMode.asInstanceOf[Boolean]) "ANSI" else "LEGACY"
} else {
// Spark 3.4+ has EvalMode enum with values LEGACY, ANSI, and TRY
evalMode.toString
}
handleCast(child, inputs, dt, timeZoneId, evalModeStr)
Expand Down

0 comments on commit 57dfe84

Please sign in to comment.