Package org.apache.calcite.rel.rules
package org.apache.calcite.rel.rules
Provides a core set of planner rules.
Consider this package to be the "standard library" of planner rules. Most of the common rewrites that you would want to perform on logical relational expressions, or generically on any data source, are present, and have been well tested.
Of course, the library is never complete, and contributions are welcome.
Not present are rules specific to a particular data source: look in that data source's adapter.
Also out of the scope of this package are rules that support a particular operation, such as decorrelation or recognizing materialized views. Those are defined along with the algorithm.
For
Related packages and classes
- Package
org.apache.calcite.sqlis an object model for SQL expressions - Package
org.apache.calcite.rexis an object model for relational row expressions - Package
org.apache.calcite.planprovides an optimizer interface.
-
ClassDescriptionRule configuration.Rule that converts CASE-style filtered aggregates into true filtered aggregates.Rule configuration.Planner rule that expands distinct aggregates (such as
COUNT(DISTINCT x)) from aAggregate.Rule configuration.Planner rule that rewrites anAggregatethat containsWITHIN DISTINCTaggregate functions.Rule configuration.Rule configuration.Rule configuration.Rule configuration.Rule configuration.Rule configuration.Rule configuration.Rule that transforms an MIN/MAXAggregatefunctions into equivalent subqueries with ORDER BY and LIMIT 1 for potential performance optimization.Rule configuration.Rule configuration.Rule configuration.Planner rule that removes constant keys from anAggregate.Rule configuration.Variant ofAggregateStarTableRulethat accepts aProjectbetween theAggregateand itsStarTable.StarTableScaninput.Rule configuration.Planner rule that reduces aggregate functions inAggregates to simpler forms.Rule configuration.Planner rule that removes aAggregateif it computes no aggregate functions (that is, it is implementingSELECT DISTINCT), or all the aggregate functions are splittable, and the underlying relational expression is already distinct.Rule configuration.Planner rule that matches anAggregateon top of aStarTable.StarTableScan.Rule configuration.Rule configuration.Rule configuration.Rule that 1.Rule configuration.Rule configuration.Type of relational expression.Planner rule that removes a trivialLogicalCalc.Rule configuration.Rule configuration.CoerceInputsRule pre-casts inputs to a particular type.Rule configuration.Rules that perform logical transformations on relational expressions.Collection of planner rules that convertEXTRACT(timeUnit FROM dateTime) = constant,FLOOR(dateTime to timeUnit= constant} andCEIL(dateTime to timeUnit= constant} todateTime BETWEEN lower AND upper.Rule that converts EXTRACT, FLOOR and CEIL in aFilterinto a date range.Rule configuration.The core process of dphyp enumeration algorithm.Rule that re-orders aJointree using dphyp algorithm.Rule configuration.Deprecated.Planner rule that removes keys from aExchangeif those keys are known to be constant.Rule configuration.Rule configuration.Rule configuration.Rule configuration.Rule configuration.Rule configuration.Planner rule that matches aFilterexpression with correlated variables, and rewrites the condition in a simpler form that is more convenient for the decorrelation logic.Rule configuration.FilterJoinRule<C extends FilterJoinRule.Config>Planner rule that pushes filters above and within a join node into the join node and/or its children nodes.Rule configuration.Rule that tries to push filter expressions into a join condition and into the inputs of the join.Rule configuration.Rule that pushes parts of the join condition to its inputs.Rule configuration.Predicate that returns whether a filter is valid in the ON clause of a join for this particular kind of join.Planner rule that combines twoLogicalFilters.Rule configuration.Rule configuration.Rule configuration.Planner rule that replacesIS NOT DISTINCT FROMin aFilterwith logically equivalent operations.Rule configuration.Rule configuration.Rule configuration.Rule configuration.Planner rule that pushes aLogicalFilterpast aLogicalTableFunctionScan.Rule configuration.Planner rule that converts aFilteron aTableScanof aFilterableTableor aProjectableFilterableTableto aBindables.BindableTableScan.Rule configuration.Planner rule that converts aLogicalFilterto aLogicalCalc.Rule configuration.Rule configuration.Edge in HyperGraph, that represents a join predicate.HyperGraph represents a join graph.Planner rule that reorders inputs of anIntersectto put smaller inputs first.Rule configuration.Rule configuration.Rule configuration.Rule configuration.Rule to add a semi-join into a join.Rule configuration.Planner rule that changes a join based on the associativity rule.Rule configuration.Planner rule that permutes the inputs to aJoin.Rule configuration.Planner rule that replacesIS NOT DISTINCT FROMin aJoincondition with logically equivalent operations.Rule configuration.Rule configuration.Planner rule that matches aJoinand expands OR clauses in join conditions.Rule configuration.Rule configuration.Planner rule that matches aJoinone of whose inputs is aLogicalProject, and pulls the project up.Rule configuration.Planner rule that pushes down expressions in "equal" join condition.Rule configuration.Rule that pushes the right input of a join into through the left input of the join, provided that the left input is also a join.Rule configuration.Rule configuration.Rule that converts aJoininto aLogicalCorrelate, which can then be implemented using nested loops.Rule configuration.Rule that flattens a tree ofLogicalJoins into a singleHyperGraphwith N inputs.Rule configuration.Planner rule to flatten a tree ofLogicalJoins into a singleMultiJoinwith N inputs.Rule configuration.Rule configuration.Bitmap tool for dphyp.Traverse the bitmap in reverse order.Enumerate all subsets of a bitmap from small to large.Utility class used to store aJointree and the factors that make up the tree.Simple binary tree class that stores an id in the leaf nodes and keeps track of the parent LoptJoinTree object associated with the binary tree.Binary tree node that has no children.Binary tree node that has two children.Utility class that keeps track of the join factors that make up aMultiJoin.Planner rule that implements the heuristic planner for determining optimal join orderings.Rule configuration.Function to compute cost.Implements the logic for determining the optimal semi-joins to be used in processing joins in a query.Planner rule that converts aLogicalMatchto the result of callingLogicalMatch.copy(org.apache.calcite.plan.RelTraitSet, java.util.List<org.apache.calcite.rel.RelNode>).Rule configuration.Rule configuration.Collection of planner rules that deal with measures.Rule that matches anAggregatewith at least one call toSqlInternalOperators.AGG_M2Vand expands these calls by asking the measure for its expression.Configuration forMeasureRules.AggregateMeasure2Rule.Rule that matches anAggregatewith at least one call toSqlInternalOperators.AGG_M2Vand converts those calls toSqlInternalOperators.M2X.Configuration forMeasureRules.AggregateMeasureRule.Configuration forMeasureRules.FilterSortMeasureRule.Configuration forMeasureRules.ProjectMeasureRule.Configuration forMeasureRules.ProjectSortMeasureRule.Rule configuration.Rule configuration.Rule configuration.A MultiJoin represents a join of N inputs, whereas regular Joins represent strictly binary joins.Planner rule that finds an approximately optimal ordering for join operators using a heuristic algorithm.Rule configuration.MultiJoinProjectTransposeRule implements the rule for pullingLogicalProjects that are on top of aMultiJoinand beneath aLogicalJoinso theLogicalProjectappears above theLogicalJoin.Rule configuration.Rule configuration.Rule configuration.Rule configuration.Visitor for RelNodes which applies specifiedRexShuttlevisitor for every node in the tree.Visitor for RexNodes which replacesRexCorrelVariablewith specified.Rule configuration.Rule configuration.Rule configuration.Rule configuration.Rule configuration.Rule configuration.Planner rule that converts SUM to SUM0 when it is the aggregate for an OVER clause inside the project list.Rule configuration.Planner rule that, given aProjectnode that merely returns its input, converts the node into its child.Rule configuration.Rule configuration.Planner rule that converts aProjecton aTableScanof aProjectableFilterableTableto aBindables.BindableTableScan.Rule configuration.Rule to convert aLogicalProjectto aLogicalCalc.Rule configuration.Planner rule that slices aProjectinto sections which contain windowed aggregate functions and sections which do not.Instance of the rule that applies to aCalcthat contains windowed aggregates and converts it into a mixture ofLogicalWindowandCalc.Rule configuration.Rule configuration.Instance of the rule that can be applied to aProjectand that produces, in turn, a mixture ofLogicalProjectandLogicalWindow.Rule configuration.Planner rule that pushes aLogicalProjectpast aLogicalWindow.Rule configuration.Collection of rules which remove sections of a query plan known never to produce any rows.Configuration for rule that prunes a correlate if its left input is empty.Configuration for rule that prunes a correlate if its right input is empty.Configuration for a rule that prunes an Intersect if any of its inputs is empty.Configuration for rule that prunes a join it its left input is empty.Configuration for rule that prunes a join it its right input is empty.Configuration for a rule that prunes empty inputs from a Minus.Abstract prune empty rule that implements SubstitutionRule interface.Rule configuration.Rule that converts a relation into empty.Rule configuration.Configuration for a rule that prunes a Sort if it has limit 0.Configuration for a rule that prunes empty inputs from a Minus.Configuration for rule that transforms an empty relational expression into an empty values.PushProjector is a utility class used to perform operations used in push projection rules.A functor that replies true or false for a given expression.Rule that reduces decimal operations (such as casts or arithmetic) into operations involving more primitive types (such as longs and doubles).Rule configuration.A shuttle which converts decimal expressions to expressions based on longs.Rewrites a decimal expression for a specific set of SqlOperator's.Collection of planner rules that apply various simplifying transformations on RexNode trees.Rule that reduces constants inside aCalc.Rule configuration.Shuttle that pushes predicates into a CASE.Rule configuration.Rule that reduces constants inside aFilter.Rule configuration.Rule that reduces constants inside aJoin.Rule configuration.Rule that reduces constants inside aProject.Rule configuration.Helper class used to locate expressions that either can be reduced to literals or contain redundant casts.Replaces expressions with their reductions.Rule that reduces constants inside aWindow.Rule configuration.The@RuleConfigannotation is exclusively used for testing purposes to identify configuration names when a rule contains multiple Configs.Rule configuration.Planner rule that pushesSemiJoins down in a tree past aFilter.Rule configuration.Rule configuration.Rule configuration.Planner rule that removes asemi-joinfrom a join tree.Rule configuration.Planner rule that creates aSemiJoinfrom aJoinon top of aLogicalAggregateor on aRelNodewhich is unique for join's right keys.Rule configuration.SemiJoinRule that matches a Project on top of a Join with a RelNode which is unique for Join's right keys.Rule configuration.SemiJoinRule that matches a Join with an empty Aggregate as its right input.Rule configuration.SemiJoinRule that matches a Project on top of a Join with an Aggregate as its right child.Rule configuration.Rule configuration.Collection of rules which simplify joins which have one of their input as constant relationsValuesthat produce a single row.Abstract class for all the SingleValuesOptimizationRules.Rule configuration.Rule configuration.Rule configuration.This rule try to merge the doubleSort,one is Limit semantics, another sort is Limit or TOPN semantics.Rule configuration.Rule configuration.Planner rule that removes keys from a aSortif those keys are known to be constant, or removes the entire Sort if all keys are constant.Rule configuration.Rule that removes redundantORDER BYorLIMITwhen its input RelNode's maximum row count is less than or equal to specified row count.Rule configuration.Planner rule that removes aSortif its input is already sorted.Rule configuration.Rule configuration.Collection of planner rules that convert calls to spatial functions into more efficient expressions.Rule that converts ST_DWithin in a Filter condition into a predicate on a Hilbert curve.Rule configuration.Transform that converts IN, EXISTS and scalar sub-queries into joins.Rule configuration.A rule that implements this interface indicates that the new RelNode is typically better than the old one.Deprecated.org.apache.calcite.rel.core.RelFactories.TableScanFactoryImplhas calledRelOptTable.toRel(RelOptTable.ToRelContext).Rule configuration.Logical transformation rule, only logical operator can be rule operand, and only generate logical alternatives.UnionEliminatorRulechecks to see if its possible to optimize a Union call by eliminating the Union operator altogether in the case the call consists of only one input.Rule configuration.Rule configuration.Planner rule that pulls up constants through a Union operator.Rule configuration.Rule configuration.Rule configuration.Planner rule that folds projections and filters into an underlyingLogicalValues.Rule configuration.
EquiJoin in 'core' package