dcapwell commented on code in PR #3872:
URL: https://github.com/apache/cassandra/pull/3872#discussion_r1943887632
##########
src/java/org/apache/cassandra/cql3/functions/AggregateFcts.java:
##########
@@ -836,6 +836,66 @@ public void addInput(Arguments arguments)
}
};
+ private static abstract class AbstractNativeAggregate implements
AggregateFunction.Aggregate
+ {
+ private final AbstractType<?> returnType;
+
+ public AbstractNativeAggregate(AbstractType<?> returnType)
+ {
+ this.returnType = returnType;
+ }
+
+ private ByteBuffer result;
+
+ @Override
+ public void reset()
+ {
+ result = null;
+ }
+
+ @Override
+ public ByteBuffer compute(ProtocolVersion protocolVersion)
+ {
+ return result;
+ }
+
+ @Override
+ public void addInput(Arguments arguments)
+ {
+ ByteBuffer value = arguments.get(0);
+
+ if (value == null)
+ return;
+
+ if (returnType.isReversed())
Review Comment:
can you explain why this is needed vs `returnType.unwrap()`? If we are
comparing we are just reversing the compare, so if we did `returnType.unwrap()`
couldn't we avoid all this?
--
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]