Copilot commented on code in PR #17810:
URL: https://github.com/apache/iotdb/pull/17810#discussion_r3355590634
##########
iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/queryengine/plan/relational/sql/ast/Fill.java:
##########
@@ -66,11 +66,24 @@ public Fill(
TimeDuration timeBound,
LongLiteral timeColumnIndex,
List<LongLiteral> fillGroupingElements) {
+ this(location, FillPolicy.PREVIOUS, timeBound, timeColumnIndex,
fillGroupingElements);
+ }
+
+ // used for previous fill or next fill
+ public Fill(
+ NodeLocation location,
+ FillPolicy fillMethod,
+ TimeDuration timeBound,
+ LongLiteral timeColumnIndex,
+ List<LongLiteral> fillGroupingElements) {
super(requireNonNull(location, "location is null"));
+ if (fillMethod != FillPolicy.PREVIOUS && fillMethod != FillPolicy.NEXT) {
+ throw new IllegalArgumentException("Unsupported fill method: " +
fillMethod);
+ }
Review Comment:
The new constructor overload accepts a `FillPolicy fillMethod` but does not
null-check it. If a caller ever passes `null`, this will throw a
`NullPointerException` at the comparison instead of a clear argument error.
Adding an explicit `requireNonNull(fillMethod, ...)` keeps failure mode
consistent with the existing `location` check and produces a clearer message.
##########
iotdb-core/calc-commons/src/main/java/org/apache/iotdb/calc/execution/operator/process/TableNextFillWithGroupOperator.java:
##########
@@ -0,0 +1,175 @@
+/*
+ * 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.calc.execution.operator.process;
+
+import org.apache.iotdb.calc.execution.operator.CommonOperatorContext;
+import org.apache.iotdb.calc.execution.operator.Operator;
+import org.apache.iotdb.calc.execution.operator.process.fill.ILinearFill;
+import org.apache.iotdb.calc.plan.planner.CommonOperatorUtils;
+import org.apache.iotdb.calc.utils.datastructure.SortKey;
+
+import org.apache.tsfile.block.column.Column;
+import org.apache.tsfile.block.column.ColumnBuilder;
+import org.apache.tsfile.enums.TSDataType;
+import org.apache.tsfile.read.common.block.TsBlock;
+import org.apache.tsfile.read.common.block.TsBlockBuilder;
+import org.apache.tsfile.read.common.block.column.RunLengthEncodedColumn;
+
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.List;
+
+public class TableNextFillWithGroupOperator extends TableNextFillOperator {
+
+ private final List<Boolean> groupSplitter;
+
+ private final List<Boolean> noMoreTsBlockForCurrentGroup;
+
+ private final Comparator<SortKey> groupKeyComparator;
Review Comment:
`groupSplitter` is populated in `updateCachedData()` but its values are
never used (only `remove(0)` is called in `resetFill()`). This adds per-group
bookkeeping overhead and makes the grouped NEXT-fill state machine harder to
reason about. Consider either removing `groupSplitter` entirely, or using it to
drive behavior (as in `TableLinearFillWithGroupOperator`) with a clear comment
explaining why NEXT differs.
--
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]