clintropolis commented on code in PR #13085:
URL: https://github.com/apache/druid/pull/13085#discussion_r997561473
##########
processing/src/main/java/org/apache/druid/query/DataSource.java:
##########
@@ -83,8 +89,40 @@
* Returns true if this datasource represents concrete data that can be
scanned via a
* {@link org.apache.druid.segment.Segment} adapter of some kind. True for
e.g. 'table' but not for 'query' or 'join'.
*
- * @see org.apache.druid.query.planning.DataSourceAnalysis#isConcreteBased()
which uses this
- * @see
org.apache.druid.query.planning.DataSourceAnalysis#isConcreteTableBased() which
uses this
+ * @see DataSourceAnalysis#isConcreteBased() which uses this
+ * @see DataSourceAnalysis#isConcreteTableBased() which uses this
*/
boolean isConcrete();
+
+ /**
+ * Returns a segment function on to how to segment should be modified.
+ *
+ * @param query the input query
+ * @param cpuTimeAcc the cpu time accumulator
+ * @return the segment function
+ */
+ Function<SegmentReference, SegmentReference> createSegmentMapFunction(Query
query, AtomicLong cpuTimeAcc);
+
+ /**
+ * Returns an updated datasource based on the specified new source.
+ *
+ * @param newSource the new datasource to be used to update an existing query
+ * @return the updated datasource to be used
+ */
+ DataSource withUpdatedDataSource(DataSource newSource);
+
+ /**
+ * Compute a cache key prefix for a data source. This includes the data
sources that participate in the RHS of a
+ * join as well as any query specific constructs associated with join data
source such as base table filter. This key prefix
+ * can be used in segment level cache or result level cache. The function
can return following
+ * - 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.
+ *
+ * @return the cache key to be used as part of query cache key
+ * @throws {@link IAE} if this operation is called on a non-join data source
+ */
+ byte[] getCacheKey();
Review Comment:
>throws {@link IAE} if this operation is called on a non-join data source
the javadocs are maybe not true exactly? it looks like most implementations
are currently returning empty bytes.
Im also a bit unsure how great this naming is given that it should only be
used for joins afaik, and not used at all for cache keys otherwise. it seems
sort of seems like it would be important for all query types, but calling it
something specific to joins also seems short sighted... Not sure what exactly
to do here.. maybe this needs a wider discussion about what kinds of
datasources need to implement this and what do not which would help clear this
up
--
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]