clintropolis commented on a change in pull request #6745: add version 
comparator for StringComparator
URL: https://github.com/apache/incubator-druid/pull/6745#discussion_r242735055
 
 

 ##########
 File path: 
processing/src/main/java/org/apache/druid/query/ordering/StringComparators.java
 ##########
 @@ -416,4 +420,50 @@ public boolean equals(Object o)
       return new byte[]{(byte) NUMERIC_CACHE_ID};
     }
   }
+
+  public static class VersionComparator extends StringComparator
+  {
+    @Override
+    public int compare(String o1, String o2)
+    {
+      if (o1 == o2) {
 
 Review comment:
   teamcity check wants this to be `.equals` instead of `==`, tthough in 
`LexicographicComparator.compare` i see a comment about assuming most strings 
being compared are different and so this is a reference equality check. 
   
   ```
   // Avoid conversion to bytes for equal references
   // Assuming we mostly compare different strings, checking s.equals(s2) will 
only make the comparison slower.
   ```
   
   I don't know if that is as true with this comparator, where i would expect a 
smaller set of strings, but if that makes sense to do here, add 
   ```
   //noinspection StringEquality
   ```

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

Reply via email to