kazuyukitanimura commented on code in PR #1943: URL: https://github.com/apache/datafusion-comet/pull/1943#discussion_r2176135700
########## spark/src/main/scala/org/apache/comet/serde/QueryPlanSerde.scala: ########## @@ -1179,6 +1179,29 @@ object QueryPlanSerde extends Logging with CometExprShim { }) optExprWithInfo(optExpr, expr, child) + case FromUnixTime(sec, format, timeZoneId) => + val secExpr = exprToProtoInternal(sec, inputs, binding) + val formatExpr = exprToProtoInternal(format, inputs, binding) + val timeZone = exprToProtoInternal(Literal(timeZoneId.orNull), inputs, binding) + + // TODO: DataFusion toChar does not support Spark format + // https://github.com/apache/datafusion/issues/16577 + // https://github.com/apache/datafusion/issues/14536 + // TODO: DataFusion supports only -8334601211038 <= sec <= 8210266876799 + // https://github.com/apache/datafusion/issues/16594 + // if (secExpr.isDefined && formatExpr.isDefined) { + // val timestampExpr = scalarFunctionExprToProto("from_unixtime", Seq(secExpr, timeZone): _*) + // val optExpr = scalarFunctionExprToProto("to_char", Seq(timestampExpr, formatExpr): _*) + // optExprWithInfo(optExpr, expr, sec, format) + if (secExpr.isDefined && formatExpr.isDefined && format == Literal( + TimestampFormatter.defaultPattern)) { + val optExpr = scalarFunctionExprToProto("from_unixtime", Seq(secExpr, timeZone): _*) + castToProto(expr, timeZoneId, StringType, optExpr.get, CometEvalMode.LEGACY) + } else { + withInfo(expr, sec, format) + None + } Review Comment: thanks, updated -- 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