Kimahriman commented on code in PR #731:
URL: https://github.com/apache/datafusion-comet/pull/731#discussion_r1700802779
##########
spark/src/main/scala/org/apache/spark/sql/comet/CometBatchScanExec.scala:
##########
@@ -152,3 +153,17 @@ case class CometBatchScanExec(wrapped: BatchScanExec,
runtimeFilters: Seq[Expres
override def supportsColumnar: Boolean = true
}
+
+object CometBatchScanExec {
+
+ def isSchemaSupported(schema: StructType): Boolean =
Review Comment:
Naming is hard, but something like
```scala
trait DataTypeSupport {
def isAdditionallySupported(dt: DataType): Boolean = false
private def isGloballySupported(dt: DataType): Boolean = dt match {
case BooleanType | ByteType | ShortType | IntegerType | LongType |
FloatType | DoubleType |
BinaryType | StringType | _: DecimalType | DateType | TimestampType
=>
true
case t: DataType if t.typeName == "timestamp_ntz" => true
case _ => false
}
def isSchemaSupported(struct: StructType): Boolean = {
struct.fields.map(_.dataType).forall(isTypeSupported)
}
def isTypeSupported(dt: DataType): Boolean = {
if (isGloballySupported(dt) || isAdditionallySupported(dt)) {
// If complex types are supported, we additionally want to recurse
into their children
dt match {
case StructType(fields) =>
fields.map(_.dataType).forall(isTypeSupported)
case ArrayType(elementType, _) => isTypeSupported(elementType)
case MapType(keyType, valueType, _) =>
isTypeSupported(keyType) && isTypeSupported(valueType)
// Not a complex type
case _ => true
}
} else {
false
}
}
}
```
?
--
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]