public class ModifiableViewTable extends ViewTable implements ModifiableView, Wrapper
ViewTable
that is modifiable.Modifier and Type | Class and Description |
---|---|
private class |
ModifiableViewTable.ModifiableViewTableInitializerExpressionFactory
Initializes columns based on the view constraint.
|
Modifier and Type | Field and Description |
---|---|
private ImmutableIntList |
columnMapping |
private RexNode |
constraint |
private InitializerExpressionFactory |
initializerExpressionFactory |
private Table |
table |
private Path |
tablePath |
elementType
Constructor and Description |
---|
ModifiableViewTable(java.lang.reflect.Type elementType,
RelProtoDataType rowType,
java.lang.String viewSql,
java.util.List<java.lang.String> schemaPath,
java.util.List<java.lang.String> viewPath,
Table table,
Path tablePath,
RexNode constraint,
ImmutableIntList columnMapping)
Creates a ModifiableViewTable.
|
Modifier and Type | Method and Description |
---|---|
ModifiableViewTable |
extend(java.util.List<RelDataTypeField> extendedColumns,
RelDataTypeFactory typeFactory)
Extends the underlying table and returns a new view with updated row-type
and column-mapping.
|
protected ModifiableViewTable |
extend(Table extendedTable,
RelProtoDataType protoRowType,
ImmutableIntList newColumnMapping) |
ImmutableIntList |
getColumnMapping()
Returns the column mapping onto another table.
|
RexNode |
getConstraint(RexBuilder rexBuilder,
RelDataType tableRowType)
Returns a constraint that each candidate row must satisfy.
|
private static ImmutableIntList |
getNewColumnMapping(Table underlying,
ImmutableIntList oldColumnMapping,
java.util.List<RelDataTypeField> extendedColumns,
RelDataTypeFactory typeFactory)
Creates a mapping from the view index to the index in the underlying table.
|
Table |
getTable()
Returns the underlying table.
|
Path |
getTablePath()
Returns the full path of the underlying table.
|
<C> C |
unwrap(java.lang.Class<C> aClass)
Finds an instance of an interface implemented by this object,
or returns null if this object does not support that interface.
|
asQueryable, getJdbcTableType, getRowType, getSchemaPath, getViewPath, getViewSql, toRel, viewMacro, viewMacro, viewMacro
getElementType, getExpression
getStatistic, isRolledUp, rolledUpColumnValidInsideAgg
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getJdbcTableType, getRowType, getStatistic, isRolledUp, rolledUpColumnValidInsideAgg
private final Table table
private final Path tablePath
private final RexNode constraint
private final ImmutableIntList columnMapping
private final InitializerExpressionFactory initializerExpressionFactory
public ModifiableViewTable(java.lang.reflect.Type elementType, RelProtoDataType rowType, java.lang.String viewSql, java.util.List<java.lang.String> schemaPath, java.util.List<java.lang.String> viewPath, Table table, Path tablePath, RexNode constraint, ImmutableIntList columnMapping)
public RexNode getConstraint(RexBuilder rexBuilder, RelDataType tableRowType)
ModifiableView
Never null; if there is no constraint, returns "true".
getConstraint
in interface ModifiableView
rexBuilder
- Rex buildertableRowType
- Row type of the table that this view maps ontopublic ImmutableIntList getColumnMapping()
ModifiableView
mapping[i]
contains the column of the underlying table that the
i
th column of the view comes from, or -1 if it is based on an
expression.
getColumnMapping
in interface ModifiableView
public Table getTable()
ModifiableView
getTable
in interface ModifiableView
public Path getTablePath()
ModifiableView
getTablePath
in interface ModifiableView
public <C> C unwrap(java.lang.Class<C> aClass)
Wrapper
unwrap
in interface Wrapper
unwrap
in class AbstractTable
public final ModifiableViewTable extend(java.util.List<RelDataTypeField> extendedColumns, RelDataTypeFactory typeFactory)
The type factory is used to perform some scratch calculations, viz the type mapping, but the "real" row-type will be assigned later, when the table has been bound to the statement's type factory. The is important, because adding types to type factories that do not belong to a statement could potentially leak memory.
extendedColumns
- Extended fieldstypeFactory
- Type factoryprivate static ImmutableIntList getNewColumnMapping(Table underlying, ImmutableIntList oldColumnMapping, java.util.List<RelDataTypeField> extendedColumns, RelDataTypeFactory typeFactory)
protected ModifiableViewTable extend(Table extendedTable, RelProtoDataType protoRowType, ImmutableIntList newColumnMapping)
Copyright © 2012–2019 The Apache Software Foundation. All rights reserved.