Copilot commented on code in PR #17353:
URL: https://github.com/apache/pinot/pull/17353#discussion_r2612388899


##########
pinot-query-runtime/src/main/java/org/apache/pinot/query/runtime/operator/factory/DefaultJoinOperatorFactory.java:
##########
@@ -0,0 +1,81 @@
+/**
+ * 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.pinot.query.runtime.operator.factory;
+
+import org.apache.pinot.common.utils.DataSchema;
+import org.apache.pinot.query.planner.plannode.EnrichedJoinNode;
+import org.apache.pinot.query.planner.plannode.JoinNode;
+import org.apache.pinot.query.planner.plannode.PlanNode;
+import org.apache.pinot.query.runtime.operator.AsofJoinOperator;
+import org.apache.pinot.query.runtime.operator.EnrichedHashJoinOperator;
+import org.apache.pinot.query.runtime.operator.HashJoinOperator;
+import org.apache.pinot.query.runtime.operator.LookupJoinOperator;
+import org.apache.pinot.query.runtime.operator.MultiStageOperator;
+import org.apache.pinot.query.runtime.operator.NonEquiJoinOperator;
+import org.apache.pinot.query.runtime.plan.OpChainExecutionContext;
+
+
+/**
+ * Default implementation that constructs the built-in join operators.
+ */
+public class DefaultJoinOperatorFactory implements JoinOperatorFactory {
+  @Override
+  public MultiStageOperator createJoinOperator(OpChainExecutionContext 
context, MultiStageOperator leftOperator,
+      PlanNode leftPlanNode, MultiStageOperator rightOperator, PlanNode 
rightPlanNode, JoinNode joinNode) {
+    JoinNode.JoinStrategy joinStrategy = joinNode.getJoinStrategy();
+    DataSchema leftSchema = leftPlanNode.getDataSchema();
+    switch (joinStrategy) {
+      case HASH:
+        if (joinNode.getLeftKeys().isEmpty()) {
+          // TODO: Consider adding non-equi as a separate join strategy.

Review Comment:
   The TODO comment was moved from PlanNodeToOpChain without addressing it. 
Since this is new code in a factory that could be extended, either implement 
the suggestion or document why it's deferred. For example: 'TODO: Consider 
adding non-equi as a separate join strategy (tracked in ISSUE-XXX)' or remove 
if not actionable.
   ```suggestion
             // Non-equi joins are currently handled here; consider adding a 
separate join strategy for non-equi joins (see ISSUE-1234).
   ```



##########
pinot-query-runtime/src/main/java/org/apache/pinot/query/runtime/context/ServerContext.java:
##########
@@ -0,0 +1,50 @@
+/**
+ * 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.pinot.query.runtime.context;
+
+import java.util.Objects;
+import 
org.apache.pinot.query.runtime.operator.factory.DefaultQueryOperatorFactoryProvider;
+import 
org.apache.pinot.query.runtime.operator.factory.QueryOperatorFactoryProvider;
+
+
+/**
+ * Singleton context for server-scoped objects used by the multi-stage engine.
+ */
+public class ServerContext {
+  private static final ServerContext INSTANCE = new ServerContext();
+
+  private volatile QueryOperatorFactoryProvider _queryOperatorFactoryProvider =
+      DefaultQueryOperatorFactoryProvider.INSTANCE;

Review Comment:
   The volatile field initialization to the default instance may cause 
confusion. Consider initializing to null and handling the null case in the 
getter, or documenting that the field is always non-null and will be overridden 
during startup. The current pattern suggests the field could be read before 
setQueryOperatorFactoryProvider is called, which may not be the intended usage 
pattern.



##########
pinot-query-runtime/src/main/java/org/apache/pinot/query/runtime/context/BrokerContext.java:
##########
@@ -0,0 +1,50 @@
+/**
+ * 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.pinot.query.runtime.context;
+
+import java.util.Objects;
+import 
org.apache.pinot.query.runtime.operator.factory.DefaultQueryOperatorFactoryProvider;
+import 
org.apache.pinot.query.runtime.operator.factory.QueryOperatorFactoryProvider;
+
+
+/**
+ * Singleton context for broker-scoped objects used by the multi-stage engine.
+ */
+public class BrokerContext {
+  private static final BrokerContext INSTANCE = new BrokerContext();
+
+  private volatile QueryOperatorFactoryProvider _queryOperatorFactoryProvider =
+      DefaultQueryOperatorFactoryProvider.INSTANCE;

Review Comment:
   The volatile field initialization to the default instance may cause 
confusion. Consider initializing to null and handling the null case in the 
getter, or documenting that the field is always non-null and will be overridden 
during startup. The current pattern suggests the field could be read before 
setQueryOperatorFactoryProvider is called, which may not be the intended usage 
pattern.



-- 
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]

Reply via email to