Skip to content

Commit

Permalink
fix MapBigArray
Browse files Browse the repository at this point in the history
Signed-off-by: Weihao Li <18110526956@163.com>
  • Loading branch information
Wei-hao-Li committed Oct 25, 2024
1 parent 825cc71 commit f7ea188
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@
import org.apache.iotdb.db.queryengine.execution.operator.source.relational.aggregation.grouped.GroupedMaxByAccumulator;
import org.apache.iotdb.db.queryengine.execution.operator.source.relational.aggregation.grouped.GroupedMinAccumulator;
import org.apache.iotdb.db.queryengine.execution.operator.source.relational.aggregation.grouped.GroupedMinByAccumulator;
import org.apache.iotdb.db.queryengine.execution.operator.source.relational.aggregation.grouped.GroupedModeAccumulator;
import org.apache.iotdb.db.queryengine.execution.operator.source.relational.aggregation.grouped.GroupedSumAccumulator;
import org.apache.iotdb.db.queryengine.execution.operator.source.relational.aggregation.grouped.GroupedVarianceAccumulator;
import org.apache.iotdb.db.queryengine.plan.relational.sql.ast.Expression;
import org.apache.iotdb.db.queryengine.plan.relational.sql.ast.SymbolReference;

Expand Down Expand Up @@ -135,6 +137,22 @@ private static GroupedAccumulator createBuiltinGroupedAccumulator(
return new GroupedMaxByAccumulator(inputDataTypes.get(0), inputDataTypes.get(1));
case MIN_BY:
return new GroupedMinByAccumulator(inputDataTypes.get(0), inputDataTypes.get(1));
case MODE:
return new GroupedModeAccumulator(inputDataTypes.get(0));
case STDDEV:
case STDDEV_SAMP:
return new GroupedVarianceAccumulator(
inputDataTypes.get(0), VarianceAccumulator.VarianceType.STDDEV_SAMP);
case STDDEV_POP:
return new GroupedVarianceAccumulator(
inputDataTypes.get(0), VarianceAccumulator.VarianceType.STDDEV_POP);
case VARIANCE:
case VAR_SAMP:
return new GroupedVarianceAccumulator(
inputDataTypes.get(0), VarianceAccumulator.VarianceType.VAR_SAMP);
case VAR_POP:
return new GroupedVarianceAccumulator(
inputDataTypes.get(0), VarianceAccumulator.VarianceType.VAR_POP);
default:
throw new IllegalArgumentException("Invalid Aggregation function: " + aggregationType);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,12 @@ public long sizeOf() {
* @return the element of this big array at the specified position.
*/
public HashMap<TsPrimitiveType, Long> get(long index) {
return array.get(index);
HashMap<TsPrimitiveType, Long> result = array.get(index);
if (result == null) {
result = new HashMap<>();
array.set(index, result);
}
return result;
}

/**
Expand All @@ -54,6 +59,9 @@ public HashMap<TsPrimitiveType, Long> get(long index) {
* @param index a position in this big array.
*/
public void set(long index, HashMap<TsPrimitiveType, Long> value) {
if (value == null) {
this.set(index, new HashMap<>());
}
updateRetainedSize(index, value);
array.set(index, value);
}
Expand Down

0 comments on commit f7ea188

Please sign in to comment.