grorge123 commented on code in PR #3706:
URL: https://github.com/apache/datafusion-comet/pull/3706#discussion_r2940620329
##########
spark/src/main/scala/org/apache/comet/serde/arrays.scala:
##########
@@ -200,6 +201,85 @@ object CometArrayDistinct extends
CometExpressionSerde[ArrayDistinct] {
}
}
+object CometSortArray extends CometExpressionSerde[SortArray] {
+ private def containsFloatingPoint(dt: DataType): Boolean = {
+ dt match {
+ case FloatType | DoubleType => true
+ case ArrayType(elementType, _) => containsFloatingPoint(elementType)
+ case StructType(fields) => fields.exists(f =>
containsFloatingPoint(f.dataType))
+ case MapType(keyType, valueType, _) =>
+ containsFloatingPoint(keyType) || containsFloatingPoint(valueType)
+ case _ => false
+ }
+ }
+
+ private def canRank(dt: DataType, nestedInArray: Boolean = false): Boolean =
{
+ dt match {
+ case _: ByteType | _: ShortType | _: IntegerType | _: LongType | _:
FloatType |
+ _: DoubleType | _: DecimalType =>
+ true
+ case _: DateType | _: TimestampType | _: TimestampNTZType =>
+ true
+ case _: NullType =>
+ true
+ case _: BooleanType | _: BinaryType | _: StringType =>
+ true
+ case ArrayType(elementType, _) =>
+ canRank(elementType, nestedInArray = true)
+ case StructType(fields) if !nestedInArray =>
Review Comment:
Sure, I have added it. Besides, I found nulltype has a similar problem, I
have fixed it.
--
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]