Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pinot connector: by default turn on push down top n queries #17582

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public class PinotConfig
private int fetchRetryCount = 2;
private boolean useDateTrunc;
private int nonAggregateLimitForBrokerQueries = DEFAULT_NON_AGGREGATE_LIMIT_FOR_BROKER_QUERIES;
private boolean pushdownTopNBrokerQueries;
private boolean pushdownTopNBrokerQueries = true;
private String grpcHost;
private int grpcPort = DEFAULT_PROXY_GRPC_PORT;
private boolean useProxy;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public void testDefaults()
.setNumSegmentsPerSplit(1)
.setFetchRetryCount(2)
.setMarkDataFetchExceptionsAsRetriable(true)
.setPushdownTopNBrokerQueries(false)
.setPushdownTopNBrokerQueries(true)
.setIgnoreEmptyResponses(false)
.setUseDateTrunc(false)
.setForbidSegmentQueries(false)
Expand Down Expand Up @@ -113,7 +113,7 @@ public void testExplicitPropertyMappings()
.put("pinot.non-aggregate-limit-for-broker-queries", "10")
.put("pinot.use-date-trunc", "true")
.put("pinot.limit-large-for-segment", "100")
.put("pinot.pushdown-topn-broker-queries", "true")
.put("pinot.pushdown-topn-broker-queries", "false")
.put("pinot.forbid-segment-queries", "true")
.put("pinot.use-streaming-for-segment-queries", "true")
.put("pinot.streaming-server-grpc-max-inbound-message-bytes", "65536")
Expand Down Expand Up @@ -160,7 +160,7 @@ public void testExplicitPropertyMappings()
.setMarkDataFetchExceptionsAsRetriable(false)
.setNonAggregateLimitForBrokerQueries(10)
.setLimitLargeForSegment(100)
.setPushdownTopNBrokerQueries(true)
.setPushdownTopNBrokerQueries(false)
.setForbidSegmentQueries(true)
.setUseStreamingForSegmentQueries(true)
.setStreamingServerGrpcMaxInboundMessageBytes(65536)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

import java.util.Optional;

import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue;

public class TestPinotQueryGeneratorSql
extends TestPinotQueryGenerator
Expand Down Expand Up @@ -216,7 +216,7 @@ public void testAggregationWithOrderByPushDownInTopN()
}

@Test
public void testDefaultNoTopNPushdown()
public void testDefaultTopNPushdown()
{
PlanBuilder planBuilder = createPlanBuilder(defaultSessionHolder);
TableScanNode tableScanNode = tableScan(planBuilder, pinotTable, city, fare);
Expand All @@ -225,21 +225,28 @@ public void testDefaultNoTopNPushdown()
.source(tableScanNode)
.singleGroupingSet(variable("city"))
.addAggregation(planBuilder.variable("sum_fare"), getRowExpression("sum(fare)", defaultSessionHolder)));
pinotConfig.setPushdownTopNBrokerQueries(false);
pinotConfig.setPushdownTopNBrokerQueries(true);
TopNNode topN = new TopNNode(Optional.empty(), planBuilder.getIdAllocator().getNextId(), aggregationNode, 1000,
new OrderingScheme(ImmutableList.of(new Ordering(variable("sum_fare"), SortOrder.ASC_NULLS_FIRST))),
TopNNode.Step.SINGLE);
Optional<PinotQueryGenerator.PinotQueryGeneratorResult> generatedQuery =
new PinotQueryGenerator(pinotConfig, functionAndTypeManager, functionAndTypeManager, standardFunctionResolution)
.generate(topN, defaultSessionHolder.getConnectorSession());
assertFalse(generatedQuery.isPresent());
assertTrue(generatedQuery.isPresent());
SessionHolder sessionHolder = new SessionHolder(pinotConfig);
testPinotQuery(
pinotConfig,
aggregationNode,
"SELECT city, sum(fare) FROM realtimeOnly GROUP BY city LIMIT 10000",
sessionHolder,
ImmutableMap.of());

testPinotQuery(
pinotConfig,
topN,
"SELECT city, sum(fare) FROM realtimeOnly GROUP BY city ORDER BY sum(fare) LIMIT 1000",
sessionHolder,
ImmutableMap.of());
}

@Test
Expand Down