hsiang-c commented on code in PR #3405:
URL: https://github.com/apache/datafusion-comet/pull/3405#discussion_r2779766979
##########
spark/src/main/scala/org/apache/comet/serde/datetime.scala:
##########
@@ -537,3 +537,36 @@ object CometDateFormat extends
CometExpressionSerde[DateFormatClass] {
}
}
}
+
+object CometYears extends CometExpressionSerde[Years] {
+
+ override def getSupportLevel(expr: Years): SupportLevel = {
+ expr.child.dataType match {
+ case DateType | TimestampType | TimestampNTZType => Compatible()
+ case _ => Unsupported(Some(s"Years does not support type:
${expr.child.dataType}"))
+ }
+ }
+
+ override def convert(
+ expr: Years,
+ inputs: Seq[Attribute],
+ binding: Boolean): Option[ExprOuterClass.Expr] = {
+ val periodType = exprToProtoInternal(Literal("year"), inputs, binding)
Review Comment:
Could we use the `getDateField` method?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]