tibrewalpratik17 commented on code in PR #14631:
URL: https://github.com/apache/pinot/pull/14631#discussion_r1882651442
##########
pinot-timeseries/pinot-timeseries-planner/src/main/java/org/apache/pinot/tsdb/planner/TimeSeriesPlanFragmenter.java:
##########
@@ -102,8 +104,15 @@ public static List<BaseTimeSeriesPlanNode>
getFragments(BaseTimeSeriesPlanNode r
private static BaseTimeSeriesPlanNode
fragmentRecursively(BaseTimeSeriesPlanNode planNode, Context context) {
if (planNode instanceof LeafTimeSeriesPlanNode) {
LeafTimeSeriesPlanNode leafNode = (LeafTimeSeriesPlanNode) planNode;
- context._fragments.add(leafNode.withInputs(Collections.emptyList()));
- return new TimeSeriesExchangeNode(planNode.getId(),
Collections.emptyList(), leafNode.getAggInfo());
+ AggInfo currentAggInfo = leafNode.getAggInfo();
+ if (currentAggInfo == null) {
+ context._fragments.add(leafNode.withInputs(Collections.emptyList()));
+ } else {
+ Preconditions.checkState(!currentAggInfo.getIsPartial(),
+ "Leaf node in the logical plan should not have partial agg");
+
context._fragments.add(leafNode.withAggInfo(currentAggInfo.withPartialAggregation()));
Review Comment:
If currentAggInfo isPartial is false, then shouldn't we use
currentAggInfo.withFullAggregation here?
##########
pinot-timeseries/pinot-timeseries-spi/src/main/java/org/apache/pinot/tsdb/spi/AggInfo.java:
##########
@@ -41,24 +41,38 @@
* Example usage:
* Map<String, String> params = new HashMap<>();
* params.put("window", "5m");
- * AggInfo aggInfo = new AggInfo("rate", params);
+ * AggInfo aggInfo = new AggInfo("rate", true, params);
*/
public class AggInfo {
private final String _aggFunction;
+ private final boolean _isPartial;
Review Comment:
nit: javadoc on isPartial var
##########
pinot-plugins/pinot-timeseries-lang/pinot-timeseries-m3ql/src/main/java/org/apache/pinot/tsdb/m3ql/M3TimeSeriesPlanner.java:
##########
@@ -84,7 +85,7 @@ public BaseTimeSeriesPlanNode
planQuery(RangeTimeSeriesRequest request) {
case "max":
Preconditions.checkState(commandId == 1, "Aggregation should be the
second command (fetch should be first)");
Preconditions.checkState(aggInfo == null, "Aggregation already set.
Only single agg allowed.");
- aggInfo = new AggInfo(command.toUpperCase(Locale.ENGLISH), null);
+ aggInfo = new AggInfo(command.toUpperCase(Locale.ENGLISH), false,
Collections.emptyMap());
Review Comment:
We have quite flexibly used null and Collections.emptyMap() in different
places. Should we just have one?
--
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]