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