T - Trait that this trait definition is based uponpublic abstract class RelTraitDef<T extends RelTrait> extends Object
RelTraits. Implementations of
RelTraitDef may be singletons under the following conditions:
canConvert(RelOptPlanner, RelTrait, RelTrait) and
convert(RelOptPlanner, RelNode, RelTrait, boolean) do not require
planner-instance-specific information, orConventionTraitDef for an example of this.Otherwise, a new instance of RelTraitDef must be constructed and registered with each new planner instantiated.
| Modifier | Constructor and Description |
|---|---|
protected |
RelTraitDef() |
| Modifier and Type | Method and Description |
|---|---|
abstract boolean |
canConvert(RelOptPlanner planner,
T fromTrait,
T toTrait)
Tests whether the given RelTrait can be converted to another RelTrait.
|
T |
canonize(T trait)
Takes an arbitrary RelTrait and returns the canonical representation of
that RelTrait.
|
abstract RelNode |
convert(RelOptPlanner planner,
RelNode rel,
T toTrait,
boolean allowInfiniteCostConverters)
Converts the given RelNode to the given RelTrait.
|
void |
deregisterConverterRule(RelOptPlanner planner,
ConverterRule converterRule)
Provides notification that a particular
ConverterRule has been
de-registered from a RelOptPlanner. |
abstract T |
getDefault()
Returns the default member of this trait.
|
abstract String |
getSimpleName() |
abstract Class<T> |
getTraitClass() |
boolean |
multiple()
Whether a relational expression may possess more than one instance of
this trait simultaneously.
|
void |
registerConverterRule(RelOptPlanner planner,
ConverterRule converterRule)
Provides notification of the registration of a particular
ConverterRule with a RelOptPlanner. |
public boolean multiple()
A subset has only one instance of a trait.
public abstract Class<T> getTraitClass()
public abstract String getSimpleName()
RelNode.explain(org.apache.calcite.rel.RelWriter)).public final T canonize(T trait)
==).
If an equal RelTrait has already been canonized and is still in use, it will be returned. Otherwise, the given RelTrait is made canonical and returned.
trait - a possibly non-canonical RelTraitpublic abstract RelNode convert(RelOptPlanner planner, RelNode rel, T toTrait, boolean allowInfiniteCostConverters)
planner - the planner requesting the conversionrel - RelNode to converttoTrait - RelTrait to convert toallowInfiniteCostConverters - flag indicating whether infinite cost
converters are allowedpublic abstract boolean canConvert(RelOptPlanner planner, T fromTrait, T toTrait)
planner - the planner requesting the conversion testfromTrait - the RelTrait to convert fromtoTrait - the RelTrait to convert topublic void registerConverterRule(RelOptPlanner planner, ConverterRule converterRule)
ConverterRule with a RelOptPlanner. The default
implementation does nothing.planner - the planner registering the ruleconverterRule - the registered converter rulepublic void deregisterConverterRule(RelOptPlanner planner, ConverterRule converterRule)
ConverterRule has been
de-registered from a RelOptPlanner. The default implementation
does nothing.planner - the planner registering the ruleconverterRule - the registered converter rulepublic abstract T getDefault()
Copyright © 2012–2015 The Apache Software Foundation. All rights reserved.