githubEdit

Default Disabled Rules

At this point, Pinot uses Calcite's HepPlannerarrow-up-right for multi-stage query optimization, without cardinality estimation and or cost-based search. This means any transformation rule that is enabled will be fired once its condition matches.

There are certain rules that are helpful and only helpful under certain circumstances (with certain selectivity and cardinality conditions). We disable them by default and list them here for users to enable on demand.

Default Disabled Rules

JOIN_TO_ENRICHED_JOIN

About

Enable Pinot's JOIN_TO_ENRICHED_JOINarrow-up-right that creates a EnrichedHashJoinOpeartorarrow-up-right that fuses arbitrary combinations of filters, projections, and an optional limit into a HashJoin. This always avoids materializing intermediate results for join executions, which saves memory and speeds up join execution.

Use Case

Any case a hash join is followed a by projections and/or filters and/or limit. This is especially useful when there are projections that could not be pushed does the join (e.g. sum of two columns from each side), and filters that are based on such projections. This is also going to be useful when there's a LIMIT immediately after join. Sometimes, the filters and projections are pushed down the join by other optimizer rules, then this would have no effect.

Example

For a simple Projection-after-join query over TPC-H, like:

SET usePlannerRules='JoinToEnrichedJoin';
SELECT l_tax FROM lineitem
JOIN orders ON l_orderkey = o_orderkey;

This optimization reduces join allocation by >30% and speeds up query by >15%.

Other example queries on which this might work includes: Limit after join

Filter over complex expressions after join

AGGREGATE_JOIN_TRANSPOSE_EXTENDED

About

Calcite's AGGREGATE_JOIN_TRANSPOSE_EXTENDEDarrow-up-right. This rule pushes / duplicates aggregation function down a join when the aggregation function is splitable.

Use case

Consider using this rule when the group-by reduces input cardinality by a large extent, and the aggregation function evaluation is inexpensive. SET usePlannerRules='AggregateJoinTransposeExtended';

Example

Example query:

SORT_JOIN_TRANSPOSE

About

Calcite's SORT_JOIN_TRANSPOSEarrow-up-right. This pushes a sort with its limit below left/right outer join's preserve side when it could do so safely.

Use case

Consider using this rule when there's sort-limit on preserve side on a left/right outer join. SET usePlannerRules='SortJoinTranspose';.

Example

Example query with TPC-H:

Last updated

Was this helpful?