kgyrtkirk commented on code in PR #17895: URL: https://github.com/apache/druid/pull/17895#discussion_r2068610653
########## extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/indexing/LegacyMSQSpec.java: ########## @@ -0,0 +1,208 @@ +/* + * 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.indexing; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.base.Preconditions; +import org.apache.druid.msq.indexing.destination.MSQDestination; +import org.apache.druid.msq.indexing.destination.TaskReportMSQDestination; +import org.apache.druid.msq.kernel.QueryDefinition; +import org.apache.druid.msq.kernel.WorkerAssignmentStrategy; +import org.apache.druid.query.BaseQuery; +import org.apache.druid.query.Query; +import org.apache.druid.query.QueryContext; +import org.apache.druid.sql.calcite.planner.ColumnMappings; + +import java.util.Map; +import java.util.Objects; + +/** + * Old MSQSpec with a native query in it. + * + * Usage of this class should be avoided in favor of {@link MSQSpec}. + */ +public class LegacyMSQSpec extends MSQSpec Review Comment: This layout tries to limit the access to the `Query` object; all existing methods should still only access `MSQSpec`. This way any attempt to access the `Query` at a new place will need a cast and and a `getQuery` call ; which will stand out more likely on a PR rather than just a `getQuery` call which may do something (null or exception) in case of decoupled mode...which the PR owner will most likely not address or test. The `LegacyMSQSpec` class also provides an easy way to look up all the places where the original `Query` object is really needed. There is one more future plan: move more things to the `LegacyMSQSpec` class as those could be serviced by `QueryDefinition` -- 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]
