gortiz commented on code in PR #8766:
URL: https://github.com/apache/pinot/pull/8766#discussion_r882415004


##########
pinot-core/src/main/java/org/apache/pinot/core/query/pruner/ColumnValueSegmentPruner.java:
##########
@@ -435,4 +482,27 @@ private static Comparable convertValue(String stringValue, 
DataType dataType) {
       throw new BadQueryRequestException(e);
     }
   }
+
+  private static class CachedValue {
+    private final String _strValue;
+    private final long _hash1;
+    private final long _hash2;
+    private DataType _dt;
+    private Comparable _comparableValue;
+
+    private CachedValue(Object value) {
+      _strValue = value.toString();
+      byte[] hash = GuavaBloomFilterReaderUtils.hash(_strValue);
+      _hash1 = Longs.fromBytes(hash[7], hash[6], hash[5], hash[4], hash[3], 
hash[2], hash[1], hash[0]);
+      _hash2 = Longs.fromBytes(hash[15], hash[14], hash[13], hash[12], 
hash[11], hash[10], hash[9], hash[8]);
+    }
+
+    private Comparable getComparableValue(DataType dt) {

Review Comment:
   Something like that is what I wanted to do, but I don't know what I was 
thinking when I added the if predicate. Now it should be correct. The idea is 
to store the datatype used to convert the value. If the datatype is the same, 
the cached value is used. If the datatype is different, the cached value is 
reevaluated. This shouldn't change the semantic we already have and it should 
be more efficient except in very bizarre cases like having interleaved segments 
where columns datatypes are different.



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

Reply via email to