andygrove commented on code in PR #1747:
URL: https://github.com/apache/datafusion-comet/pull/1747#discussion_r2145229513
##########
spark/src/main/scala/org/apache/comet/rules/CometScanRule.scala:
##########
@@ -105,8 +105,49 @@ case class CometScanRule(session: SparkSession) extends
Rule[SparkPlan] {
return withInfos(scanExec, fallbackReasons.toSet)
}
- val scanImpl = COMET_NATIVE_SCAN_IMPL.get()
- if (scanImpl == CometConf.SCAN_NATIVE_DATAFUSION &&
!COMET_EXEC_ENABLED.get()) {
+ var scanImpl = COMET_NATIVE_SCAN_IMPL.get()
+
+ // if scan is auto then pick best available scan
+ if (scanImpl == SCAN_AUTO) {
+ // TODO these checks are not yet exhaustive. For example,
native_datafusion does
+ // not support reading from object stores such as S3 yet
+
+ val typeChecker = CometScanTypeChecker(SCAN_NATIVE_ICEBERG_COMPAT)
+ val schemaSupported =
+ typeChecker.isSchemaSupported(scanExec.requiredSchema,
fallbackReasons)
+ val partitionSchemaSupported =
+ typeChecker.isSchemaSupported(r.partitionSchema, fallbackReasons)
+
+ // additional checks for known issues
+ def isComplexType(dt: DataType): Boolean = dt match {
+ case _: StructType | _: ArrayType | _: MapType => true
+ case _ => false
+ }
+
+ def hasKnownIssues(dataType: DataType): Boolean = {
+ dataType match {
+ case s: StructType => s.exists(field =>
hasKnownIssues(field.dataType))
+ case a: ArrayType => hasKnownIssues(a.elementType)
+ case m: MapType => isComplexType(m.keyType) ||
isComplexType(m.valueType)
+ case _ => false
Review Comment:
`hasKnownIssues` would return `true` for a `Map` containing `Struct` due to
the `isComplexType` checks.
--
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]