abhishekagarwal87 commented on a change in pull request #10366: URL: https://github.com/apache/druid/pull/10366#discussion_r492023432
########## File path: processing/src/main/java/org/apache/druid/segment/join/Joinables.java ########## @@ -118,6 +112,74 @@ public static boolean isPrefixedBy(final String columnName, final String prefix) ); } + /** + * Compute a cache key prefix for data sources that participate in the RHS of a join. This key prefix + * can be used in segment level cache or result level cache. The function can return following wrapped in an + * Optional + * - Non-empty byte array - If there is join datasource involved and caching is possible. The result includes + * join condition expression, join type and cache key returned by joinable factory for each {@link PreJoinableClause} + * - NULL - There is a join but caching is not possible. It may happen if one of the participating datasource + * in the JOIN is not cacheable. + * + * @throws {@link IAE} if this operation is called on a non-join data source + * @param dataSourceAnalysis + * @return + */ + public Optional<byte[]> computeJoinDataSourceCacheKey( + final DataSourceAnalysis dataSourceAnalysis + ) + { + + final List<PreJoinableClause> clauses = dataSourceAnalysis.getPreJoinableClauses(); + if (clauses.isEmpty()) { + throw new IAE("No join clauses to build the cache key"); Review comment: While I am going to add `dataSourceAnalysis.getDataSource()` to the exception string, I just hope it doesn't blow up the message. On a quick look, it looks alright though. ---------------------------------------------------------------- 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 --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org For additional commands, e-mail: commits-h...@druid.apache.org