suneet-s commented on a change in pull request #9800:
URL: https://github.com/apache/druid/pull/9800#discussion_r420341968



##########
File path: 
processing/src/main/java/org/apache/druid/query/filter/InDimFilter.java
##########
@@ -132,31 +145,40 @@ public FilterTuning getFilterTuning()
   @Override
   public byte[] getCacheKey()
   {
-    boolean hasNull = false;
-    for (String value : values) {
-      if (value == null) {
-        hasNull = true;
-        break;
+    if (cacheKey == null) {
+      final List<String> sortedValues = new ArrayList<>(values);
+      sortedValues.sort(Comparator.nullsFirst(Ordering.natural()));
+      final Hasher hasher = Hashing.sha256().newHasher();

Review comment:
       Sorry about the false alarm. I just realized it's failing because we're 
comparing 2 byte arrays, but they are in fact equivalent
   
   ```
     @Test
     public void testCacheKey()
     {
       final InDimFilter dimFilter1 = new InDimFilter("dim", 
ImmutableList.of("v1", "v2", "v3"), null);
       final InDimFilter dimFilter2 = new InDimFilter("dim", 
ImmutableList.of("v3", "v2", "v1"), null);
       byte[] cacheKey1 = dimFilter1.getCacheKey();
       byte[] cacheKey2 = dimFilter2.getCacheKey();
       Assert.assertEquals(Arrays.toString(cacheKey1), 
Arrays.toString(cacheKey2));
     }
   ```




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

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