From 4c42d6c14c366c85e2416b5748f817a0cccac13e Mon Sep 17 00:00:00 2001 From: Akshat Jain Date: Thu, 24 Oct 2024 09:41:34 +0530 Subject: [PATCH 1/5] WindowOperatorQueryKit: Pass QueryContext instead of WindowOperatorQuery to subsequent layers --- .../druid/msq/querykit/QueryKitUtils.java | 13 +++++++++--- .../WindowOperatorQueryFrameProcessor.java | 8 ++++---- ...dowOperatorQueryFrameProcessorFactory.java | 20 +++++++++---------- .../msq/querykit/WindowOperatorQueryKit.java | 2 +- ...peratorQueryFrameProcessorFactoryTest.java | 2 +- ...WindowOperatorQueryFrameProcessorTest.java | 6 +++--- 6 files changed, 29 insertions(+), 22 deletions(-) diff --git a/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/querykit/QueryKitUtils.java b/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/querykit/QueryKitUtils.java index e5f2a0152fd8..9c6d149c3254 100644 --- a/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/querykit/QueryKitUtils.java +++ b/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/querykit/QueryKitUtils.java @@ -35,6 +35,7 @@ import org.apache.druid.msq.indexing.error.ColumnNameRestrictedFault; import org.apache.druid.msq.indexing.error.MSQException; import org.apache.druid.query.Query; +import org.apache.druid.query.QueryContext; import org.apache.druid.query.expression.TimestampFloorExprMacro; import org.apache.druid.segment.VirtualColumn; import org.apache.druid.segment.column.ColumnType; @@ -183,6 +184,12 @@ public static RowSignature sortableSignature( return builder.build(); } + @Nullable + public static VirtualColumn makeSegmentGranularityVirtualColumn(final ObjectMapper jsonMapper, final Query query) + { + return makeSegmentGranularityVirtualColumn(jsonMapper, query.context()); + } + /** * Returns a virtual column named {@link QueryKitUtils#SEGMENT_GRANULARITY_COLUMN} that computes a segment * granularity based on a particular time column. Returns null if no virtual column is needed because the @@ -191,11 +198,11 @@ public static RowSignature sortableSignature( * @throws IllegalArgumentException if the provided granularity is not supported */ @Nullable - public static VirtualColumn makeSegmentGranularityVirtualColumn(final ObjectMapper jsonMapper, final Query query) + public static VirtualColumn makeSegmentGranularityVirtualColumn(final ObjectMapper jsonMapper, final QueryContext queryContext) { final Granularity segmentGranularity = - QueryKitUtils.getSegmentGranularityFromContext(jsonMapper, query.getContext()); - final String timeColumnName = query.context().getString(QueryKitUtils.CTX_TIME_COLUMN_NAME); + QueryKitUtils.getSegmentGranularityFromContext(jsonMapper, queryContext.asMap()); + final String timeColumnName = queryContext.getString(QueryKitUtils.CTX_TIME_COLUMN_NAME); if (timeColumnName == null || Granularities.ALL.equals(segmentGranularity)) { return null; diff --git a/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/querykit/WindowOperatorQueryFrameProcessor.java b/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/querykit/WindowOperatorQueryFrameProcessor.java index 04cdab3b1fe9..b7d1970da3b0 100644 --- a/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/querykit/WindowOperatorQueryFrameProcessor.java +++ b/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/querykit/WindowOperatorQueryFrameProcessor.java @@ -39,10 +39,10 @@ import org.apache.druid.msq.indexing.error.MSQException; import org.apache.druid.msq.indexing.error.TooManyRowsInAWindowFault; import org.apache.druid.msq.util.MultiStageQueryContext; +import org.apache.druid.query.QueryContext; import org.apache.druid.query.operator.OffsetLimit; import org.apache.druid.query.operator.Operator; import org.apache.druid.query.operator.OperatorFactory; -import org.apache.druid.query.operator.WindowOperatorQuery; import org.apache.druid.query.rowsandcols.ConcatRowsAndColumns; import org.apache.druid.query.rowsandcols.LazilyDecoratedRowsAndColumns; import org.apache.druid.query.rowsandcols.RowsAndColumns; @@ -83,7 +83,7 @@ public class WindowOperatorQueryFrameProcessor implements FrameProcessor final AtomicInteger rowId = new AtomicInteger(0); public WindowOperatorQueryFrameProcessor( - WindowOperatorQuery query, + QueryContext queryContext, ReadableFrameChannel inputChannel, WritableFrameChannel outputChannel, FrameWriterFactory frameWriterFactory, @@ -97,7 +97,7 @@ public WindowOperatorQueryFrameProcessor( this.frameWriterFactory = frameWriterFactory; this.operatorFactoryList = operatorFactoryList; this.resultRowAndCols = new ArrayList<>(); - this.maxRowsMaterialized = MultiStageQueryContext.getMaxRowsMaterializedInWindow(query.context()); + this.maxRowsMaterialized = MultiStageQueryContext.getMaxRowsMaterializedInWindow(queryContext); this.frameRowsAndColsBuilder = new RowsAndColumnsBuilder(this.maxRowsMaterialized); this.frameReader = frameReader; @@ -106,7 +106,7 @@ public WindowOperatorQueryFrameProcessor( this.partitionBoostVirtualColumn = new SettableLongVirtualColumn(QueryKitUtils.PARTITION_BOOST_COLUMN); final List frameWriterVirtualColumns = new ArrayList<>(); final VirtualColumn segmentGranularityVirtualColumn = - QueryKitUtils.makeSegmentGranularityVirtualColumn(jsonMapper, query); + QueryKitUtils.makeSegmentGranularityVirtualColumn(jsonMapper, queryContext); if (segmentGranularityVirtualColumn != null) { frameWriterVirtualColumns.add(segmentGranularityVirtualColumn); } diff --git a/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/querykit/WindowOperatorQueryFrameProcessorFactory.java b/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/querykit/WindowOperatorQueryFrameProcessorFactory.java index 2f97ffd74b4c..14d8ebe7f091 100644 --- a/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/querykit/WindowOperatorQueryFrameProcessorFactory.java +++ b/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/querykit/WindowOperatorQueryFrameProcessorFactory.java @@ -43,8 +43,8 @@ import org.apache.druid.msq.kernel.FrameContext; import org.apache.druid.msq.kernel.ProcessorsAndChannels; import org.apache.druid.msq.kernel.StageDefinition; +import org.apache.druid.query.QueryContext; import org.apache.druid.query.operator.OperatorFactory; -import org.apache.druid.query.operator.WindowOperatorQuery; import org.apache.druid.segment.column.RowSignature; import javax.annotation.Nullable; @@ -56,26 +56,26 @@ @JsonTypeName("window") public class WindowOperatorQueryFrameProcessorFactory extends BaseFrameProcessorFactory { - private final WindowOperatorQuery query; + private final QueryContext queryContext; private final List operatorList; private final RowSignature stageRowSignature; @JsonCreator public WindowOperatorQueryFrameProcessorFactory( - @JsonProperty("query") WindowOperatorQuery query, + @JsonProperty("queryContext") QueryContext queryContext, @JsonProperty("operatorList") List operatorFactoryList, @JsonProperty("stageRowSignature") RowSignature stageRowSignature ) { - this.query = Preconditions.checkNotNull(query, "query"); + this.queryContext = Preconditions.checkNotNull(queryContext, "query"); this.operatorList = Preconditions.checkNotNull(operatorFactoryList, "bad operator"); this.stageRowSignature = Preconditions.checkNotNull(stageRowSignature, "stageSignature"); } - @JsonProperty("query") - public WindowOperatorQuery getQuery() + @JsonProperty("queryContext") + public QueryContext getQueryContext() { - return query; + return queryContext; } @JsonProperty("operatorList") @@ -132,7 +132,7 @@ public ProcessorsAndChannels makeProcessors( outputChannels.get(readableInput.getStagePartition().getPartitionNumber()); return new WindowOperatorQueryFrameProcessor( - query, + queryContext, readableInput.getChannel(), outputChannel.getWritableChannel(), stageDefinition.createFrameWriterFactory(outputChannel.getFrameMemoryAllocator(), removeNullBytes), @@ -165,7 +165,7 @@ public boolean equals(Object o) return false; } WindowOperatorQueryFrameProcessorFactory that = (WindowOperatorQueryFrameProcessorFactory) o; - return Objects.equals(query, that.query) + return Objects.equals(queryContext, that.queryContext) && Objects.equals(operatorList, that.operatorList) && Objects.equals(stageRowSignature, that.stageRowSignature); } @@ -173,6 +173,6 @@ public boolean equals(Object o) @Override public int hashCode() { - return Objects.hash(query, operatorList, stageRowSignature); + return Objects.hash(queryContext, operatorList, stageRowSignature); } } diff --git a/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/querykit/WindowOperatorQueryKit.java b/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/querykit/WindowOperatorQueryKit.java index bc789528b061..416b2fd035ec 100644 --- a/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/querykit/WindowOperatorQueryKit.java +++ b/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/querykit/WindowOperatorQueryKit.java @@ -173,7 +173,7 @@ public QueryDefinition makeQueryDefinition( .maxWorkerCount(queryKitSpec.getMaxNonLeafWorkerCount()) .shuffleSpec(nextShuffleSpec) .processorFactory(new WindowOperatorQueryFrameProcessorFactory( - queryToRun, + queryToRun.context(), getOperatorFactoryListForStageDefinition(operatorList.get(i), maxRowsMaterialized), stageRowSignature )) diff --git a/extensions-core/multi-stage-query/src/test/java/org/apache/druid/msq/querykit/WindowOperatorQueryFrameProcessorFactoryTest.java b/extensions-core/multi-stage-query/src/test/java/org/apache/druid/msq/querykit/WindowOperatorQueryFrameProcessorFactoryTest.java index 58affd228e17..05bcd2514ea0 100644 --- a/extensions-core/multi-stage-query/src/test/java/org/apache/druid/msq/querykit/WindowOperatorQueryFrameProcessorFactoryTest.java +++ b/extensions-core/multi-stage-query/src/test/java/org/apache/druid/msq/querykit/WindowOperatorQueryFrameProcessorFactoryTest.java @@ -28,7 +28,7 @@ public class WindowOperatorQueryFrameProcessorFactoryTest public void testEqualsAndHashcode() { EqualsVerifier.forClass(WindowOperatorQueryFrameProcessorFactory.class) - .withNonnullFields("query", "operatorList", "stageRowSignature") + .withNonnullFields("queryContext", "operatorList", "stageRowSignature") .usingGetClass() .verify(); } diff --git a/extensions-core/multi-stage-query/src/test/java/org/apache/druid/msq/querykit/WindowOperatorQueryFrameProcessorTest.java b/extensions-core/multi-stage-query/src/test/java/org/apache/druid/msq/querykit/WindowOperatorQueryFrameProcessorTest.java index 5d1b350ca929..e9484ec76e64 100644 --- a/extensions-core/multi-stage-query/src/test/java/org/apache/druid/msq/querykit/WindowOperatorQueryFrameProcessorTest.java +++ b/extensions-core/multi-stage-query/src/test/java/org/apache/druid/msq/querykit/WindowOperatorQueryFrameProcessorTest.java @@ -125,7 +125,7 @@ public void testFrameWriterReachingCapacity() throws IOException final BlockingQueueFrameChannel outputChannel = BlockingQueueFrameChannel.minimal(); final WindowOperatorQueryFrameProcessor processor = new WindowOperatorQueryFrameProcessor( - query, + query.context(), factChannel.getChannel(), outputChannel.writable(), frameWriterFactory, @@ -209,7 +209,7 @@ public void testOutputChannelReachingCapacity() throws IOException final BlockingQueueFrameChannel outputChannel = BlockingQueueFrameChannel.minimal(); final WindowOperatorQueryFrameProcessor processor = new WindowOperatorQueryFrameProcessor( - query, + query.context(), factChannel.getChannel(), outputChannel.writable(), frameWriterFactory, @@ -316,7 +316,7 @@ public void runProcessor(int maxRowsMaterialized, int expectedNumFramesWritten) ); final WindowOperatorQueryFrameProcessor processor = new WindowOperatorQueryFrameProcessor( - query, + query.context(), factChannel.getChannel(), countingWritableFrameChannel, frameWriterFactory, From 0851698d2436ba0f46840c0c190171ecd7fd6b8a Mon Sep 17 00:00:00 2001 From: Akshat Jain Date: Mon, 28 Oct 2024 09:50:08 +0530 Subject: [PATCH 2/5] Add serializer for QueryContext class --- .../org/apache/druid/msq/guice/MSQIndexingModule.java | 4 ++++ .../java/org/apache/druid/query/QueryContext.java | 11 ++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/guice/MSQIndexingModule.java b/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/guice/MSQIndexingModule.java index 341496f7842f..213e6c5a5d04 100644 --- a/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/guice/MSQIndexingModule.java +++ b/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/guice/MSQIndexingModule.java @@ -96,6 +96,7 @@ import org.apache.druid.msq.querykit.results.QueryResultFrameProcessorFactory; import org.apache.druid.msq.querykit.scan.ScanQueryFrameProcessorFactory; import org.apache.druid.msq.util.PassthroughAggregatorFactory; +import org.apache.druid.query.QueryContext; import java.util.Collections; import java.util.List; @@ -167,6 +168,9 @@ public List getJacksonModules() WindowOperatorQueryFrameProcessorFactory.class, ExportResultsFrameProcessorFactory.class, + // QueryContext + QueryContext.class, + // DataSource classes (note: ExternalDataSource is in MSQSqlModule) InputNumberDataSource.class, diff --git a/processing/src/main/java/org/apache/druid/query/QueryContext.java b/processing/src/main/java/org/apache/druid/query/QueryContext.java index 52395275967b..975a45b9bee4 100644 --- a/processing/src/main/java/org/apache/druid/query/QueryContext.java +++ b/processing/src/main/java/org/apache/druid/query/QueryContext.java @@ -19,6 +19,8 @@ package org.apache.druid.query; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.ObjectMapper; import org.apache.druid.java.util.common.HumanReadableBytes; import org.apache.druid.java.util.common.StringUtils; @@ -57,7 +59,8 @@ public class QueryContext private final Map context; - public QueryContext(Map context) + @JsonCreator + public QueryContext(@JsonProperty("context") Map context) { // There is no semantic difference between an empty and a null context. // Ensure that a context always exists to avoid the need to check for @@ -67,6 +70,12 @@ public QueryContext(Map context) : Collections.unmodifiableMap(new TreeMap<>(context)); } + @JsonProperty("context") + public Map getContext() + { + return context; + } + public static QueryContext empty() { return EMPTY; From fe236bac059a3dbe1e9aa7f2c28b4a5f6105a162 Mon Sep 17 00:00:00 2001 From: Akshat Jain Date: Tue, 29 Oct 2024 15:35:03 +0530 Subject: [PATCH 3/5] Revert changes of WindowOperatorQueryFrameProcessorFactory json param --- .../druid/msq/guice/MSQIndexingModule.java | 4 ---- ...dowOperatorQueryFrameProcessorFactory.java | 20 +++++++++---------- .../msq/querykit/WindowOperatorQueryKit.java | 2 +- ...peratorQueryFrameProcessorFactoryTest.java | 2 +- .../org/apache/druid/query/QueryContext.java | 11 +--------- 5 files changed, 13 insertions(+), 26 deletions(-) diff --git a/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/guice/MSQIndexingModule.java b/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/guice/MSQIndexingModule.java index 213e6c5a5d04..341496f7842f 100644 --- a/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/guice/MSQIndexingModule.java +++ b/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/guice/MSQIndexingModule.java @@ -96,7 +96,6 @@ import org.apache.druid.msq.querykit.results.QueryResultFrameProcessorFactory; import org.apache.druid.msq.querykit.scan.ScanQueryFrameProcessorFactory; import org.apache.druid.msq.util.PassthroughAggregatorFactory; -import org.apache.druid.query.QueryContext; import java.util.Collections; import java.util.List; @@ -168,9 +167,6 @@ public List getJacksonModules() WindowOperatorQueryFrameProcessorFactory.class, ExportResultsFrameProcessorFactory.class, - // QueryContext - QueryContext.class, - // DataSource classes (note: ExternalDataSource is in MSQSqlModule) InputNumberDataSource.class, diff --git a/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/querykit/WindowOperatorQueryFrameProcessorFactory.java b/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/querykit/WindowOperatorQueryFrameProcessorFactory.java index 14d8ebe7f091..85d512d4c5e0 100644 --- a/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/querykit/WindowOperatorQueryFrameProcessorFactory.java +++ b/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/querykit/WindowOperatorQueryFrameProcessorFactory.java @@ -43,8 +43,8 @@ import org.apache.druid.msq.kernel.FrameContext; import org.apache.druid.msq.kernel.ProcessorsAndChannels; import org.apache.druid.msq.kernel.StageDefinition; -import org.apache.druid.query.QueryContext; import org.apache.druid.query.operator.OperatorFactory; +import org.apache.druid.query.operator.WindowOperatorQuery; import org.apache.druid.segment.column.RowSignature; import javax.annotation.Nullable; @@ -56,26 +56,26 @@ @JsonTypeName("window") public class WindowOperatorQueryFrameProcessorFactory extends BaseFrameProcessorFactory { - private final QueryContext queryContext; + private final WindowOperatorQuery query; private final List operatorList; private final RowSignature stageRowSignature; @JsonCreator public WindowOperatorQueryFrameProcessorFactory( - @JsonProperty("queryContext") QueryContext queryContext, + @JsonProperty("query") WindowOperatorQuery query, @JsonProperty("operatorList") List operatorFactoryList, @JsonProperty("stageRowSignature") RowSignature stageRowSignature ) { - this.queryContext = Preconditions.checkNotNull(queryContext, "query"); + this.query = Preconditions.checkNotNull(query, "query"); this.operatorList = Preconditions.checkNotNull(operatorFactoryList, "bad operator"); this.stageRowSignature = Preconditions.checkNotNull(stageRowSignature, "stageSignature"); } - @JsonProperty("queryContext") - public QueryContext getQueryContext() + @JsonProperty("query") + public WindowOperatorQuery getQuery() { - return queryContext; + return query; } @JsonProperty("operatorList") @@ -132,7 +132,7 @@ public ProcessorsAndChannels makeProcessors( outputChannels.get(readableInput.getStagePartition().getPartitionNumber()); return new WindowOperatorQueryFrameProcessor( - queryContext, + query.context(), readableInput.getChannel(), outputChannel.getWritableChannel(), stageDefinition.createFrameWriterFactory(outputChannel.getFrameMemoryAllocator(), removeNullBytes), @@ -165,7 +165,7 @@ public boolean equals(Object o) return false; } WindowOperatorQueryFrameProcessorFactory that = (WindowOperatorQueryFrameProcessorFactory) o; - return Objects.equals(queryContext, that.queryContext) + return Objects.equals(query, that.query) && Objects.equals(operatorList, that.operatorList) && Objects.equals(stageRowSignature, that.stageRowSignature); } @@ -173,6 +173,6 @@ public boolean equals(Object o) @Override public int hashCode() { - return Objects.hash(queryContext, operatorList, stageRowSignature); + return Objects.hash(query, operatorList, stageRowSignature); } } diff --git a/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/querykit/WindowOperatorQueryKit.java b/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/querykit/WindowOperatorQueryKit.java index 416b2fd035ec..bc789528b061 100644 --- a/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/querykit/WindowOperatorQueryKit.java +++ b/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/querykit/WindowOperatorQueryKit.java @@ -173,7 +173,7 @@ public QueryDefinition makeQueryDefinition( .maxWorkerCount(queryKitSpec.getMaxNonLeafWorkerCount()) .shuffleSpec(nextShuffleSpec) .processorFactory(new WindowOperatorQueryFrameProcessorFactory( - queryToRun.context(), + queryToRun, getOperatorFactoryListForStageDefinition(operatorList.get(i), maxRowsMaterialized), stageRowSignature )) diff --git a/extensions-core/multi-stage-query/src/test/java/org/apache/druid/msq/querykit/WindowOperatorQueryFrameProcessorFactoryTest.java b/extensions-core/multi-stage-query/src/test/java/org/apache/druid/msq/querykit/WindowOperatorQueryFrameProcessorFactoryTest.java index 05bcd2514ea0..58affd228e17 100644 --- a/extensions-core/multi-stage-query/src/test/java/org/apache/druid/msq/querykit/WindowOperatorQueryFrameProcessorFactoryTest.java +++ b/extensions-core/multi-stage-query/src/test/java/org/apache/druid/msq/querykit/WindowOperatorQueryFrameProcessorFactoryTest.java @@ -28,7 +28,7 @@ public class WindowOperatorQueryFrameProcessorFactoryTest public void testEqualsAndHashcode() { EqualsVerifier.forClass(WindowOperatorQueryFrameProcessorFactory.class) - .withNonnullFields("queryContext", "operatorList", "stageRowSignature") + .withNonnullFields("query", "operatorList", "stageRowSignature") .usingGetClass() .verify(); } diff --git a/processing/src/main/java/org/apache/druid/query/QueryContext.java b/processing/src/main/java/org/apache/druid/query/QueryContext.java index 975a45b9bee4..52395275967b 100644 --- a/processing/src/main/java/org/apache/druid/query/QueryContext.java +++ b/processing/src/main/java/org/apache/druid/query/QueryContext.java @@ -19,8 +19,6 @@ package org.apache.druid.query; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.ObjectMapper; import org.apache.druid.java.util.common.HumanReadableBytes; import org.apache.druid.java.util.common.StringUtils; @@ -59,8 +57,7 @@ public class QueryContext private final Map context; - @JsonCreator - public QueryContext(@JsonProperty("context") Map context) + public QueryContext(Map context) { // There is no semantic difference between an empty and a null context. // Ensure that a context always exists to avoid the need to check for @@ -70,12 +67,6 @@ public QueryContext(@JsonProperty("context") Map context) : Collections.unmodifiableMap(new TreeMap<>(context)); } - @JsonProperty("context") - public Map getContext() - { - return context; - } - public static QueryContext empty() { return EMPTY; From 00aa0422914410b9a97f6e040a487a9190ed0010 Mon Sep 17 00:00:00 2001 From: Akshat Jain Date: Wed, 30 Oct 2024 14:11:15 +0530 Subject: [PATCH 4/5] Fix checkstyle --- .../msq/querykit/WindowOperatorQueryFrameProcessor.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/querykit/WindowOperatorQueryFrameProcessor.java b/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/querykit/WindowOperatorQueryFrameProcessor.java index 1b1f754462a6..41c1df884f96 100644 --- a/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/querykit/WindowOperatorQueryFrameProcessor.java +++ b/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/querykit/WindowOperatorQueryFrameProcessor.java @@ -40,12 +40,12 @@ import org.apache.druid.msq.indexing.error.TooManyRowsInAWindowFault; import org.apache.druid.msq.util.MultiStageQueryContext; import org.apache.druid.query.QueryContext; -import org.apache.druid.query.operator.OffsetLimit; -import org.apache.druid.query.operator.Operator; -import org.apache.druid.query.operator.OperatorFactory; import org.apache.druid.query.operator.AbstractPartitioningOperatorFactory; import org.apache.druid.query.operator.AbstractSortOperatorFactory; import org.apache.druid.query.operator.GlueingPartitioningOperatorFactory; +import org.apache.druid.query.operator.OffsetLimit; +import org.apache.druid.query.operator.Operator; +import org.apache.druid.query.operator.OperatorFactory; import org.apache.druid.query.operator.PartitionSortOperatorFactory; import org.apache.druid.query.rowsandcols.ConcatRowsAndColumns; import org.apache.druid.query.rowsandcols.LazilyDecoratedRowsAndColumns; From 75c82c4b353ed96c28493b26012d6682e0e47876 Mon Sep 17 00:00:00 2001 From: Akshat Jain Date: Mon, 4 Nov 2024 13:11:52 +0530 Subject: [PATCH 5/5] Address review comment: Remove older method in favor of calling new method inline --- .../java/org/apache/druid/msq/querykit/QueryKitUtils.java | 7 ------- .../querykit/groupby/GroupByPostShuffleFrameProcessor.java | 2 +- .../druid/msq/querykit/scan/ScanQueryFrameProcessor.java | 2 +- 3 files changed, 2 insertions(+), 9 deletions(-) diff --git a/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/querykit/QueryKitUtils.java b/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/querykit/QueryKitUtils.java index 9c6d149c3254..bc0c64c251a7 100644 --- a/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/querykit/QueryKitUtils.java +++ b/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/querykit/QueryKitUtils.java @@ -34,7 +34,6 @@ import org.apache.druid.math.expr.ExprMacroTable; import org.apache.druid.msq.indexing.error.ColumnNameRestrictedFault; import org.apache.druid.msq.indexing.error.MSQException; -import org.apache.druid.query.Query; import org.apache.druid.query.QueryContext; import org.apache.druid.query.expression.TimestampFloorExprMacro; import org.apache.druid.segment.VirtualColumn; @@ -184,12 +183,6 @@ public static RowSignature sortableSignature( return builder.build(); } - @Nullable - public static VirtualColumn makeSegmentGranularityVirtualColumn(final ObjectMapper jsonMapper, final Query query) - { - return makeSegmentGranularityVirtualColumn(jsonMapper, query.context()); - } - /** * Returns a virtual column named {@link QueryKitUtils#SEGMENT_GRANULARITY_COLUMN} that computes a segment * granularity based on a particular time column. Returns null if no virtual column is needed because the diff --git a/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/querykit/groupby/GroupByPostShuffleFrameProcessor.java b/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/querykit/groupby/GroupByPostShuffleFrameProcessor.java index 5b0a3ddefd2e..e9783b8366c5 100644 --- a/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/querykit/groupby/GroupByPostShuffleFrameProcessor.java +++ b/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/querykit/groupby/GroupByPostShuffleFrameProcessor.java @@ -321,7 +321,7 @@ private static VirtualColumns makeVirtualColumnsForFrameWriter( virtualColumns.add(partitionBoostVirtualColumn); final VirtualColumn segmentGranularityVirtualColumn = - QueryKitUtils.makeSegmentGranularityVirtualColumn(jsonMapper, query); + QueryKitUtils.makeSegmentGranularityVirtualColumn(jsonMapper, query.context()); if (segmentGranularityVirtualColumn != null) { virtualColumns.add(segmentGranularityVirtualColumn); } diff --git a/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/querykit/scan/ScanQueryFrameProcessor.java b/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/querykit/scan/ScanQueryFrameProcessor.java index 05f80b9805d5..1be191bddbe6 100644 --- a/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/querykit/scan/ScanQueryFrameProcessor.java +++ b/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/querykit/scan/ScanQueryFrameProcessor.java @@ -137,7 +137,7 @@ public ScanQueryFrameProcessor( frameWriterVirtualColumns.add(partitionBoostVirtualColumn); final VirtualColumn segmentGranularityVirtualColumn = - QueryKitUtils.makeSegmentGranularityVirtualColumn(jsonMapper, query); + QueryKitUtils.makeSegmentGranularityVirtualColumn(jsonMapper, query.context()); if (segmentGranularityVirtualColumn != null) { frameWriterVirtualColumns.add(segmentGranularityVirtualColumn);