You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2022/07/27 03:26:11 UTC
[GitHub] [druid] clintropolis commented on a diff in pull request #12773: Fix string first/last aggregator comparator
clintropolis commented on code in PR #12773:
URL: https://github.com/apache/druid/pull/12773#discussion_r930550278
##########
processing/src/main/java/org/apache/druid/query/aggregation/SerializablePairLongStringSerde.java:
##########
@@ -46,6 +46,42 @@ public class SerializablePairLongStringSerde extends ComplexMetricSerde
{
private static final String TYPE_NAME = "serializablePairLongString";
+ private static final Comparator<SerializablePairLongString> COMPARATOR = (o1, o2) -> {
+ int comparation;
+
+ // First we check if the objects are null
+ if (o1 == null && o2 == null) {
+ comparation = 0;
+ } else if (o1 == null) {
+ comparation = -1;
+ } else if (o2 == null) {
+ comparation = 1;
+ } else {
Review Comment:
nit, should we just wrap this comparator in `Comparator.nullsFirst` so that this part only has to deal with non-null pairs?
--
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: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org