You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2019/12/07 08:58:04 UTC

[GitHub] [incubator-druid] qutang1 commented on a change in pull request #8990: Fix double-checked locking in predicate for SelectorDimFilter

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 ,all I need to do is change them 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:
users@infra.apache.org


With regards,
Apache Git Services

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