ConeyLiu commented on code in PR #8560:
URL: https://github.com/apache/iceberg/pull/8560#discussion_r1325968379
##########
spark/v3.4/spark/src/main/scala/org/apache/spark/sql/execution/datasources/SparkExpressionConverter.scala:
##########
@@ -28,14 +28,15 @@ import org.apache.spark.sql.catalyst.expressions.Literal
import org.apache.spark.sql.catalyst.plans.logical.Filter
import org.apache.spark.sql.catalyst.plans.logical.LeafNode
import org.apache.spark.sql.catalyst.plans.logical.LocalRelation
+import org.apache.spark.sql.execution.datasources.v2.DataSourceV2Strategy
object SparkExpressionConverter {
def convertToIcebergExpression(sparkExpression: Expression):
org.apache.iceberg.expressions.Expression = {
// Currently, it is a double conversion as we are converting Spark
expression to Spark filter
// and then converting Spark filter to Iceberg expression.
// But these two conversions already exist and well tested. So, we are
going with this approach.
- SparkFilters.convert(DataSourceStrategy.translateFilter(sparkExpression,
supportNestedPredicatePushdown = true).get)
+
SparkV2Filters.convert(DataSourceV2Strategy.translateFilterV2(sparkExpression).get)
Review Comment:
Not related to this PR either. The `get` here indeed is not a good idea,
because the expression could fail to translate and the error message is not
valuable. I have opened https://github.com/apache/iceberg/pull/8394 for it.
--
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]