You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "szehon-ho (via GitHub)" <gi...@apache.org> on 2023/06/13 17:09:20 UTC

[GitHub] [iceberg] szehon-ho commented on a diff in pull request #7760: Spark 3.1 3.2: Fix always true/false condition in rewrite_data_files

szehon-ho commented on code in PR #7760:
URL: https://github.com/apache/iceberg/pull/7760#discussion_r1228451732


##########
spark/v3.1/spark/src/main/scala/org/apache/spark/sql/execution/datasources/SparkExpressionConverter.scala:
##########
@@ -36,15 +40,16 @@ object SparkExpressionConverter {
 
   @throws[AnalysisException]
   def collectResolvedSparkExpression(session: SparkSession, tableName: String, where: String): Expression = {
-    var expression: Expression = null
-    // Add a dummy prefix linking to the table to collect the resolved spark expression from optimized plan.
-    val prefix = String.format("SELECT 42 from %s where ", tableName)
-    val logicalPlan = session.sessionState.sqlParser.parsePlan(prefix + where)
-    val optimizedLogicalPlan = session.sessionState.executePlan(logicalPlan).optimizedPlan
+    val tableAttrs = session.table(tableName).queryExecution.analyzed.output
+    val unresolvedExpression = session.sessionState.sqlParser.parseExpression(where)
+    val filter = Filter(unresolvedExpression, DummyRelation(tableAttrs))

Review Comment:
   I'm not too familiar, but the removal of select 42 is part of #6524, and I'm not confident if we can put that change here as well.



-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org