ConeyLiu commented on code in PR #7898:
URL: https://github.com/apache/iceberg/pull/7898#discussion_r1240637935


##########
spark/v3.4/spark/src/main/java/org/apache/iceberg/spark/SparkV2Filters.java:
##########
@@ -152,30 +160,22 @@ public static Expression convert(Predicate predicate) {
           }
 
         case EQ: // used for both eq and null-safe-eq
-          Object value;
-          String columnName;
-          if (isRef(leftChild(predicate)) && isLiteral(rightChild(predicate))) 
{
-            columnName = SparkUtil.toColumnName(leftChild(predicate));
-            value = convertLiteral(rightChild(predicate));
-          } else if (isRef(rightChild(predicate)) && 
isLiteral(leftChild(predicate))) {
-            columnName = SparkUtil.toColumnName(rightChild(predicate));
-            value = convertLiteral(leftChild(predicate));
-          } else {
-            return null;
-          }
-
-          if (predicate.name().equals(EQ)) {
-            // comparison with null in normal equality is always null. this is 
probably a mistake.
-            Preconditions.checkNotNull(
-                value, "Expression is always false (eq is not null-safe): %s", 
predicate);
-            return handleEqual(columnName, value);
-          } else { // "<=>"
-            if (value == null) {
-              return isNull(columnName);
-            } else {
-              return handleEqual(columnName, value);
-            }
-          }
+          return handleEQPredicate(
+              predicate,
+              (uboundTerm, value) -> {

Review Comment:
   Updated



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