viirya commented on code in PR #509: URL: https://github.com/apache/datafusion-comet/pull/509#discussion_r1627789833
########## spark/src/main/scala/org/apache/comet/serde/QueryPlanSerde.scala: ########## @@ -701,17 +698,38 @@ object QueryPlanSerde extends Logging with ShimQueryPlanSerde with CometExprShim case UnaryExpression(child) if expr.prettyName == "trycast" => val timeZoneId = SQLConf.get.sessionLocalTimeZone - handleCast(child, inputs, expr.dataType, Some(timeZoneId), "TRY") + handleCast(child, inputs, expr.dataType, Some(timeZoneId), CometEvalMode.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) + case c @ Cast(child, dt, timeZoneId, _) => + handleCast(child, inputs, dt, timeZoneId, evalMode(c)) + + case expr: Add if evalMode(expr) == CometEvalMode.ANSI && !cometAnsiEnabled => + withInfo(expr, ansiNotSupported) + None + + case expr: Subtract if evalMode(expr) == CometEvalMode.ANSI && !cometAnsiEnabled => + withInfo(expr, ansiNotSupported) + None + + case expr: Multiply if evalMode(expr) == CometEvalMode.ANSI && !cometAnsiEnabled => Review Comment: Maybe we can add a simple method containing all these checks together, instead of scattering them here. -- 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: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org