You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by "kgyrtkirk (via GitHub)" <gi...@apache.org> on 2025/07/02 16:40:02 UTC
[PR] Process Aggregate/Limit in decoupled dart planning (druid)
kgyrtkirk opened a new pull request, #18191:
URL: https://github.com/apache/druid/pull/18191
* also adds some test plumbing to run `Calcite*Test` -s against dart
* cases of `CalciteQueryTest` were enabled
--
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: commits-unsubscribe@druid.apache.org
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
Re: [PR] Process Aggregate/Limit in decoupled dart planning (druid)
Posted by "cryptoe (via GitHub)" <gi...@apache.org>.
cryptoe merged PR #18191:
URL: https://github.com/apache/druid/pull/18191
--
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: commits-unsubscribe@druid.apache.org
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
Re: [PR] Process Aggregate/Limit in decoupled dart planning (druid)
Posted by "kgyrtkirk (via GitHub)" <gi...@apache.org>.
kgyrtkirk commented on code in PR #18191:
URL: https://github.com/apache/druid/pull/18191#discussion_r2192327727
##########
extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/logical/stages/GroupByStages.java:
##########
@@ -0,0 +1,122 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.druid.msq.logical.stages;
+
+import org.apache.druid.frame.key.KeyColumn;
+import org.apache.druid.frame.key.KeyOrder;
+import org.apache.druid.java.util.common.granularity.Granularities;
+import org.apache.druid.msq.exec.StageProcessor;
+import org.apache.druid.msq.logical.LogicalInputSpec;
+import org.apache.druid.msq.logical.StageMaker;
+import org.apache.druid.msq.querykit.groupby.GroupByPostShuffleStageProcessor;
+import org.apache.druid.msq.querykit.groupby.GroupByPreShuffleStageProcessor;
+import org.apache.druid.query.TableDataSource;
+import org.apache.druid.query.groupby.GroupByQuery;
+import org.apache.druid.query.spec.QuerySegmentSpec;
+import org.apache.druid.segment.column.RowSignature;
+import org.apache.druid.segment.column.RowSignature.Finalization;
+import org.apache.druid.sql.calcite.aggregation.DimensionExpression;
+import org.apache.druid.sql.calcite.planner.querygen.DruidQueryGenerator.DruidNodeStack;
+import org.apache.druid.sql.calcite.rel.Grouping;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+public class GroupByStages
+{
+ public static class PreShuffleStage extends ProjectStage
+ {
+ private GroupByQuery gby;
+
+ public PreShuffleStage(ProjectStage projectStage, GroupByQuery gby)
+ {
+ super(projectStage, gby.getResultRowSignature(Finalization.NO));
+ this.gby = gby;
+ }
+
+ @Override
+ public LogicalStage extendWith(DruidNodeStack stack)
+ {
+ return null;
+ }
+
+ @Override
+ public StageProcessor<?, ?> buildStageProcessor(StageMaker stageMaker)
+ {
+ return new GroupByPreShuffleStageProcessor(gby);
+ }
+ }
+
+ static class PostShuffleStage extends AbstractFrameProcessorStage
+ {
+ private GroupByQuery gby;
+
+ public PostShuffleStage(LogicalStage inputStage, GroupByQuery gby, RowSignature outputSignature)
+ {
+ super(outputSignature, LogicalInputSpec.of(inputStage));
+ this.gby = gby;
+ }
+
+ @Override
+ public LogicalStage extendWith(DruidNodeStack stack)
+ {
+ return null;
+ }
+
+ @Override
+ public StageProcessor<?, ?> buildStageProcessor(StageMaker stageMaker)
+ {
+ return new GroupByPostShuffleStageProcessor(gby);
+ }
+ }
+
+ public static LogicalStage buildStages(ProjectStage projectStage, Grouping grouping)
+ {
+ GroupByQuery gby = makeGbyQuery(projectStage, grouping);
+ PreShuffleStage aggStage = new PreShuffleStage(projectStage, gby.withPostAggregatorSpecs(Collections.emptyList()));
+ SortStage sortStage = new SortStage(aggStage, getKeyColumns(grouping.getDimensions()));
+ PostShuffleStage finalAggStage = new PostShuffleStage(sortStage, gby, grouping.getOutputRowSignature());
+ return finalAggStage;
+ }
+
+ private static GroupByQuery makeGbyQuery(ProjectStage projectStage, Grouping grouping)
+ {
+ GroupByQuery.Builder builder = GroupByQuery.builder();
+ builder.setDimensions(grouping.getDimensionSpecs());
+ builder.setQuerySegmentSpec(QuerySegmentSpec.ETERNITY);
+ builder.setGranularity(Granularities.ALL);
+ builder.setAggregatorSpecs(grouping.getAggregatorFactories());
+ builder.setDimFilter(projectStage.getDimFilter());
+ builder.setVirtualColumns(projectStage.getVirtualColumns());
+ builder.setPostAggregatorSpecs(grouping.getPostAggregators());
+ builder.setDataSource(new TableDataSource("DUMMY"));
Review Comment:
for these stages there is no real `DataSource` - the `query` is only used as an api contract object which could haul a lot of things...
`PreShuffleStage` / `PostShuffleStage` doesn't really care about the `DataSource` itself - but to have a valid `GroupByQuery` it must be set to something - otherwise the query can't be built.
Created a static field instead of creating it here - and added a note to it.
--
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: commits-unsubscribe@druid.apache.org
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
Re: [PR] Process Aggregate/Limit in decoupled dart planning (druid)
Posted by "kgyrtkirk (via GitHub)" <gi...@apache.org>.
kgyrtkirk commented on PR #18191:
URL: https://github.com/apache/druid/pull/18191#issuecomment-3049165811
@cryptoe Thank you for reviewing the changes!@
--
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: commits-unsubscribe@druid.apache.org
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
Re: [PR] Process Aggregate/Limit in decoupled dart planning (druid)
Posted by "kgyrtkirk (via GitHub)" <gi...@apache.org>.
kgyrtkirk commented on code in PR #18191:
URL: https://github.com/apache/druid/pull/18191#discussion_r2192253857
##########
extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/logical/stages/GroupByStages.java:
##########
@@ -0,0 +1,122 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.druid.msq.logical.stages;
+
+import org.apache.druid.frame.key.KeyColumn;
+import org.apache.druid.frame.key.KeyOrder;
+import org.apache.druid.java.util.common.granularity.Granularities;
+import org.apache.druid.msq.exec.StageProcessor;
+import org.apache.druid.msq.logical.LogicalInputSpec;
+import org.apache.druid.msq.logical.StageMaker;
+import org.apache.druid.msq.querykit.groupby.GroupByPostShuffleStageProcessor;
+import org.apache.druid.msq.querykit.groupby.GroupByPreShuffleStageProcessor;
+import org.apache.druid.query.TableDataSource;
+import org.apache.druid.query.groupby.GroupByQuery;
+import org.apache.druid.query.spec.QuerySegmentSpec;
+import org.apache.druid.segment.column.RowSignature;
+import org.apache.druid.segment.column.RowSignature.Finalization;
+import org.apache.druid.sql.calcite.aggregation.DimensionExpression;
+import org.apache.druid.sql.calcite.planner.querygen.DruidQueryGenerator.DruidNodeStack;
+import org.apache.druid.sql.calcite.rel.Grouping;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+public class GroupByStages
+{
+ public static class PreShuffleStage extends ProjectStage
+ {
+ private GroupByQuery gby;
+
+ public PreShuffleStage(ProjectStage projectStage, GroupByQuery gby)
+ {
+ super(projectStage, gby.getResultRowSignature(Finalization.NO));
+ this.gby = gby;
+ }
+
+ @Override
+ public LogicalStage extendWith(DruidNodeStack stack)
+ {
+ return null;
+ }
+
+ @Override
+ public StageProcessor<?, ?> buildStageProcessor(StageMaker stageMaker)
+ {
+ return new GroupByPreShuffleStageProcessor(gby);
+ }
+ }
+
+ static class PostShuffleStage extends AbstractFrameProcessorStage
+ {
+ private GroupByQuery gby;
+
+ public PostShuffleStage(LogicalStage inputStage, GroupByQuery gby, RowSignature outputSignature)
+ {
+ super(outputSignature, LogicalInputSpec.of(inputStage));
+ this.gby = gby;
+ }
+
+ @Override
+ public LogicalStage extendWith(DruidNodeStack stack)
+ {
+ return null;
+ }
+
+ @Override
+ public StageProcessor<?, ?> buildStageProcessor(StageMaker stageMaker)
+ {
+ return new GroupByPostShuffleStageProcessor(gby);
+ }
+ }
+
+ public static LogicalStage buildStages(ProjectStage projectStage, Grouping grouping)
+ {
+ GroupByQuery gby = makeGbyQuery(projectStage, grouping);
+ PreShuffleStage aggStage = new PreShuffleStage(projectStage, gby.withPostAggregatorSpecs(Collections.emptyList()));
+ SortStage sortStage = new SortStage(aggStage, getKeyColumns(grouping.getDimensions()));
+ PostShuffleStage finalAggStage = new PostShuffleStage(sortStage, gby, grouping.getOutputRowSignature());
+ return finalAggStage;
+ }
+
+ private static GroupByQuery makeGbyQuery(ProjectStage projectStage, Grouping grouping)
+ {
+ GroupByQuery.Builder builder = GroupByQuery.builder();
+ builder.setDimensions(grouping.getDimensionSpecs());
+ builder.setQuerySegmentSpec(QuerySegmentSpec.ETERNITY);
+ builder.setGranularity(Granularities.ALL);
Review Comment:
insert is not yet supported - and I think when it will be ; it should be different:
I think the presence of those context keys are there due to the fact that insert needed some tweaks to the final writer - this pattern have added some extra things here and there.
I imagine that adding a `TableModify` or something similar top level element describing the high level `insert` details could provide a more natural home for these details.
--
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: commits-unsubscribe@druid.apache.org
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
Re: [PR] Process Aggregate/Limit in decoupled dart planning (druid)
Posted by "github-advanced-security[bot] (via GitHub)" <gi...@apache.org>.
github-advanced-security[bot] commented on code in PR #18191:
URL: https://github.com/apache/druid/pull/18191#discussion_r2180570566
##########
extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/logical/DruidLogicalToQueryDefinitionTranslator.java:
##########
@@ -122,16 +124,21 @@
{
if (stack.getNode() instanceof DruidSort) {
DruidSort sort = (DruidSort) stack.getNode();
- if (sort.hasLimitOrOffset()) {
- throw DruidException.defensive("Sort with limit or offset is not supported in MSQ logical stage builder");
- }
List<OrderByColumnSpec> orderBySpecs = DruidQuery.buildOrderByColumnSpecs(inputStage.getLogicalRowSignature(), sort);
List<KeyColumn> keyColumns = Lists.transform(orderBySpecs, KeyColumn::fromOrderByColumnSpec);
- return new SortStage(inputStage, keyColumns);
+ SortStage sortStage = new SortStage(inputStage, keyColumns);
+
+ if (sort.hasLimitOrOffset()) {
+ OffsetLimit offsetLimit = sort.getOffsetLimit();
Review Comment:
## Unread local variable
Variable 'OffsetLimit offsetLimit' is never read.
[Show more details](https://github.com/apache/druid/security/code-scanning/9326)
--
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: commits-unsubscribe@druid.apache.org
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
Re: [PR] Process Aggregate/Limit in decoupled dart planning (druid)
Posted by "cryptoe (via GitHub)" <gi...@apache.org>.
cryptoe commented on code in PR #18191:
URL: https://github.com/apache/druid/pull/18191#discussion_r2191536584
##########
extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/logical/stages/SortStage.java:
##########
@@ -62,4 +67,37 @@ public LogicalStage extendWith(DruidNodeStack stack)
return null;
}
+
+ public static class OffsetLimitStage extends AbstractFrameProcessorStage
Review Comment:
This can be a separate stage class no ?
##########
extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/logical/stages/GroupByStages.java:
##########
@@ -0,0 +1,122 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.druid.msq.logical.stages;
+
+import org.apache.druid.frame.key.KeyColumn;
+import org.apache.druid.frame.key.KeyOrder;
+import org.apache.druid.java.util.common.granularity.Granularities;
+import org.apache.druid.msq.exec.StageProcessor;
+import org.apache.druid.msq.logical.LogicalInputSpec;
+import org.apache.druid.msq.logical.StageMaker;
+import org.apache.druid.msq.querykit.groupby.GroupByPostShuffleStageProcessor;
+import org.apache.druid.msq.querykit.groupby.GroupByPreShuffleStageProcessor;
+import org.apache.druid.query.TableDataSource;
+import org.apache.druid.query.groupby.GroupByQuery;
+import org.apache.druid.query.spec.QuerySegmentSpec;
+import org.apache.druid.segment.column.RowSignature;
+import org.apache.druid.segment.column.RowSignature.Finalization;
+import org.apache.druid.sql.calcite.aggregation.DimensionExpression;
+import org.apache.druid.sql.calcite.planner.querygen.DruidQueryGenerator.DruidNodeStack;
+import org.apache.druid.sql.calcite.rel.Grouping;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+public class GroupByStages
+{
+ public static class PreShuffleStage extends ProjectStage
+ {
+ private GroupByQuery gby;
+
+ public PreShuffleStage(ProjectStage projectStage, GroupByQuery gby)
+ {
+ super(projectStage, gby.getResultRowSignature(Finalization.NO));
+ this.gby = gby;
+ }
+
+ @Override
+ public LogicalStage extendWith(DruidNodeStack stack)
+ {
+ return null;
+ }
+
+ @Override
+ public StageProcessor<?, ?> buildStageProcessor(StageMaker stageMaker)
+ {
+ return new GroupByPreShuffleStageProcessor(gby);
+ }
+ }
+
+ static class PostShuffleStage extends AbstractFrameProcessorStage
+ {
+ private GroupByQuery gby;
+
+ public PostShuffleStage(LogicalStage inputStage, GroupByQuery gby, RowSignature outputSignature)
+ {
+ super(outputSignature, LogicalInputSpec.of(inputStage));
+ this.gby = gby;
+ }
+
+ @Override
+ public LogicalStage extendWith(DruidNodeStack stack)
+ {
+ return null;
+ }
+
+ @Override
+ public StageProcessor<?, ?> buildStageProcessor(StageMaker stageMaker)
+ {
+ return new GroupByPostShuffleStageProcessor(gby);
+ }
+ }
+
+ public static LogicalStage buildStages(ProjectStage projectStage, Grouping grouping)
+ {
+ GroupByQuery gby = makeGbyQuery(projectStage, grouping);
+ PreShuffleStage aggStage = new PreShuffleStage(projectStage, gby.withPostAggregatorSpecs(Collections.emptyList()));
+ SortStage sortStage = new SortStage(aggStage, getKeyColumns(grouping.getDimensions()));
+ PostShuffleStage finalAggStage = new PostShuffleStage(sortStage, gby, grouping.getOutputRowSignature());
+ return finalAggStage;
+ }
+
+ private static GroupByQuery makeGbyQuery(ProjectStage projectStage, Grouping grouping)
+ {
+ GroupByQuery.Builder builder = GroupByQuery.builder();
+ builder.setDimensions(grouping.getDimensionSpecs());
+ builder.setQuerySegmentSpec(QuerySegmentSpec.ETERNITY);
+ builder.setGranularity(Granularities.ALL);
+ builder.setAggregatorSpecs(grouping.getAggregatorFactories());
+ builder.setDimFilter(projectStage.getDimFilter());
+ builder.setVirtualColumns(projectStage.getVirtualColumns());
+ builder.setPostAggregatorSpecs(grouping.getPostAggregators());
+ builder.setDataSource(new TableDataSource("DUMMY"));
Review Comment:
Would be helpful to understand why this was named as dummy and not the actual data source.
##########
extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/logical/stages/GroupByStages.java:
##########
@@ -0,0 +1,122 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.druid.msq.logical.stages;
+
+import org.apache.druid.frame.key.KeyColumn;
+import org.apache.druid.frame.key.KeyOrder;
+import org.apache.druid.java.util.common.granularity.Granularities;
+import org.apache.druid.msq.exec.StageProcessor;
+import org.apache.druid.msq.logical.LogicalInputSpec;
+import org.apache.druid.msq.logical.StageMaker;
+import org.apache.druid.msq.querykit.groupby.GroupByPostShuffleStageProcessor;
+import org.apache.druid.msq.querykit.groupby.GroupByPreShuffleStageProcessor;
+import org.apache.druid.query.TableDataSource;
+import org.apache.druid.query.groupby.GroupByQuery;
+import org.apache.druid.query.spec.QuerySegmentSpec;
+import org.apache.druid.segment.column.RowSignature;
+import org.apache.druid.segment.column.RowSignature.Finalization;
+import org.apache.druid.sql.calcite.aggregation.DimensionExpression;
+import org.apache.druid.sql.calcite.planner.querygen.DruidQueryGenerator.DruidNodeStack;
+import org.apache.druid.sql.calcite.rel.Grouping;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+public class GroupByStages
+{
+ public static class PreShuffleStage extends ProjectStage
+ {
+ private GroupByQuery gby;
+
+ public PreShuffleStage(ProjectStage projectStage, GroupByQuery gby)
+ {
+ super(projectStage, gby.getResultRowSignature(Finalization.NO));
+ this.gby = gby;
+ }
+
+ @Override
+ public LogicalStage extendWith(DruidNodeStack stack)
+ {
+ return null;
+ }
+
+ @Override
+ public StageProcessor<?, ?> buildStageProcessor(StageMaker stageMaker)
+ {
+ return new GroupByPreShuffleStageProcessor(gby);
+ }
+ }
+
+ static class PostShuffleStage extends AbstractFrameProcessorStage
+ {
+ private GroupByQuery gby;
+
+ public PostShuffleStage(LogicalStage inputStage, GroupByQuery gby, RowSignature outputSignature)
+ {
+ super(outputSignature, LogicalInputSpec.of(inputStage));
+ this.gby = gby;
+ }
+
+ @Override
+ public LogicalStage extendWith(DruidNodeStack stack)
+ {
+ return null;
+ }
+
+ @Override
+ public StageProcessor<?, ?> buildStageProcessor(StageMaker stageMaker)
+ {
+ return new GroupByPostShuffleStageProcessor(gby);
+ }
+ }
+
+ public static LogicalStage buildStages(ProjectStage projectStage, Grouping grouping)
+ {
+ GroupByQuery gby = makeGbyQuery(projectStage, grouping);
+ PreShuffleStage aggStage = new PreShuffleStage(projectStage, gby.withPostAggregatorSpecs(Collections.emptyList()));
+ SortStage sortStage = new SortStage(aggStage, getKeyColumns(grouping.getDimensions()));
+ PostShuffleStage finalAggStage = new PostShuffleStage(sortStage, gby, grouping.getOutputRowSignature());
+ return finalAggStage;
+ }
+
+ private static GroupByQuery makeGbyQuery(ProjectStage projectStage, Grouping grouping)
+ {
+ GroupByQuery.Builder builder = GroupByQuery.builder();
+ builder.setDimensions(grouping.getDimensionSpecs());
+ builder.setQuerySegmentSpec(QuerySegmentSpec.ETERNITY);
+ builder.setGranularity(Granularities.ALL);
Review Comment:
This should be fetched from query context no ? https://github.com/apache/druid/blob/36723f1f012a5fa429fb1b60e14433e4a283778b/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/querykit/QueryKitUtils.java#L81
##########
extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/logical/stages/GroupByStages.java:
##########
@@ -0,0 +1,122 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.druid.msq.logical.stages;
+
+import org.apache.druid.frame.key.KeyColumn;
+import org.apache.druid.frame.key.KeyOrder;
+import org.apache.druid.java.util.common.granularity.Granularities;
+import org.apache.druid.msq.exec.StageProcessor;
+import org.apache.druid.msq.logical.LogicalInputSpec;
+import org.apache.druid.msq.logical.StageMaker;
+import org.apache.druid.msq.querykit.groupby.GroupByPostShuffleStageProcessor;
+import org.apache.druid.msq.querykit.groupby.GroupByPreShuffleStageProcessor;
+import org.apache.druid.query.TableDataSource;
+import org.apache.druid.query.groupby.GroupByQuery;
+import org.apache.druid.query.spec.QuerySegmentSpec;
+import org.apache.druid.segment.column.RowSignature;
+import org.apache.druid.segment.column.RowSignature.Finalization;
+import org.apache.druid.sql.calcite.aggregation.DimensionExpression;
+import org.apache.druid.sql.calcite.planner.querygen.DruidQueryGenerator.DruidNodeStack;
+import org.apache.druid.sql.calcite.rel.Grouping;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+public class GroupByStages
+{
+ public static class PreShuffleStage extends ProjectStage
+ {
+ private GroupByQuery gby;
Review Comment:
```suggestion
private GroupByQuery groupByQuery;
```
Small nit.
--
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: commits-unsubscribe@druid.apache.org
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