This is an automated email from the ASF dual-hosted git repository.
jackie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pinot.git
The following commit(s) were added to refs/heads/master by this push:
new c811167b9ae Fix MSE registration for MIN_STRING, MAX_STRING, SUM_INT
(#16972)
c811167b9ae is described below
commit c811167b9aedf7b5fed44f8aa026a40201102419
Author: Xiaotian (Jackie) Jiang <[email protected]>
AuthorDate: Wed Oct 8 14:48:51 2025 -0700
Fix MSE registration for MIN_STRING, MAX_STRING, SUM_INT (#16972)
---
.../tests/OfflineClusterIntegrationTest.java | 37 ++++++++++++++++++++++
.../pinot/segment/spi/AggregationFunctionType.java | 6 ++--
2 files changed, 40 insertions(+), 3 deletions(-)
diff --git
a/pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/OfflineClusterIntegrationTest.java
b/pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/OfflineClusterIntegrationTest.java
index 25c09423795..36e63a81344 100644
---
a/pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/OfflineClusterIntegrationTest.java
+++
b/pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/OfflineClusterIntegrationTest.java
@@ -3942,6 +3942,43 @@ public class OfflineClusterIntegrationTest extends
BaseClusterIntegrationTestSet
assertEquals(columnDataTypes.get(0).asText(), "DOUBLE");
}
+ @Test(dataProvider = "useBothQueryEngines")
+ public void testMinMaxString(boolean useMultiStageQueryEngine)
+ throws Exception {
+ setUseMultiStageQueryEngine(useMultiStageQueryEngine);
+
+ String sqlQuery = "SELECT MIN_STRING(DestCityName),
MAX_STRING(DestCityName) FROM mytable";
+ JsonNode response = postQuery(sqlQuery);
+ assertTrue(response.get("exceptions").isEmpty());
+ JsonNode resultTable = response.get("resultTable");
+ JsonNode columnDataTypes =
resultTable.get("dataSchema").get("columnDataTypes");
+ assertEquals(columnDataTypes.size(), 2);
+ assertEquals(columnDataTypes.get(0).asText(), "STRING");
+ assertEquals(columnDataTypes.get(1).asText(), "STRING");
+ JsonNode row = resultTable.get("rows").get(0);
+ assertEquals(row.size(), 2);
+ assertEquals(row.get(0).asText(), "Aberdeen, SD");
+ assertEquals(row.get(1).asText(), "Yuma, AZ");
+ }
+
+ @Test(dataProvider = "useBothQueryEngines")
+ public void testSumInt(boolean useMultiStageQueryEngine)
+ throws Exception {
+ setUseMultiStageQueryEngine(useMultiStageQueryEngine);
+
+ String sqlQuery = "SELECT SUM_INT(ArrTime), SUM(ArrTime) FROM mytable";
+ JsonNode response = postQuery(sqlQuery);
+ assertTrue(response.get("exceptions").isEmpty());
+ JsonNode resultTable = response.get("resultTable");
+ JsonNode columnDataTypes =
resultTable.get("dataSchema").get("columnDataTypes");
+ assertEquals(columnDataTypes.size(), 2);
+ assertEquals(columnDataTypes.get(0).asText(), "LONG");
+ JsonNode row = resultTable.get("rows").get(0);
+ assertEquals(row.size(), 2);
+ assertTrue(row.get(0).isLong());
+ assertEquals(row.get(0).asLong(), row.get(1).asLong());
+ }
+
@Test(dataProvider = "useBothQueryEngines")
public void testFilteredAggregationWithGroupByOrdering(boolean
useMultiStageQueryEngine)
throws Exception {
diff --git
a/pinot-segment-spi/src/main/java/org/apache/pinot/segment/spi/AggregationFunctionType.java
b/pinot-segment-spi/src/main/java/org/apache/pinot/segment/spi/AggregationFunctionType.java
index 77ff621db19..7cddf5008c5 100644
---
a/pinot-segment-spi/src/main/java/org/apache/pinot/segment/spi/AggregationFunctionType.java
+++
b/pinot-segment-spi/src/main/java/org/apache/pinot/segment/spi/AggregationFunctionType.java
@@ -53,11 +53,11 @@ public enum AggregationFunctionType {
// TODO: min/max only supports NUMERIC in Pinot, where Calcite supports
COMPARABLE_ORDERED
MIN("min", SqlTypeName.DOUBLE, SqlTypeName.DOUBLE),
MAX("max", SqlTypeName.DOUBLE, SqlTypeName.DOUBLE),
- MINSTRING("minString", SqlTypeName.VARCHAR, SqlTypeName.VARCHAR),
- MAXSTRING("maxString", SqlTypeName.VARCHAR, SqlTypeName.VARCHAR),
+ MINSTRING("minString", ReturnTypes.ARG0_NULLABLE_IF_EMPTY,
OperandTypes.CHARACTER),
+ MAXSTRING("maxString", ReturnTypes.ARG0_NULLABLE_IF_EMPTY,
OperandTypes.CHARACTER),
SUM("sum", SqlTypeName.DOUBLE, SqlTypeName.DOUBLE),
SUM0("$sum0", SqlTypeName.DOUBLE, SqlTypeName.DOUBLE),
- SUMINT("sumInt", SqlTypeName.BIGINT, SqlTypeName.BIGINT),
+ SUMINT("sumInt", ReturnTypes.BIGINT, OperandTypes.INTEGER),
SUMPRECISION("sumPrecision", ReturnTypes.explicit(SqlTypeName.DECIMAL),
OperandTypes.ANY, SqlTypeName.OTHER),
AVG("avg", SqlTypeName.OTHER, SqlTypeName.DOUBLE),
MODE("mode", SqlTypeName.OTHER, SqlTypeName.DOUBLE),
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]