xiangfu0 commented on code in PR #19601:
URL: https://github.com/apache/pinot/pull/19601#discussion_r4065235750


##########
pinot-query-runtime/src/test/java/org/apache/pinot/query/runtime/operator/MultistageGroupByExecutorTest.java:
##########
@@ -0,0 +1,130 @@
+/**
+ * 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;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.apache.pinot.common.request.context.ExpressionContext;
+import org.apache.pinot.common.utils.DataSchema;
+import org.apache.pinot.common.utils.DataSchema.ColumnDataType;
+import org.apache.pinot.core.query.aggregation.function.AggregationFunction;
+import 
org.apache.pinot.core.query.aggregation.function.CountAggregationFunction;
+import org.apache.pinot.query.planner.plannode.AggregateNode.AggType;
+import org.apache.pinot.query.runtime.blocks.MseBlock;
+import 
org.apache.pinot.spi.utils.CommonConstants.Broker.Request.QueryOptionKey;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNull;
+import static org.testng.Assert.assertTrue;
+
+
+/// Exercises serialized composite keys and merge state across blocks. Each 
test owns its executor and input blocks.
+public class MultistageGroupByExecutorTest {
+  private static final DataSchema INPUT_SCHEMA = new DataSchema(new 
String[]{"weight", "count", "tv", "tag"},
+      new ColumnDataType[]{ColumnDataType.DOUBLE, ColumnDataType.LONG, 
ColumnDataType.INT, ColumnDataType.STRING});
+
+  @DataProvider
+  public Object[][] mergeModes() {
+    return new Object[][]{{2, false}, {2, true}, {3, false}, {3, true}};
+  }
+
+  @Test(dataProvider = "mergeModes")
+  public void testSerializedKeysAcrossBlocks(int numKeys, boolean 
leafReturnFinalResult) {

Review Comment:
   Added testFilteredSerializedKeysAcrossBlocks with nonnegative 
filterArgIds/maxFilterArgId and AggType.DIRECT. It exercises the changed 
serialized filtered path for both two- and three-column generators, sparse 
matching rows, null keys, repeated groups across blocks, and both values of 
filteredAggregationsSkipEmptyGroups.
   
   Updated in `1a76016e09`; the combined current-source run passed all 190 
selected tests.



##########
pinot-core/src/test/java/org/apache/pinot/core/query/aggregation/groupby/utils/NumericToIdMapTest.java:
##########
@@ -0,0 +1,76 @@
+/**
+ * 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.core.query.aggregation.groupby.utils;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import static org.testng.Assert.assertEquals;
+
+
+/// Verifies numeric key identity and contiguous IDs across insertion, 
repetition, and map growth.
+public class NumericToIdMapTest {
+  @DataProvider(name = "numericMaps")
+  public Object[][] numericMaps() {
+    return new Object[][]{
+        {new IntToIdMap(), new Object[]{Integer.MIN_VALUE, -1, 0, 1, 
Integer.MAX_VALUE}},
+        {new LongToIdMap(), new Object[]{Long.MIN_VALUE, -1L, 0L, 1L, 
Long.MAX_VALUE, 9007199254740993L}},
+        {new FloatToIdMap(), new Object[]{Float.NEGATIVE_INFINITY, 
-Float.MAX_VALUE, -0.0f, 0.0f, Float.MIN_VALUE,
+            Float.MAX_VALUE, Float.POSITIVE_INFINITY, Float.NaN}},
+        {new DoubleToIdMap(), new Object[]{Double.NEGATIVE_INFINITY, 
-Double.MAX_VALUE, -0.0d, 0.0d, Double.MIN_VALUE,
+            Double.MAX_VALUE, Double.POSITIVE_INFINITY, Double.NaN}},
+        {new FloatToIdMap(), new Object[]{Float.intBitsToFloat(0x7fc00001)}},

Review Comment:
   Canonical and noncanonical NaNs now coexist in each float/double map case. 
The current fastutil 8.5.19 maps compare raw bits, so the test asserts distinct 
IDs, repeat-put stability, and getId(get(id)) round trips before and after 
growth. This also keeps signed-zero behavior explicit without relying on boxed 
Java NaN equality.
   
   Updated in `1a76016e09`; the combined current-source run passed all 190 
selected tests.



##########
pinot-core/src/test/java/org/apache/pinot/core/query/aggregation/groupby/utils/NumericToIdMapTest.java:
##########
@@ -0,0 +1,76 @@
+/**
+ * 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.core.query.aggregation.groupby.utils;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import static org.testng.Assert.assertEquals;
+
+
+/// Verifies numeric key identity and contiguous IDs across insertion, 
repetition, and map growth.
+public class NumericToIdMapTest {
+  @DataProvider(name = "numericMaps")
+  public Object[][] numericMaps() {
+    return new Object[][]{
+        {new IntToIdMap(), new Object[]{Integer.MIN_VALUE, -1, 0, 1, 
Integer.MAX_VALUE}},
+        {new LongToIdMap(), new Object[]{Long.MIN_VALUE, -1L, 0L, 1L, 
Long.MAX_VALUE, 9007199254740993L}},
+        {new FloatToIdMap(), new Object[]{Float.NEGATIVE_INFINITY, 
-Float.MAX_VALUE, -0.0f, 0.0f, Float.MIN_VALUE,
+            Float.MAX_VALUE, Float.POSITIVE_INFINITY, Float.NaN}},
+        {new DoubleToIdMap(), new Object[]{Double.NEGATIVE_INFINITY, 
-Double.MAX_VALUE, -0.0d, 0.0d, Double.MIN_VALUE,
+            Double.MAX_VALUE, Double.POSITIVE_INFINITY, Double.NaN}},
+        {new FloatToIdMap(), new Object[]{Float.intBitsToFloat(0x7fc00001)}},
+        {new DoubleToIdMap(), new 
Object[]{Double.longBitsToDouble(0x7ff8000000000001L)}}
+    };
+  }
+
+  @Test(dataProvider = "numericMaps")
+  public void testNumericKeys(ValueToIdMap map, Object[] values) {

Review Comment:
   Renamed the test to ValueToIdMapTest and added factory-backed STRING, BYTES 
and BIG_DECIMAL cases, including null object keys and distinct decimal scales. 
All cases share the contiguous/stable/round-trip/growth checks. The provider 
now supplies an IntFunction value factory, replacing the instanceof chain; 
equal object growth keys are regenerated after rehash.
   
   Updated in `1a76016e09`; the combined current-source run passed all 190 
selected tests.



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