jt2594838 commented on code in PR #18606:
URL: https://github.com/apache/iotdb/pull/18606#discussion_r4023237185
##########
iotdb-core/calc-commons/src/main/java/org/apache/iotdb/calc/execution/operator/source/relational/aggregation/grouped/GroupedVarianceAccumulator.java:
##########
@@ -52,6 +55,10 @@ public class GroupedVarianceAccumulator implements
GroupedAccumulator {
public GroupedVarianceAccumulator(
TSDataType seriesDataType, VarianceAccumulator.VarianceType
varianceType) {
this.seriesDataType = seriesDataType;
+ this.doubleValueConverter =
+ TypeServices.NUMERIC_BATCH_READER_SERVICE
Review Comment:
Use the native numeric batch reader for grouped variance, retaining the
existing recurrence callback and logical row order rather than changing the
numerical algorithm. NumericMomentBatchTest covers moments/variance across
tree, table and grouped implementations, including masked/null inputs. This
candidate was retained after mixed-type and fixed-DOUBLE measurements; related
candidates with measured regressions were restored.
##########
iotdb-core/calc-commons/src/main/java/org/apache/iotdb/calc/execution/operator/source/relational/aggregation/TableCentralMomentAccumulator.java:
##########
@@ -51,47 +54,21 @@ public class TableCentralMomentAccumulator implements
TableAccumulator {
public TableCentralMomentAccumulator(
TSDataType seriesDataType, CentralMomentAccumulator.MomentType
momentType) {
this.seriesDataType = seriesDataType;
+ this.doubleValueConverter =
+ TypeServices.NUMERIC_BATCH_READER_SERVICE
Review Comment:
Use the native numeric batch reader for table central moment, retaining the
existing recurrence callback and logical row order rather than changing the
numerical algorithm. NumericMomentBatchTest covers moments/variance across
tree, table and grouped implementations, including masked/null inputs. This
candidate was retained after mixed-type and fixed-DOUBLE measurements; related
candidates with measured regressions were restored.
##########
iotdb-core/calc-commons/src/main/java/org/apache/iotdb/calc/execution/operator/source/relational/aggregation/grouped/rate/GroupedNaiveDeltaAccumulator.java:
##########
@@ -59,31 +61,28 @@ public void setGroupCount(long groupCount) {
@Override
public void addInput(int[] groupIds, Column[] arguments, AggregationMask
mask) {
RateFunctionValidation.validateArgumentCount(arguments,
RateFunctionType.DELTA);
- int selectedCount = mask.getSelectedPositionCount();
- int[] selectedPositions = mask.isSelectAll() ? null :
mask.getSelectedPositions();
- for (int index = 0; index < selectedCount; index++) {
- int position = mask.isSelectAll() ? index : selectedPositions[index];
- if (arguments[0].isNull(position)) {
- continue;
- }
- int groupId = groupIds[position];
- double value =
- RateFunctionValidation.readValue(
- arguments[0], position, valueDataType, RateFunctionType.DELTA);
- long time =
- RateFunctionValidation.readRequiredTime(
- arguments[1], position, RateFunctionType.DELTA, 2);
- long currentWindowStart =
- RateFunctionValidation.readRequiredTime(
- arguments[2], position, RateFunctionType.DELTA, 3);
- long currentWindowEnd =
- RateFunctionValidation.readRequiredTime(
- arguments[3], position, RateFunctionType.DELTA, 4);
- RateFunctionValidation.validateWindow(
- RateFunctionType.DELTA, time, currentWindowStart, currentWindowEnd);
- initializeOrValidateWindow(groupId, currentWindowStart,
currentWindowEnd);
- samples.add(groupId, time, value);
- }
+ TypeServices.RATE_INPUT_SERVICE
Review Comment:
GroupedNaiveDeltaAccumulator now dispatches to a native batch reader through
RATE_INPUT_SERVICE. It preserves value validation before time/window validation
and keeps the existing state update callback, including logical group positions
where applicable. RateBatchInputTest exercises all 16 implementations with
native and wrapped columns, masks/nulls and validation cases. This is one of
the 12 retained rate candidates; the other four were restored after
fixed-DOUBLE benchmarks showed regressions.
##########
iotdb-core/calc-commons/src/main/java/org/apache/iotdb/calc/execution/operator/source/relational/aggregation/grouped/rate/GroupedNaiveIncreaseAccumulator.java:
##########
@@ -59,31 +61,28 @@ public void setGroupCount(long groupCount) {
@Override
public void addInput(int[] groupIds, Column[] arguments, AggregationMask
mask) {
RateFunctionValidation.validateArgumentCount(arguments,
RateFunctionType.INCREASE);
- int selectedCount = mask.getSelectedPositionCount();
- int[] selectedPositions = mask.isSelectAll() ? null :
mask.getSelectedPositions();
- for (int index = 0; index < selectedCount; index++) {
- int position = mask.isSelectAll() ? index : selectedPositions[index];
- if (arguments[0].isNull(position)) {
- continue;
- }
- int groupId = groupIds[position];
- double value =
- RateFunctionValidation.readValue(
- arguments[0], position, valueDataType,
RateFunctionType.INCREASE);
- long time =
- RateFunctionValidation.readRequiredTime(
- arguments[1], position, RateFunctionType.INCREASE, 2);
- long currentWindowStart =
- RateFunctionValidation.readRequiredTime(
- arguments[2], position, RateFunctionType.INCREASE, 3);
- long currentWindowEnd =
- RateFunctionValidation.readRequiredTime(
- arguments[3], position, RateFunctionType.INCREASE, 4);
- RateFunctionValidation.validateWindow(
- RateFunctionType.INCREASE, time, currentWindowStart,
currentWindowEnd);
- initializeOrValidateWindow(groupId, currentWindowStart,
currentWindowEnd);
- samples.add(groupId, time, value);
- }
+ TypeServices.RATE_INPUT_SERVICE
Review Comment:
GroupedNaiveIncreaseAccumulator now dispatches to a native batch reader
through RATE_INPUT_SERVICE. It preserves value validation before time/window
validation and keeps the existing state update callback, including logical
group positions where applicable. RateBatchInputTest exercises all 16
implementations with native and wrapped columns, masks/nulls and validation
cases. This is one of the 12 retained rate candidates; the other four were
restored after fixed-DOUBLE benchmarks showed regressions.
##########
iotdb-core/calc-commons/src/main/java/org/apache/iotdb/calc/execution/operator/source/relational/aggregation/grouped/rate/GroupedNaiveIrateAccumulator.java:
##########
@@ -58,22 +60,19 @@ public void setGroupCount(long groupCount) {
@Override
public void addInput(int[] groupIds, Column[] arguments, AggregationMask
mask) {
RateFunctionValidation.validateArgumentCount(arguments,
RateFunctionType.IRATE);
- int selectedCount = mask.getSelectedPositionCount();
- int[] selectedPositions = mask.isSelectAll() ? null :
mask.getSelectedPositions();
- for (int index = 0; index < selectedCount; index++) {
- int position = mask.isSelectAll() ? index : selectedPositions[index];
- if (arguments[0].isNull(position)) {
- continue;
- }
- int groupId = groupIds[position];
- double value =
- RateFunctionValidation.readValue(
- arguments[0], position, valueDataType, RateFunctionType.IRATE);
- long time =
- RateFunctionValidation.readRequiredTime(
- arguments[1], position, RateFunctionType.IRATE, 2);
- samples.add(groupId, time, value);
- }
+ TypeServices.RATE_INPUT_SERVICE
Review Comment:
GroupedNaiveIrateAccumulator now dispatches to a native batch reader through
RATE_INPUT_SERVICE. It preserves value validation before time/window validation
and keeps the existing state update callback, including logical group positions
where applicable. RateBatchInputTest exercises all 16 implementations with
native and wrapped columns, masks/nulls and validation cases. This is one of
the 12 retained rate candidates; the other four were restored after
fixed-DOUBLE benchmarks showed regressions.
##########
iotdb-core/calc-commons/src/main/java/org/apache/iotdb/calc/execution/operator/source/relational/aggregation/grouped/rate/GroupedNaiveRateAccumulator.java:
##########
@@ -59,28 +61,28 @@ public void setGroupCount(long groupCount) {
@Override
public void addInput(int[] groupIds, Column[] arguments, AggregationMask
mask) {
RateFunctionValidation.validateArgumentCount(arguments,
RateFunctionType.RATE);
- int selectedCount = mask.getSelectedPositionCount();
- int[] selectedPositions = mask.isSelectAll() ? null :
mask.getSelectedPositions();
- for (int index = 0; index < selectedCount; index++) {
- int position = mask.isSelectAll() ? index : selectedPositions[index];
- if (arguments[0].isNull(position)) {
- continue;
- }
- int groupId = groupIds[position];
- double value =
- RateFunctionValidation.readValue(
- arguments[0], position, valueDataType, RateFunctionType.RATE);
- long time =
- RateFunctionValidation.readRequiredTime(arguments[1], position,
RateFunctionType.RATE, 2);
- long currentWindowStart =
- RateFunctionValidation.readRequiredTime(arguments[2], position,
RateFunctionType.RATE, 3);
- long currentWindowEnd =
- RateFunctionValidation.readRequiredTime(arguments[3], position,
RateFunctionType.RATE, 4);
- RateFunctionValidation.validateWindow(
- RateFunctionType.RATE, time, currentWindowStart, currentWindowEnd);
- initializeOrValidateWindow(groupId, currentWindowStart,
currentWindowEnd);
- samples.add(groupId, time, value);
- }
+ TypeServices.RATE_INPUT_SERVICE
Review Comment:
GroupedNaiveRateAccumulator now dispatches to a native batch reader through
RATE_INPUT_SERVICE. It preserves value validation before time/window validation
and keeps the existing state update callback, including logical group positions
where applicable. RateBatchInputTest exercises all 16 implementations with
native and wrapped columns, masks/nulls and validation cases. This is one of
the 12 retained rate candidates; the other four were restored after
fixed-DOUBLE benchmarks showed regressions.
##########
iotdb-core/calc-commons/src/main/java/org/apache/iotdb/calc/execution/operator/source/relational/aggregation/grouped/rate/GroupedOrderedIrateAccumulator.java:
##########
@@ -68,22 +70,19 @@ public void setGroupCount(long groupCount) {
@Override
public void addInput(int[] groupIds, Column[] arguments, AggregationMask
mask) {
RateFunctionValidation.validateArgumentCount(arguments,
RateFunctionType.IRATE);
- int selectedCount = mask.getSelectedPositionCount();
- int[] selectedPositions = mask.isSelectAll() ? null :
mask.getSelectedPositions();
- for (int index = 0; index < selectedCount; index++) {
- int position = mask.isSelectAll() ? index : selectedPositions[index];
- if (arguments[0].isNull(position)) {
- continue;
- }
- int groupId = groupIds[position];
- double value =
- RateFunctionValidation.readValue(
- arguments[0], position, valueDataType, RateFunctionType.IRATE);
- long time =
- RateFunctionValidation.readRequiredTime(
- arguments[1], position, RateFunctionType.IRATE, 2);
- update(groupId, time, value);
- }
+ TypeServices.RATE_INPUT_SERVICE
Review Comment:
GroupedOrderedIrateAccumulator now dispatches to a native batch reader
through RATE_INPUT_SERVICE. It preserves value validation before time/window
validation and keeps the existing state update callback, including logical
group positions where applicable. RateBatchInputTest exercises all 16
implementations with native and wrapped columns, masks/nulls and validation
cases. This is one of the 12 retained rate candidates; the other four were
restored after fixed-DOUBLE benchmarks showed regressions.
##########
iotdb-core/calc-commons/src/main/java/org/apache/iotdb/calc/execution/operator/source/relational/aggregation/rate/NaiveDeltaAccumulator.java:
##########
@@ -58,30 +60,27 @@ public TableAccumulator copy() {
@Override
public void addInput(Column[] arguments, AggregationMask mask) {
RateFunctionValidation.validateArgumentCount(arguments,
RateFunctionType.DELTA);
- int selectedCount = mask.getSelectedPositionCount();
- int[] selectedPositions = mask.isSelectAll() ? null :
mask.getSelectedPositions();
- for (int index = 0; index < selectedCount; index++) {
- int position = mask.isSelectAll() ? index : selectedPositions[index];
- if (arguments[0].isNull(position)) {
- continue;
- }
- double value =
- RateFunctionValidation.readValue(
- arguments[0], position, valueDataType, RateFunctionType.DELTA);
- long time =
- RateFunctionValidation.readRequiredTime(
- arguments[1], position, RateFunctionType.DELTA, 2);
- long currentWindowStart =
- RateFunctionValidation.readRequiredTime(
- arguments[2], position, RateFunctionType.DELTA, 3);
- long currentWindowEnd =
- RateFunctionValidation.readRequiredTime(
- arguments[3], position, RateFunctionType.DELTA, 4);
- RateFunctionValidation.validateWindow(
- RateFunctionType.DELTA, time, currentWindowStart, currentWindowEnd);
- initializeOrValidateWindow(currentWindowStart, currentWindowEnd);
- samples.add(time, value);
- }
+ TypeServices.RATE_INPUT_SERVICE
Review Comment:
NaiveDeltaAccumulator now dispatches to a native batch reader through
RATE_INPUT_SERVICE. It preserves value validation before time/window validation
and keeps the existing state update callback, including logical group positions
where applicable. RateBatchInputTest exercises all 16 implementations with
native and wrapped columns, masks/nulls and validation cases. This is one of
the 12 retained rate candidates; the other four were restored after
fixed-DOUBLE benchmarks showed regressions.
--
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]