qutang1 commented on a change in pull request #8990: Fix double-checked locking 
in predicate for SelectorDimFilter
URL: https://github.com/apache/incubator-druid/pull/8990#discussion_r355109998
 
 

 ##########
 File path: 
processing/src/main/java/org/apache/druid/query/filter/SelectorDimFilter.java
 ##########
 @@ -71,7 +73,9 @@ public SelectorDimFilter(
   )
   {
     Preconditions.checkArgument(dimension != null, "dimension must not be 
null");
-
+    this.longPredicate = makeLongPredicateSupplier().get();
 
 Review comment:
   Hi Leventov, I am not sure if I understand this case correctly : basically 
the original code is saying I want 3 private predicates  only be initialized 
once when  SelectorDimFilter::toFilter() method has been called  +  
DruidPredicateFactory::makeDoublePredicate() has been called, is it correct? My 
question is since DruidPredicateFactory is final(already thread safe), the 
whole purpose of the old logic is just not init the predicate twice ,there's no 
thread safety issue has been involved, all I need to do is change 3 predicate 
fields to final?
      ` @Override
     public Filter toFilter()
     {
       if (extractionFn == null) {
         return new SelectorFilter(dimension, value, filterTuning);
       } else {
   
         final DruidPredicateFactory predicateFactory = new 
DruidPredicateFactory()
         {
           @Override
           public Predicate<String> makeStringPredicate()
           {
             return Predicates.equalTo(value);
           }
   
           @Override
           public DruidLongPredicate makeLongPredicate()
           {
             initLongPredicate();
             return longPredicate;
           }
   
           @Override
           public DruidFloatPredicate makeFloatPredicate()
           {
             initFloatPredicate();
             return floatPredicate;
           }
   
           @Override
           public DruidDoublePredicate makeDoublePredicate()
           {
             initDoublePredicate();
             return druidDoublePredicate;
           }
         };
         return new DimensionPredicateFilter(dimension, predicateFactory, 
extractionFn, filterTuning);
       }
     }
   `

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org
For additional commands, e-mail: commits-h...@druid.apache.org

Reply via email to