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 5760d10746 Fix bug preventing numeric casts for MV columns in filters using the multi-stage query engine (#13425) 5760d10746 is described below commit 5760d10746e0a8f0b5c556a8ecad4e1a26f5e16a Author: Yash Mayya <yash.ma...@gmail.com> AuthorDate: Sun Jun 23 04:37:58 2024 +0530 Fix bug preventing numeric casts for MV columns in filters using the multi-stage query engine (#13425) --- .../core/query/optimizer/filter/NumericalFilterOptimizer.java | 7 +++++++ .../pinot/integration/tests/MultiStageEngineIntegrationTest.java | 8 ++++++++ 2 files changed, 15 insertions(+) diff --git a/pinot-core/src/main/java/org/apache/pinot/core/query/optimizer/filter/NumericalFilterOptimizer.java b/pinot-core/src/main/java/org/apache/pinot/core/query/optimizer/filter/NumericalFilterOptimizer.java index 38a6a03423..b0bcf42471 100644 --- a/pinot-core/src/main/java/org/apache/pinot/core/query/optimizer/filter/NumericalFilterOptimizer.java +++ b/pinot-core/src/main/java/org/apache/pinot/core/query/optimizer/filter/NumericalFilterOptimizer.java @@ -395,6 +395,13 @@ public class NumericalFilterOptimizer extends BaseAndOrBooleanFilterOptimizer { String targetTypeLiteral = expression.getFunctionCall().getOperands().get(1).getLiteral().getStringValue().toUpperCase(); DataType dataType; + + // Strip out _ARRAY suffix that can be used to represent an MV field type since the semantics here will be the + // same as that for the equivalent SV field of the same type + if (targetTypeLiteral.endsWith("_ARRAY")) { + targetTypeLiteral = targetTypeLiteral.substring(0, targetTypeLiteral.length() - 6); + } + if ("INTEGER".equals(targetTypeLiteral)) { dataType = DataType.INT; } else if ("VARCHAR".equals(targetTypeLiteral)) { diff --git a/pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/MultiStageEngineIntegrationTest.java b/pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/MultiStageEngineIntegrationTest.java index 0840f28c4a..811e957fe1 100644 --- a/pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/MultiStageEngineIntegrationTest.java +++ b/pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/MultiStageEngineIntegrationTest.java @@ -804,6 +804,14 @@ public class MultiStageEngineIntegrationTest extends BaseClusterIntegrationTestS assertNoError(jsonNode); } + @Test + public void testMVNumericCastInFilter() throws Exception { + String sqlQuery = "SELECT COUNT(*) FROM mytable WHERE arrayToMV(CAST(DivAirportIDs AS BIGINT ARRAY)) > 0"; + JsonNode jsonNode = postQuery(sqlQuery); + assertNoError(jsonNode); + assertEquals(jsonNode.get("resultTable").get("rows").get(0).get(0).asInt(), 15482); + } + @Override protected String getTableName() { return _tableName; --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org