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 2021/06/14 07:19:43 UTC

[GitHub] [druid] clintropolis commented on a change in pull request #11358: enrich expression cache key information to support expressions which depend on external state

clintropolis commented on a change in pull request #11358:
URL: https://github.com/apache/druid/pull/11358#discussion_r649685362



##########
File path: processing/src/main/java/org/apache/druid/query/expression/LookupExprMacro.java
##########
@@ -36,6 +37,7 @@
 
 public class LookupExprMacro implements ExprMacroTable.ExprMacro
 {
+  private static final byte LOOKUP_EXPR_KEY = 0x01;

Review comment:
       I was worried about that too, but hesitated since `Expr` is in core and this is in processing and also some others such as the `DimensionSpec` have this problem, but yeah I agree and fixed it and moved both of them to `Exprs` because wasn't sure where else to put it and it seemed sort of funny on `Expr`.

##########
File path: core/src/main/java/org/apache/druid/math/expr/Expr.java
##########
@@ -171,6 +174,12 @@ default boolean canVectorize(InputBindingInspector inspector)
     throw Exprs.cannotVectorize(this);
   }
 
+  @Override
+  default byte[] getCacheKey()
+  {
+    return new CacheKeyBuilder(EXPR_CACHE_KEY).appendString(stringify()).build();

Review comment:
       added caching similar to the `Expr` themselves

##########
File path: core/src/main/java/org/apache/druid/math/expr/Exprs.java
##########
@@ -29,6 +29,9 @@
 
 public class Exprs
 {
+  public static final byte EXPR_CACHE_KEY = 0x00;
+  public static final byte LOOKUP_EXPR_KEY = 0x01;

Review comment:
       oops, meant to rename to `LOOKUP_EXPR_CACHE_KEY` when i moved here, fixed




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



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