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/05/30 04:54:51 UTC

[GitHub] [incubator-druid] litao91 commented on a change in pull request #7791: Fix repeatedly expr parsing in ExpressionPostAggregation

litao91 commented on a change in pull request #7791: Fix repeatedly expr parsing in ExpressionPostAggregation
URL: https://github.com/apache/incubator-druid/pull/7791#discussion_r288857622
 
 

 ##########
 File path: processing/src/main/java/org/apache/druid/query/aggregation/post/ExpressionPostAggregator.java
 ##########
 @@ -100,14 +102,38 @@ private ExpressionPostAggregator(
     this.macroTable = macroTable;
     this.finalizers = finalizers;
 
-    this.parsed = Parser.parse(expression, macroTable);
-    this.dependentFields = ImmutableSet.copyOf(Parser.findRequiredBindings(parsed));
+    this.parsed = Suppliers.memoize(() -> Parser.parse(expression, macroTable));
+    this.dependentFields = Suppliers.memoize(() -> ImmutableSet.copyOf(Parser.findRequiredBindings(parsed.get())));
   }
 
+  private ExpressionPostAggregator(
 
 Review comment:
   Well, I actually deliberately copied the code as Java force the constructor call to be the first statement. So to avoid code copying, I have to introduce one extra constructor, please check which one is preferred. 

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