andygrove commented on code in PR #1667: URL: https://github.com/apache/datafusion-comet/pull/1667#discussion_r2054613906
########## spark/src/main/scala/org/apache/comet/CometSparkSessionExtensions.scala: ########## @@ -161,10 +161,28 @@ class CometSparkSessionExtensions } if (!schemaSupported) { - fallbackReasons += s"Unsupported schema ${scanExec.requiredSchema} for $scanImpl" + val field: Option[StructField] = + CometNativeScanExec + .findUnsupportedField(scanExec.requiredSchema) + .orElse(CometScanExec.findUnsupportedField(scanExec.requiredSchema)) + assert(field.nonEmpty) + fallbackReasons += + s"Unsupported field ${field.get} in schema ${scanExec.requiredSchema} for $scanImpl" Review Comment: This PR introduces a two-step process: 1) call `isTypeSupported` 2) call `findUnsupportedField` if `isTypeSupported` returns `false` I wonder if we should consider a different approach so that we do not have to duplicate the logic. One idea would be to pass an accumulator into `isTypeSupported` that can collect fallback reasons. For example: ```scala def isTypeSupported(dt: DataType, fallbackReasons: mutable.ListBuffer[String]): Boolean ``` Another approach would be to rename `isTypeSupported` to `validateTypeSupported` and have it throw an exception when it encounters the first unsupported type. -- 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