abhishekagarwal87 commented on code in PR #11595:
URL: https://github.com/apache/druid/pull/11595#discussion_r1259630350
##########
processing/src/main/java/org/apache/druid/query/CacheStrategy.java:
##########
@@ -36,17 +36,35 @@
@ExtensionPoint
public interface CacheStrategy<T, CacheType, QueryType extends Query<T>>
{
+ /**
+ * This method is deprecated and retained for backward incompatibility.
+ * Returns whether the given query is cacheable or not.
+ * The {@code willMergeRunners} parameter can be used for distinguishing the
caller is a broker or a data node.
+ *
+ * @param ignoredQuery the query to be cached
+ * @param ignoredWillMergeRunners indicates that {@link
QueryRunnerFactory#mergeRunners(QueryProcessingPool, Iterable)} will be
+ * called on the cached by-segment results
+ *
+ * @return true if the query is cacheable, otherwise false.
+ */
+ @Deprecated
+ default boolean isCacheable(QueryType ignoredQuery, boolean
ignoredWillMergeRunners)
Review Comment:
This is the old method and doesn't need a default implementation as such but
a default impl is good since implementations don't need to override the
deprecated method. The new method will definitely require a default
implementation. You can do this
```
/**
* This method is deprecated and retained for backward incompatibility.
* Returns whether the given query is cacheable or not.
* The {@code willMergeRunners} parameter can be used for distinguishing
the caller is a broker or a data node.
*
* @param ignoredQuery the query to be cached
* @param ignoredWillMergeRunners indicates that {@link
QueryRunnerFactory#mergeRunners(QueryProcessingPool, Iterable)} will be
* called on the cached by-segment results
*
* @return true if the query is cacheable, otherwise false.
*/
@Deprecated
default boolean isCacheable(QueryType ignoredQuery, boolean
ignoredWillMergeRunners)
{
return false;
}
/**
* Returns whether the given query is cacheable or not.
* The {@code willMergeRunners} parameter can be used for distinguishing
the caller is a broker or a data node.
*
* @param query the query to be cached
* @param willMergeRunners indicates that {@link
QueryRunnerFactory#mergeRunners(QueryProcessingPool, Iterable)} will be
* called on the cached by-segment results
* @param bySegment segment level or result level cache
*
* @return true if the query is cacheable, otherwise false.
*/
default boolean isCacheable(QueryType query, boolean willMergeRunners,
boolean bySegment) {
return isCacheable(query, willMergeRunners)
}
```
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]