nishantmonu51 commented on a change in pull request #5958: Part 2 of changes
for SQL Compatible Null Handling
URL: https://github.com/apache/incubator-druid/pull/5958#discussion_r204801468
##########
File path:
processing/src/main/java/io/druid/query/groupby/orderby/DefaultLimitSpec.java
##########
@@ -269,12 +270,22 @@ public int compare(Row left, Row right)
private Ordering<Row> metricOrdering(final String column, final Comparator
comparator)
{
- return Ordering.from(Comparator.comparing((Row row) -> row.getRaw(column),
Comparator.nullsLast(comparator)));
+ if (NullHandling.sqlCompatible()) {
+ return Ordering.from(Comparator.comparing((Row row) ->
row.getRaw(column), Comparator.nullsFirst(comparator)));
+ } else {
+ return Ordering.from(Comparator.comparing((Row row) ->
row.getRaw(column), Comparator.nullsLast(comparator)));
+ }
}
private Ordering<Row> dimensionOrdering(final String dimension, final
StringComparator comparator)
{
- return Ordering.from(Comparator.comparing((Row row) ->
row.getDimension(dimension).isEmpty() ? null :
row.getDimension(dimension).get(0), Comparator.nullsFirst(comparator)));
+ return Ordering.from(
+ Comparator.comparing(
+ (Row row) -> row.getDimension(dimension).isEmpty()
Review comment:
Its just a formatting change as the line was longer than 120 cols, no logic
changed in this PR. reformatted to make it more readable.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]