|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.farrago.namespace.ftrs.FtrsIndexGuide
class FtrsIndexGuide
FtrsIndexGuide provides information about the mapping from catalog definitions for tables and indexes to their Fennel representation.
Examples in the comments refer to the test tables EMPS and DEPTS defined
in farrago/initsql/createSalesSchema.sql
. For an overview and
terminology, please see the design docs.
Field Summary | |
---|---|
private RelDataType |
flattenedRowType
|
private int[] |
flatteningMap
|
private FarragoRepos |
repos
|
private CwmColumnSet |
table
|
private FarragoTypeFactory |
typeFactory
|
private RelDataType |
unflattenedRowType
|
Constructor Summary | |
---|---|
FtrsIndexGuide(FarragoTypeFactory typeFactory,
CwmColumnSet table)
|
Method Summary | |
---|---|
private void |
appendClusteredDistinctKey(FemLocalIndex clusteredIndex,
List<FemAbstractColumn> indexColumnList)
|
private void |
appendConstraintColumns(List<FemAbstractColumn> list,
FemAbstractUniqueConstraint constraint)
|
private void |
appendDefinedKey(List<FemAbstractColumn> list,
FemLocalIndex index)
|
(package private) FemTupleProjection |
createTupleProjectionFromColumnList(List<FemAbstractColumn> indexColumnList)
Generates a FemTupleProjection from a list of CWM columns. |
private int |
flattenOrdinal(int columnOrdinal)
Converts from unflattened 0-based logical column ordinal to 0-based flattened tuple ordinal (as known by Fennel). |
private FemTupleDescriptor |
getClusteredCoverageTupleDescriptor()
|
(package private) Integer[] |
getClusteredDistinctKeyArray(FemLocalIndex index)
Gets the distinct key of a clustered index. |
(package private) Integer[] |
getCollationKeyArray(FemLocalIndex index)
Gets the collation key of an index. |
(package private) FemTupleProjection |
getCoverageProjection(FemLocalIndex index)
Creates a FemTupleProjection which specifies how to extract the index coverage tuple from a full table tuple. |
(package private) FemTupleDescriptor |
getCoverageTupleDescriptor(FemLocalIndex index)
Creates a FemTupleDescriptor for the coverage tuple of an index. |
(package private) List<? extends Object> |
getDistinctKeyColList(FemLocalIndex index)
|
(package private) FemTupleProjection |
getDistinctKeyProjection(FemLocalIndex index)
Gets a FemTupleProjection which specifies how to extract the distinct key from the result of getCoverageTupleDescriptor. |
RelDataType |
getFlattenedRowType()
|
(package private) Integer[] |
getUnclusteredCoverageArray(FemLocalIndex index)
Same as getUnclusteredCoverageColList, but returns flattened column ordinals instead. |
(package private) List<FemAbstractColumn> |
getUnclusteredCoverageColList(FemLocalIndex index)
Gets a list of columns covered by an unclustered index. |
private FemTupleDescriptor |
getUnclusteredCoverageTupleDescriptor(FemLocalIndex index)
|
FemIndexWriterDef |
newIndexWriter(FennelRel rel,
FemLocalIndex index)
Creates a new physical writer definition for a particular index, initializing any invariant information. |
int |
unFlattenOrdinal(int fieldOrdinal)
Returns the unflattened column ordinal corresponding to a flattened field ordinal |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private FarragoTypeFactory typeFactory
private FarragoRepos repos
private CwmColumnSet table
private RelDataType unflattenedRowType
private RelDataType flattenedRowType
private int[] flatteningMap
Constructor Detail |
---|
FtrsIndexGuide(FarragoTypeFactory typeFactory, CwmColumnSet table)
Method Detail |
---|
public RelDataType getFlattenedRowType()
List<FemAbstractColumn> getUnclusteredCoverageColList(FemLocalIndex index)
Example: for index EMPS_UX, the result is [ NAME, DEPTNO, EMPNO ]
index
- index for which to compute column list
Integer[] getUnclusteredCoverageArray(FemLocalIndex index)
Example: for index EMPS_UX, the result is [ 1, 2, 0 ]
index
- index for which to compute projection
Integer[] getClusteredDistinctKeyArray(FemLocalIndex index)
Example: for the clustered index on table EMPS, the result is [ 2, 0 ]. But if the clustered index were defined as non-unique on column city instead, then the result would be [ 4, 2, 0 ]. For a non-unique clustered index on empno, the result would be [ 0, 2 ].
index
- the FemLocalIndex for which the key is to be projected
List<? extends Object> getDistinctKeyColList(FemLocalIndex index)
Integer[] getCollationKeyArray(FemLocalIndex index)
Example: for index DEPTS_UNIQUE_NAME, the result is [ 1, 0 ]
index
- index for which to compute projection
FemTupleProjection getDistinctKeyProjection(FemLocalIndex index)
Example: for the clustered index of table EMPS, the result is [ 2, 0 ]. For index DEPTS_UNIQUE_NAME, the result is [ 0 ]. For index EMPS_UX, the result is [ 0, 1, 2 ].
index
- the FemLocalIndex for which the key is to be projected
FemTupleDescriptor getCoverageTupleDescriptor(FemLocalIndex index)
index
- the FemLocalIndex to be described
FemTupleProjection getCoverageProjection(FemLocalIndex index)
Example: for the clustered index of table EMPS, the result is [ 0, 1, 2, 3, 4, 5 ]. For index DEPTS_UNIQUE_NAME, the result is [ 1, 0 ].
index
- the FemLocalIndex for which the tuple is to be projected
FemTupleProjection createTupleProjectionFromColumnList(List<FemAbstractColumn> indexColumnList)
indexColumnList
- list of columns
public FemIndexWriterDef newIndexWriter(FennelRel rel, FemLocalIndex index)
rel
- relational expression modifying the indexindex
- the index of interest
private void appendConstraintColumns(List<FemAbstractColumn> list, FemAbstractUniqueConstraint constraint)
private void appendDefinedKey(List<FemAbstractColumn> list, FemLocalIndex index)
private void appendClusteredDistinctKey(FemLocalIndex clusteredIndex, List<FemAbstractColumn> indexColumnList)
private FemTupleDescriptor getClusteredCoverageTupleDescriptor()
private FemTupleDescriptor getUnclusteredCoverageTupleDescriptor(FemLocalIndex index)
private int flattenOrdinal(int columnOrdinal)
create type pencil (
outer_radius_mm double,
lead_radius_mm double,
length_mm double,
has_eraser boolean
);
create table pencil_case(
id int not null primary key,
p pencil not null,
crayon_count int);
The corresponding flattened ordinals would be 0 for id
, 1
for p
, 5 for crayon_count
. The gap corresponds
to the fact that the pencil
column has four fields, after
which comes crayon_count
.
columnOrdinal
- logical column ordinal; e.g. 0 for id
,
1 for p
, 2 for crayon_count
public int unFlattenOrdinal(int fieldOrdinal)
fieldOrdinal
- flattened ordinal
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |