public class RelStructuredTypeFlattener extends Object implements ReflectiveVisitor
As an example, suppose we have a structured type ST(A1 smallint, A2
bigint), a table T(c1 ST, c2 double), and a query
select t.c2, t.c1.a2 from t. After SqlToRelConverter executes, the
unflattened tree looks like:
LogicalProject(C2=[$1], A2=[$0.A2]) LogicalTableScan(table=[T])
After flattening, the resulting tree looks like
LogicalProject(C2=[$3], A2=[$2]) FtrsIndexScanRel(table=[T], index=[clustered])
The index scan produces a flattened row type (boolean, smallint,
bigint, double) (the boolean is a null indicator for c1), and the
projection picks out the desired attributes (omitting $0 and
$1 altogether). After optimization, the projection might be
pushed down into the index scan, resulting in a final tree like
FtrsIndexScanRel(table=[T], index=[clustered], projection=[3, 2])
| Modifier and Type | Class and Description |
|---|---|
static interface |
RelStructuredTypeFlattener.SelfFlatteningRel
Mix-in interface for relational expressions that know how to
flatten themselves.
|
| Constructor and Description |
|---|
RelStructuredTypeFlattener(RelBuilder relBuilder,
RexBuilder rexBuilder,
RelOptTable.ToRelContext toRelContext,
boolean restructure) |
RelStructuredTypeFlattener(RexBuilder rexBuilder,
RelOptTable.ToRelContext toRelContext,
boolean restructure)
Deprecated.
|
@Deprecated public RelStructuredTypeFlattener(RexBuilder rexBuilder, RelOptTable.ToRelContext toRelContext, boolean restructure)
public RelStructuredTypeFlattener(RelBuilder relBuilder, RexBuilder rexBuilder, RelOptTable.ToRelContext toRelContext, boolean restructure)
public void updateRelInMap(com.google.common.collect.SortedSetMultimap<RelNode,CorrelationId> mapRefRelToCorVar)
public void updateRelInMap(SortedMap<CorrelationId,LogicalCorrelate> mapCorVarToCorRel)
protected int getNewForOldInput(int oldOrdinal)
oldOrdinal - Pre-flattening ordinalprotected org.apache.calcite.linq4j.Ord<RelDataType> getNewFieldForOldInput(int oldOrdinal)
oldOrdinal - Pre-flattening ordinalpublic void rewriteRel(LogicalTableModify rel)
public void rewriteRel(LogicalAggregate rel)
public void rewriteRel(Sort rel)
public void rewriteRel(LogicalFilter rel)
public void rewriteRel(LogicalJoin rel)
public void rewriteRel(LogicalCorrelate rel)
public void rewriteRel(Collect rel)
public void rewriteRel(Uncollect rel)
public void rewriteRel(LogicalIntersect rel)
public void rewriteRel(LogicalMinus rel)
public void rewriteRel(LogicalUnion rel)
public void rewriteRel(LogicalValues rel)
public void rewriteRel(LogicalTableFunctionScan rel)
public void rewriteRel(Sample rel)
public void rewriteRel(LogicalProject rel)
public void rewriteRel(LogicalCalc rel)
public void rewriteRel(RelStructuredTypeFlattener.SelfFlatteningRel rel)
public void rewriteRel(LogicalExchange rel)
public void rewriteRel(LogicalSortExchange rel)
public void rewriteGeneric(RelNode rel)
public void rewriteRel(TableScan rel)
public void rewriteRel(LogicalSnapshot rel)
public void rewriteRel(LogicalDelta rel)
public void rewriteRel(LogicalChi rel)
public void rewriteRel(LogicalMatch rel)
Copyright © 2012-2022 Apache Software Foundation. All Rights Reserved.