hsiang-c commented on code in PR #1667:
URL: https://github.com/apache/datafusion-comet/pull/1667#discussion_r2067930692


##########
spark/src/main/scala/org/apache/comet/DataTypeSupport.scala:
##########
@@ -33,20 +37,25 @@ trait DataTypeSupport {
    * @return
    *   true if the datatype is supported
    */
-  def isAdditionallySupported(dt: DataType): Boolean = false
+  def isAdditionallySupported(
+      dt: DataType,
+      name: String,
+      fallbackReasons: ListBuffer[String]): Boolean = false
 
-  private def isGloballySupported(dt: DataType): Boolean = dt match {
-    case ByteType | ShortType
-        if CometSparkSessionExtensions.usingDataFusionParquetExec(SQLConf.get) 
&&
-          !CometConf.COMET_SCAN_ALLOW_INCOMPATIBLE.get() =>
-      false
-    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
-  }
+  private def isGloballySupported(dt: DataType, fallbackReasons: 
ListBuffer[String]): Boolean =
+    dt match {
+      case ByteType | ShortType
+          if usingParquetExecWithIncompatTypes(
+            CometConf.COMET_NATIVE_SCAN_IMPL.get(SQLConf.get)) =>
+        fallbackReasons += s"${CometConf.COMET_SCAN_ALLOW_INCOMPATIBLE.key} is 
false"
+        false
+      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

Review Comment:
   I think I might know why. When `fallbackReasons` is empty, we do 
`CometScanExec (V1) / CometBatchScanExec (V2)`. Otherwise, we do `scanExec`.
   
   However, this PR changes the behavior. `fallbackReasons` can be non empty 
while all conditions met for CometScanExec / CometBatchScanExec.
   
   Perhaps we could leverage the flags instead of `fallbackReasons` being empty 
to make the decision? For example, in `transformV1Scan`:
   
   ```java
             // if (fallbackReasons.isEmpty) {
             if (schemaSupported && partitionSchemaSupported) {
               CometScanExec(scanExec, session)
             } else {
               withInfo(scanExec, fallbackReasons.mkString(", "))
             }
   ```
   
   @andygrove Please let me know if it makes sense to you.



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