> For the complete documentation index, see [llms.txt](https://docs.pinot.apache.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.pinot.apache.org/release-1.5.0/users/user-guide-query/query-options/default-disabled-rules.md).

# Default Disabled Rules

At this point, Pinot uses Calcite's [HepPlanner](https://calcite.apache.org/javadocAggregate/org/apache/calcite/plan/hep/HepPlanner.html) 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\_JOIN](https://github.com/apache/pinot/blob/master/pinot-query-planner/src/main/java/org/apache/pinot/calcite/rel/rules/PinotEnrichedJoinRule.java) that creates a [EnrichedHashJoinOpeartor](https://github.com/apache/pinot/blob/master/pinot-query-runtime/src/main/java/org/apache/pinot/query/runtime/operator/EnrichedHashJoinOperator.java) 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:

```sql
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**

```sql
SELECT * FROM lineitem JOIN orders ON l_orderkey = o_orderkey LIMIT 10;
```

**Filter over complex expressions after join**

```sql
SELECT * FROM (
    SELECT <complex_expression> AS result FROM lineitem JOIN orders ON l_orderkey = o_orderkey
) WHERE <complex_expression_over_result>;
```

### AGGREGATE\_JOIN\_TRANSPOSE\_EXTENDED

#### About

Calcite's [AGGREGATE\_JOIN\_TRANSPOSE\_EXTENDED](https://calcite.apache.org/javadocAggregate/org/apache/calcite/rel/rules/CoreRules.html#AGGREGATE_JOIN_TRANSPOSE_EXTENDED).\
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:

```sql
SELECT SUM(t1.b)
FROM t1 INNER JOIN t1
ON t1.a = t2.a
GROUP BY t1.a, t2.a
```

### SORT\_JOIN\_TRANSPOSE

#### About

Calcite's [SORT\_JOIN\_TRANSPOSE](https://calcite.apache.org/javadocAggregate/org/apache/calcite/rel/rules/CoreRules.html#SORT_JOIN_TRANSPOSE). 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:

```sql
SELECT * 
FROM t1 LEFT JOIN t2
ON t1.a = t2.a
ORDER BY t1.a
LIMIT 100
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.pinot.apache.org/release-1.5.0/users/user-guide-query/query-options/default-disabled-rules.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
