rdblue commented on code in PR #6923:
URL: https://github.com/apache/iceberg/pull/6923#discussion_r1117825003


##########
spark/v3.3/spark/src/main/java/org/apache/iceberg/spark/SparkAggregates.java:
##########
@@ -48,31 +48,20 @@ public static Expression convert(AggregateFunc aggregate) {
         case COUNT:
           Count countAgg = (Count) aggregate;
           if (countAgg.isDistinct()) {
-            // manifest file doesn't have count distinct so this can't be 
converted to push down
-            return null;
-          }
-
-          if (countAgg.column() instanceof NamedReference) {
-            return Expressions.count(SparkUtil.toColumnName((NamedReference) 
countAgg.column()));
-          } else {
             return null;
           }
+          assert (countAgg.column() instanceof NamedReference);
+          return Expressions.count(SparkUtil.toColumnName((NamedReference) 
countAgg.column()));

Review Comment:
   I think this was actually better before. What was the rationale for 
converting to use `assert`? We don't use that elsewhere and I think the correct 
behavior is to return `null` when something is unexpected and can't be 
converted.



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