Copilot commented on code in PR #16760:
URL: https://github.com/apache/iotdb/pull/16760#discussion_r2567869591


##########
iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/relational/analyzer/TestMetadata.java:
##########
@@ -262,7 +263,14 @@ public Type getOperatorReturnType(
         if (argumentTypes.get(0).equals(TIMESTAMP) || 
argumentTypes.get(1).equals(TIMESTAMP)) {
           return TIMESTAMP;
         }
-        return DOUBLE;
+        Optional<Type> resolvedType = 
SubtractionResolver.checkConditions(argumentTypes);
+        return resolvedType.orElseThrow(
+            () ->
+                new OperatorNotFoundException(
+                    operatorType,
+                    argumentTypes,
+                    new IllegalArgumentException(
+                        "The combination of argument types is not supported 
for this operator.")));

Review Comment:
   SubtractionResolver.checkConditions is being applied to all arithmetic 
operators (ADD, SUBTRACT, MULTIPLY, DIVIDE, MODULUS), but SubtractionResolver 
is specifically designed for subtraction operations. This could lead to 
incorrect type resolution for other arithmetic operators. Each operator type 
should use its appropriate resolver, or the logic should be conditional based 
on the operatorType.



##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/node/ExceptNode.java:
##########
@@ -0,0 +1,98 @@
+/*
+ * 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.iotdb.db.queryengine.plan.relational.planner.node;
+
+import org.apache.iotdb.db.queryengine.plan.planner.plan.node.PlanNode;
+import org.apache.iotdb.db.queryengine.plan.planner.plan.node.PlanNodeId;
+import org.apache.iotdb.db.queryengine.plan.planner.plan.node.PlanVisitor;
+import org.apache.iotdb.db.queryengine.plan.relational.planner.Symbol;
+
+import com.google.common.collect.ListMultimap;
+
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.util.List;
+
+public class ExceptNode extends SetOperationNode {
+
+  private final boolean distinct;
+
+  public ExceptNode(
+      PlanNodeId id,
+      List<PlanNode> children,
+      ListMultimap<Symbol, Symbol> outputToInputs,
+      List<Symbol> outputs,
+      boolean distinct) {
+
+    super(id, children, outputToInputs, outputs);
+    this.distinct = distinct;
+  }
+
+  private ExceptNode(
+      PlanNodeId id,
+      ListMultimap<Symbol, Symbol> outputToInputs,
+      List<Symbol> outputs,
+      boolean distinct) {
+    super(id, outputToInputs, outputs);
+    this.distinct = distinct;
+  }
+
+  @Override
+  public <R, C> R accept(PlanVisitor<R, C> visitor, C context) {
+    return visitor.visitExcept(this, context);
+  }
+
+  public boolean isDistinct() {
+    return distinct;
+  }
+
+  @Override
+  public PlanNode clone() {
+    return new ExceptNode(getPlanNodeId(), getSymbolMapping(), 
getOutputSymbols(), distinct);
+  }
+
+  @Override
+  public List<String> getOutputColumnNames() {
+    throw new UnsupportedOperationException();
+  }
+
+  @Override
+  protected void serializeAttributes(ByteBuffer byteBuffer) {
+    throw new UnsupportedOperationException(
+        "ExceptNode should never be serialized in current version");
+  }
+
+  @Override
+  protected void serializeAttributes(DataOutputStream stream) throws 
IOException {
+    throw new UnsupportedOperationException(
+        "ExceptNode should never be serialized in current version");
+  }
+
+  public static ExceptNode deserialize(ByteBuffer byteBuffer) {
+    throw new UnsupportedOperationException(
+        "ExceptNode should never be deserialized in current version");
+  }
+

Review Comment:
   This method overrides [PlanNode.replaceChildren](1); it is advisable to add 
an Override annotation.
   ```suggestion
   
     @Override
   ```



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

Reply via email to