This is an automated email from the ASF dual-hosted git repository. yashmayya 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 936e9c3115 Fix filtered aggregate expression hint override logic for compound filters (#15603) 936e9c3115 is described below commit 936e9c311589214c84054afdc7ded6d13340d9a8 Author: Yash Mayya <yash.ma...@gmail.com> AuthorDate: Mon Apr 21 19:08:00 2025 +0100 Fix filtered aggregate expression hint override logic for compound filters (#15603) --- .../core/plan/maker/InstancePlanMakerImplV2.java | 3 +- .../tests/custom/TimestampIndexMseTest.java | 33 ++++++++++++++++++++++ 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/pinot-core/src/main/java/org/apache/pinot/core/plan/maker/InstancePlanMakerImplV2.java b/pinot-core/src/main/java/org/apache/pinot/core/plan/maker/InstancePlanMakerImplV2.java index 511815fbb2..30cf07c392 100644 --- a/pinot-core/src/main/java/org/apache/pinot/core/plan/maker/InstancePlanMakerImplV2.java +++ b/pinot-core/src/main/java/org/apache/pinot/core/plan/maker/InstancePlanMakerImplV2.java @@ -380,8 +380,7 @@ public class InstancePlanMakerImplV2 implements PlanMaker { for (Pair<AggregationFunction, FilterContext> filteredAggregationFunction : filtAggrFuns) { FilterContext right = filteredAggregationFunction.getRight(); if (right != null) { - Predicate predicate = right.getPredicate(); - predicate.setLhs(overrideWithExpressionHints(predicate.getLhs(), indexSegment, expressionOverrideHints)); + overrideWithExpressionHints(right, indexSegment, expressionOverrideHints); } } } diff --git a/pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/custom/TimestampIndexMseTest.java b/pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/custom/TimestampIndexMseTest.java index 552b0ebc7c..ad8abd3c99 100644 --- a/pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/custom/TimestampIndexMseTest.java +++ b/pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/custom/TimestampIndexMseTest.java @@ -18,6 +18,7 @@ */ package org.apache.pinot.integration.tests.custom; +import com.fasterxml.jackson.databind.JsonNode; import java.io.File; import java.util.ArrayList; import java.util.List; @@ -35,6 +36,8 @@ import org.apache.pinot.util.TestUtils; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; +import static org.testng.Assert.assertTrue; + public class TimestampIndexMseTest extends BaseClusterIntegrationTest implements ExplainIntegrationTestTrait { @BeforeClass @@ -107,6 +110,36 @@ public class TimestampIndexMseTest extends BaseClusterIntegrationTest implements + " FilterMatchEntireSegment(numDocs=[115545])\n"); } + @Test + public void timestampIndexCompoundAggregateFilter() + throws Exception { + setUseMultiStageQueryEngine(true); + String query = + "SELECT SUM(1) FILTER (WHERE AirlineID = 19393 AND DATE_TRUNC('SECOND', ArrTime) > 100) FROM " + + "mytable LIMIT 100"; + JsonNode result = postQuery(query); + assertNoError(result); + assertTrue(result.get("resultTable").get("rows").get(0).get(0).asInt() > 0); + explain(query, "Execution Plan\n" + + "LogicalSort(fetch=[100])\n" + + " PinotLogicalSortExchange(distribution=[hash], collation=[[]], isSortOnSender=[false], " + + "isSortOnReceiver=[false])\n" + + " LogicalProject(EXPR$0=[CASE(=($1, 0), null:BIGINT, $0)])\n" + + " PinotLogicalAggregate(group=[{}], agg#0=[$SUM0($0)], agg#1=[COUNT($1)], aggType=[FINAL])\n" + + " PinotLogicalExchange(distribution=[hash])\n" + + " LeafStageCombineOperator(table=[mytable])\n" + + " StreamingInstanceResponse\n" + + " CombineAggregate\n" + + " AggregateFiltered(aggregations=[[sum('1'), count(*)]])\n" + + " Transform(expressions=[['1']])\n" + + " Project(columns=[[]])\n" + + " DocIdSet(maxDocs=[120000])\n" + + " FilterAnd\n" + + " FilterRangeIndex(predicate=[$ArrTime$SECOND > '100'], indexLookUp=[range_index]," + + " operator=[RANGE])\n" + + " FilterFullScan(predicate=[AirlineID = '19393'], operator=[EQ])\n"); + } + @Test public void timestampIndexSubstitutedInGroupBy() { setUseMultiStageQueryEngine(true); --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org