rui-mo commented on code in PR #8082:
URL: https://github.com/apache/incubator-gluten/pull/8082#discussion_r1877671283


##########
gluten-substrait/src/main/scala/org/apache/gluten/execution/BatchScanExecTransformer.scala:
##########
@@ -96,18 +96,22 @@ abstract class BatchScanExecTransformerBase(
   // class. Otherwise, we will encounter an issue where makeCopy cannot find a 
constructor
   // with the corresponding number of parameters.
   // The workaround is to add a mutable list to pass in pushdownFilters.
-  protected var pushdownFilters: Option[Seq[Expression]] = None
+  protected var pushdownFilters: Seq[Expression] = scan match {
+    case fileScan: FileScan =>
+      fileScan.dataFilters.filter {
+        expr =>
+          ExpressionConverter.canReplaceWithExpressionTransformer(
+            ExpressionConverter.replaceAttributeReference(expr),
+            output)
+      }
+    case _ => Seq.empty

Review Comment:
   Perhaps add some warnings for easy debugging.



##########
gluten-substrait/src/main/scala/org/apache/gluten/expression/ExpressionConverter.scala:
##########
@@ -55,6 +55,24 @@ object ExpressionConverter extends SQLConfHelper with 
Logging {
     replaceWithExpressionTransformer0(expr, attributeSeq, expressionsMap)
   }
 
+  def canReplaceWithExpressionTransformer(
+      expr: Expression,
+      attributeSeq: Seq[Attribute]): Boolean = {
+    val expressionsMap = ExpressionMappings.expressionsMap
+    try {
+      replaceWithExpressionTransformer0(expr, attributeSeq, expressionsMap)

Review Comment:
   Can we just use 'replaceWithExpressionTransformer'?



##########
gluten-substrait/src/main/scala/org/apache/gluten/expression/ExpressionConverter.scala:
##########
@@ -55,6 +55,24 @@ object ExpressionConverter extends SQLConfHelper with 
Logging {
     replaceWithExpressionTransformer0(expr, attributeSeq, expressionsMap)
   }
 
+  def canReplaceWithExpressionTransformer(
+      expr: Expression,
+      attributeSeq: Seq[Attribute]): Boolean = {
+    val expressionsMap = ExpressionMappings.expressionsMap
+    try {
+      replaceWithExpressionTransformer0(expr, attributeSeq, expressionsMap)
+      true
+    } catch {
+      case _: Exception => false

Review Comment:
   nit: better to log this message for easy debugging.



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

Reply via email to