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


##########
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:
   @andygrove I haven't figured out why, but adding it will produce a different 
`SparkPlan`
   
   Without the reason, I get
   
   ```
   *(1) CometColumnarToRow
   +- CometProject [firstName#10, lastName#11, age#12], 
[personal_info#8.firstName AS firstName#10, personal_info#8.lastName AS 
lastName#11, personal_info#8.age AS age#12]
      +- CometNativeScan parquet [personal_info#8] Batched: true, DataFilters: 
[], Format: CometParquet, Location: InMemoryFileIndex(1 
paths)[file:/private/var/folders/d2/b93h6k7174ddqxltrxgb51040000gn/T/spark-8a...,
 PartitionFilters: [], PushedFilters: [], ReadSchema: 
struct<personal_info:struct<firstName:string,lastName:string,age:int>>
   ```
   
   With the reason, I don't get a Comet plan hence unit tests fail:
   ```shell
   *(1) Project [personal_info#8.firstName AS firstName#10, 
personal_info#8.lastName AS lastName#11, personal_info#8.age AS age#12]
   +- *(1) ColumnarToRow
      +- FileScan parquet [personal_info#8] Batched: true, DataFilters: [], 
Format: Parquet, Location: InMemoryFileIndex(1 
paths)[file:/private/var/folders/d2/b93h6k7174ddqxltrxgb51040000gn/T/spark-b1...,
 PartitionFilters: [], PushedFilters: [], ReadSchema: 
struct<personal_info:struct<firstName:string,lastName:string,age:int>>
   ```



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