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


##########
api/src/main/java/org/apache/iceberg/expressions/BoundAggregate.java:
##########
@@ -37,11 +37,34 @@ public BoundReference<?> ref() {
     return term().ref();
   }
 
+  public Types.NestedField nestedField(int index) {
+    if (op() == Operation.COUNT_STAR) {
+      return Types.NestedField.required(index, "COUNT(*)", 
Types.LongType.get());
+    } else if (op() == Operation.COUNT) {
+      return Types.NestedField.required(
+          index, "COUNT(" + term().ref().name() + ")", Types.LongType.get());

Review Comment:
   These strings aren't correct because there are two types of terms. A term 
can be a reference (e.g., a column named `id`) or a transformed reference (e.g. 
`bucket(16, id)`).
   
   The `ref()` method is convenient for getting the underlying reference, but 
this can't just get the ref from the term and assume that the term is a ref.



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