Package org.apache.calcite.rel.core
Class Match
- java.lang.Object
-
- org.apache.calcite.rel.AbstractRelNode
-
- org.apache.calcite.rel.SingleRel
-
- org.apache.calcite.rel.core.Match
-
- All Implemented Interfaces:
java.lang.Cloneable
,RelOptNode
,RelNode
- Direct Known Subclasses:
LogicalMatch
public abstract class Match extends SingleRel
Relational expression that represent a MATCH_RECOGNIZE node.Each output row has the columns defined in the measure statements.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
Match.AggregateFinder
Find aggregate functions in operands.private static class
Match.PatternVarFinder
Visits the operands of an aggregate call to retrieve relevant pattern variables.static class
Match.RexMRAggCall
Aggregate calls in match recognize.-
Nested classes/interfaces inherited from interface org.apache.calcite.rel.RelNode
RelNode.Context
-
-
Field Summary
Fields Modifier and Type Field Description protected RexNode
after
protected java.util.Set<Match.RexMRAggCall>
aggregateCalls
protected java.util.Map<java.lang.String,java.util.SortedSet<Match.RexMRAggCall>>
aggregateCallsPreVar
protected boolean
allRows
protected RexNode
interval
protected com.google.common.collect.ImmutableMap<java.lang.String,RexNode>
measures
protected RelCollation
orderKeys
protected java.util.List<RexNode>
partitionKeys
protected RexNode
pattern
protected com.google.common.collect.ImmutableMap<java.lang.String,RexNode>
patternDefinitions
private static java.lang.String
STAR
protected boolean
strictEnd
protected boolean
strictStart
protected com.google.common.collect.ImmutableMap<java.lang.String,java.util.SortedSet<java.lang.String>>
subsets
-
Fields inherited from class org.apache.calcite.rel.AbstractRelNode
digest, id, rowType, traitSet
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
Match(RelOptCluster cluster, RelTraitSet traitSet, RelNode input, RelDataType rowType, RexNode pattern, boolean strictStart, boolean strictEnd, java.util.Map<java.lang.String,RexNode> patternDefinitions, java.util.Map<java.lang.String,RexNode> measures, RexNode after, java.util.Map<java.lang.String,? extends java.util.SortedSet<java.lang.String>> subsets, boolean allRows, java.util.List<RexNode> partitionKeys, RelCollation orderKeys, RexNode interval)
Creates a Match.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description RelNode
copy(RelTraitSet traitSet, java.util.List<RelNode> inputs)
Creates a copy of this relational expression, perhaps changing traits and inputs.abstract Match
copy(RelNode input, RelDataType rowType, RexNode pattern, boolean strictStart, boolean strictEnd, java.util.Map<java.lang.String,RexNode> patternDefinitions, java.util.Map<java.lang.String,RexNode> measures, RexNode after, java.util.Map<java.lang.String,? extends java.util.SortedSet<java.lang.String>> subsets, boolean allRows, java.util.List<RexNode> partitionKeys, RelCollation orderKeys, RexNode interval)
private static <K extends java.lang.Comparable<K>,V>
com.google.common.collect.ImmutableSortedMap<K,java.util.SortedSet<V>>copyMap(java.util.Map<K,? extends java.util.SortedSet<V>> map)
Creates an immutable map of a map of sorted sets.RelWriter
explainTerms(RelWriter pw)
Describes the inputs and attributes of this relational expression.RexNode
getAfter()
RexNode
getInterval()
com.google.common.collect.ImmutableMap<java.lang.String,RexNode>
getMeasures()
RelCollation
getOrderKeys()
java.util.List<RexNode>
getPartitionKeys()
RexNode
getPattern()
com.google.common.collect.ImmutableMap<java.lang.String,RexNode>
getPatternDefinitions()
com.google.common.collect.ImmutableMap<java.lang.String,java.util.SortedSet<java.lang.String>>
getSubsets()
boolean
isAllRows()
boolean
isStrictEnd()
boolean
isStrictStart()
-
Methods inherited from class org.apache.calcite.rel.SingleRel
childrenAccept, deriveRowType, estimateRowCount, getInput, getInputs, replaceInput
-
Methods inherited from class org.apache.calcite.rel.AbstractRelNode
accept, accept, collectVariablesSet, collectVariablesUsed, computeDigest, computeSelfCost, computeSelfCost, explain, getChildExps, getCluster, getCollationList, getConvention, getCorrelVariable, getDescription, getDigest, getExpectedInputRowType, getId, getInput, getQuery, getRelTypeName, getRows, getRowType, getTable, getTraitSet, getVariablesSet, getVariablesStopped, isDistinct, isKey, isValid, isValid, metadata, onRegister, recomputeDigest, register, sole, toString
-
-
-
-
Field Detail
-
STAR
private static final java.lang.String STAR
- See Also:
- Constant Field Values
-
measures
protected final com.google.common.collect.ImmutableMap<java.lang.String,RexNode> measures
-
pattern
protected final RexNode pattern
-
strictStart
protected final boolean strictStart
-
strictEnd
protected final boolean strictEnd
-
allRows
protected final boolean allRows
-
after
protected final RexNode after
-
patternDefinitions
protected final com.google.common.collect.ImmutableMap<java.lang.String,RexNode> patternDefinitions
-
aggregateCalls
protected final java.util.Set<Match.RexMRAggCall> aggregateCalls
-
aggregateCallsPreVar
protected final java.util.Map<java.lang.String,java.util.SortedSet<Match.RexMRAggCall>> aggregateCallsPreVar
-
subsets
protected final com.google.common.collect.ImmutableMap<java.lang.String,java.util.SortedSet<java.lang.String>> subsets
-
partitionKeys
protected final java.util.List<RexNode> partitionKeys
-
orderKeys
protected final RelCollation orderKeys
-
interval
protected final RexNode interval
-
-
Constructor Detail
-
Match
protected Match(RelOptCluster cluster, RelTraitSet traitSet, RelNode input, RelDataType rowType, RexNode pattern, boolean strictStart, boolean strictEnd, java.util.Map<java.lang.String,RexNode> patternDefinitions, java.util.Map<java.lang.String,RexNode> measures, RexNode after, java.util.Map<java.lang.String,? extends java.util.SortedSet<java.lang.String>> subsets, boolean allRows, java.util.List<RexNode> partitionKeys, RelCollation orderKeys, RexNode interval)
Creates a Match.- Parameters:
cluster
- ClustertraitSet
- Trait setinput
- Input relational expressionrowType
- Row typepattern
- Regular expression that defines pattern variablesstrictStart
- Whether it is a strict start patternstrictEnd
- Whether it is a strict end patternpatternDefinitions
- Pattern definitionsmeasures
- Measure definitionsafter
- After match definitionssubsets
- Subsets of pattern variablesallRows
- Whether all rows per match (false means one row per match)partitionKeys
- Partition by columnsorderKeys
- Order by columnsinterval
- Interval definition, null if WITHIN clause is not defined
-
-
Method Detail
-
copyMap
private static <K extends java.lang.Comparable<K>,V> com.google.common.collect.ImmutableSortedMap<K,java.util.SortedSet<V>> copyMap(java.util.Map<K,? extends java.util.SortedSet<V>> map)
Creates an immutable map of a map of sorted sets.
-
getMeasures
public com.google.common.collect.ImmutableMap<java.lang.String,RexNode> getMeasures()
-
getAfter
public RexNode getAfter()
-
getPattern
public RexNode getPattern()
-
isStrictStart
public boolean isStrictStart()
-
isStrictEnd
public boolean isStrictEnd()
-
isAllRows
public boolean isAllRows()
-
getPatternDefinitions
public com.google.common.collect.ImmutableMap<java.lang.String,RexNode> getPatternDefinitions()
-
getSubsets
public com.google.common.collect.ImmutableMap<java.lang.String,java.util.SortedSet<java.lang.String>> getSubsets()
-
getPartitionKeys
public java.util.List<RexNode> getPartitionKeys()
-
getOrderKeys
public RelCollation getOrderKeys()
-
getInterval
public RexNode getInterval()
-
copy
public abstract Match copy(RelNode input, RelDataType rowType, RexNode pattern, boolean strictStart, boolean strictEnd, java.util.Map<java.lang.String,RexNode> patternDefinitions, java.util.Map<java.lang.String,RexNode> measures, RexNode after, java.util.Map<java.lang.String,? extends java.util.SortedSet<java.lang.String>> subsets, boolean allRows, java.util.List<RexNode> partitionKeys, RelCollation orderKeys, RexNode interval)
-
copy
public RelNode copy(RelTraitSet traitSet, java.util.List<RelNode> inputs)
Description copied from interface:RelNode
Creates a copy of this relational expression, perhaps changing traits and inputs.Sub-classes with other important attributes are encouraged to create variants of this method with more parameters.
- Specified by:
copy
in interfaceRelNode
- Overrides:
copy
in classAbstractRelNode
- Parameters:
traitSet
- Trait setinputs
- Inputs- Returns:
- Copy of this relational expression, substituting traits and inputs
-
explainTerms
public RelWriter explainTerms(RelWriter pw)
Description copied from class:AbstractRelNode
Describes the inputs and attributes of this relational expression. Each node should callsuper.explainTerms
, then call theRelWriterImpl.input(String, RelNode)
andRelWriterImpl.item(String, Object)
methods for each input and attribute.- Overrides:
explainTerms
in classSingleRel
- Parameters:
pw
- Plan writer- Returns:
- Plan writer for fluent-explain pattern
-
-