parthchandra commented on code in PR #1747:
URL: https://github.com/apache/datafusion-comet/pull/1747#discussion_r2143805849


##########
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:
   This seems to indicate that if we have an array type with the element type 
being a struct with primitive fields then there are no known issues. But if we 
have a map with a value type of the same struct with primitive fields then it 
is not supported? 



-- 
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

Reply via email to