|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sf.farrago.fennel.rel.FennelRelUtil
public abstract class FennelRelUtil
Static utilities for FennelRel implementations.
| Constructor Summary | |
|---|---|
FennelRelUtil()
|
|
| Method Summary | |
|---|---|
static void |
addTupleAttrDescriptor(FarragoMetadataFactory repos,
FemTupleDescriptor tupleDesc,
RelDataType type)
Adds a type to a tuple descriptor. |
static FennelBufferRel |
bufferRight(RelNode left,
RelNode right)
Returns a FennelBufferRel in the case where it makes sense to buffer the RHS into the cartesian product join. |
static RexNode |
convertCoordinate(RexBuilder rexBuilder,
SargEndpoint endpoint)
Converts a SargEndpoint into the rex coordinate representation
expected by Fennel BTree searches. |
static RexLiteral |
convertEndpoint(RexBuilder rexBuilder,
SargEndpoint endpoint)
Converts a SargEndpoint into the literal representation for a
lower/upper bound directive expected by Fennel BTree searches. |
static List<RexNode> |
convertIntervalListToTuple(RexBuilder rexBuilder,
List<SargInterval> intervalList)
Converts a list of SargInterval representing intervals on
multiple columns into the directive tuple representation expected by
Fennel BTree searches. |
static RelNode |
convertIntervalTupleToRel(RelTraitSet callTraits,
RelDataType keyRowType,
RelOptCluster cluster,
List<RexNode> tuple)
Converts the tuple representation of a SargInterval into a
relational expression. |
static FennelTupleDescriptor |
convertRowTypeToFennelTupleDesc(RelDataType rowType)
Creates a FennelTupleDescriptor for a RelDataType which is a row. |
static RelNode |
convertSargExpr(RelTraitSet callTraits,
RelDataType keyRowType,
RelOptCluster cluster,
List<SargIntervalSequence> sargSeqList)
Converts a list of SargIntervalSequence into a relational
expression which produces a representation for the sequence of resolved
intervals expected by Fennel BTree searches. |
static RelNode |
convertSargExpr(RelTraitSet callTraits,
RelDataType keyRowType,
RelOptCluster cluster,
SargExpr sargExpr)
Converts a SargExpr into a relational expression which produces a
representation for the sequence of resolved intervals expected by Fennel
BTree searches. |
static String |
convertTuplesToBase64String(RelDataType rowType,
List<List<RexLiteral>> tuples)
Converts a list of a list of RexLiterals representing tuples into
a base-64 encoded string. |
static FemTupleDescriptor |
createTupleDescriptorFromRexNode(FarragoMetadataFactory repos,
List<? extends RexNode> nodeList)
Creates a FemTupleDescriptor from a list of RexNodes representing a row. |
static FemTupleDescriptor |
createTupleDescriptorFromRowType(FarragoRepos repos,
RelDataTypeFactory typeFactory,
RelDataType rowType)
Creates a FemTupleDescriptor for a RelDataType which is a row. |
static FemTupleProjection |
createTupleProjection(FarragoMetadataFactory repos,
Integer[] projection)
Generates a FemTupleProjection from an array of Integers. |
static FemTupleProjection |
createTupleProjection(FarragoMetadataFactory repos,
List<Integer> projection)
Generates a FemTupleProjection from a list of Integers. |
static void |
defineAggStream(List<AggregateCall> aggCalls,
int groupCount,
FarragoRepos repos,
FemAggStreamDef aggStream)
Helper method which sets properties of a FemAggStreamDef. |
static SargIntervalSequence |
evaluateSargExpr(SargExpr sargExpr)
Converts a SargExpr into a SargIntervalSequence. |
static Object |
explainProjection(Integer[] projection)
|
static boolean |
extractSimplePredicates(List<SargBinding> sargBindingList,
List<RexInputRef> filterCols,
List<RexNode> filterOperands,
List<CompOperatorEnum> op)
Extracts from a sargable predicate represented by a SargBinding list the column ordinals and operands in the individual sub-expressions, provided all but one of the filters is a equality predicate. |
static FemTupleAccessor |
getAccessorForTupleDescriptor(FarragoMetadataFactory repos,
FennelDbHandle fennelDbHandle,
FemTupleDescriptor tupleDesc)
Generates a FemTupleAccessor from a FemTupleDescriptor. |
static FarragoPreparingStmt |
getPreparingStmt(RelNode rel)
|
static FarragoPreparingStmt |
getPreparingStmt(RelOptCluster cluster)
|
static FennelRelImplementor |
getRelImplementor(RelNode rel)
Returns the fennel implementor for a given relational expression. |
static FarragoRepos |
getRepos(FennelRel rel)
|
static AggFunction |
lookupAggFunction(AggregateCall call)
Finds the definition of the aggregate function used by a given call. |
static Integer[] |
newBiasedIotaProjection(int n,
int base)
Generates a projection of attribute indices in sequence from (base) to (base + n-1). |
static Integer[] |
newIotaProjection(int n)
Generates a projection of attribute indices in sequence from 0 to n-1. |
private static List<List<SargInterval>> |
pivotSargSeqList(List<SargIntervalSequence> sargSeqList)
Pivots a list of (@link SargIntervalSequence}, with each list element representing the sequence of value intervals corresponding to a column; to a list of SargInterval lists, with each element (a list)
representing the value intervals covering all the columns. |
private static FemTupleAccessor |
tupleDescriptorToAccessor(FarragoMetadataFactory repos,
FemTupleDescriptor tupleDesc)
Converts a FemTupleDescriptor into a FemTupleAccessor
without invoking native methods. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public FennelRelUtil()
| Method Detail |
|---|
public static FemTupleAccessor getAccessorForTupleDescriptor(FarragoMetadataFactory repos,
FennelDbHandle fennelDbHandle,
FemTupleDescriptor tupleDesc)
repos - repos for storing transient objectsfennelDbHandle - handle to Fennel database being accessedtupleDesc - source FemTupleDescriptor
private static FemTupleAccessor tupleDescriptorToAccessor(FarragoMetadataFactory repos,
FemTupleDescriptor tupleDesc)
FemTupleDescriptor into a FemTupleAccessor
without invoking native methods.
public static FemTupleDescriptor createTupleDescriptorFromRowType(FarragoRepos repos,
RelDataTypeFactory typeFactory,
RelDataType rowType)
repos - repos storing object definitionsrowType - row type descriptor
public static FemTupleDescriptor createTupleDescriptorFromRexNode(FarragoMetadataFactory repos,
List<? extends RexNode> nodeList)
repos - repos storing object definitionsnodeList - List of RexNodes
public static FemTupleProjection createTupleProjection(FarragoMetadataFactory repos,
Integer[] projection)
repos - the repos for storing transient objectsprojection - the projection to generate
public static FemTupleProjection createTupleProjection(FarragoMetadataFactory repos,
List<Integer> projection)
repos - the repos for storing transient objectsprojection - the projection to generate
public static Integer[] newIotaProjection(int n)
n - length of array to generate
public static Integer[] newBiasedIotaProjection(int n,
int base)
n - length of array to generatebase - first value to generate
public static void addTupleAttrDescriptor(FarragoMetadataFactory repos,
FemTupleDescriptor tupleDesc,
RelDataType type)
repos - Repository/metadata factorytupleDesc - Tuple descriptortype - Type to be adedpublic static FennelTupleDescriptor convertRowTypeToFennelTupleDesc(RelDataType rowType)
rowType - row type descriptor
public static Object explainProjection(Integer[] projection)
public static FarragoPreparingStmt getPreparingStmt(RelNode rel)
rel - the relational expression
public static FarragoPreparingStmt getPreparingStmt(RelOptCluster cluster)
cluster - the cluster
public static FarragoRepos getRepos(FennelRel rel)
public static SargIntervalSequence evaluateSargExpr(SargExpr sargExpr)
SargExpr into a SargIntervalSequence.
sargExpr - expression to be oncverted
private static List<List<SargInterval>> pivotSargSeqList(List<SargIntervalSequence> sargSeqList)
SargInterval lists, with each element (a list)
representing the value intervals covering all the columns. e.g. for the
following predicates
a = 2
b = 3
1 < c <= 4, c > 10
The input looks like
{([, 2, ], 2)}
{([, 3, ], 3)}
{((, 1, ], 4), ((, 10, +, null)}
The output will be
{([, 2, ], 2), ([, 3, ], 3), ((, 1, ], 4)}
{([, 2, ], 2), ([, 3, ], 3), ((, 10, ), +)}
NOTE
sargSeqList - list of SargIntervalSequence representing the
expression to be converted
SargInterval lists.
public static RelNode convertSargExpr(RelTraitSet callTraits,
RelDataType keyRowType,
RelOptCluster cluster,
List<SargIntervalSequence> sargSeqList)
SargIntervalSequence into a relational
expression which produces a representation for the sequence of resolved
intervals expected by Fennel BTree searches.
callTraits - traits to apply to new rels generatedkeyRowType - input row type expected by BTree searchcluster - query clustersargSeqList - list of SargIntervalSequence representing the
expression to be converted
public static RelNode convertSargExpr(RelTraitSet callTraits,
RelDataType keyRowType,
RelOptCluster cluster,
SargExpr sargExpr)
SargExpr into a relational expression which produces a
representation for the sequence of resolved intervals expected by Fennel
BTree searches.
callTraits - traits to apply to new rels generatedkeyRowType - input row type expected by BTree searchcluster - query clustersargExpr - expression to be converted
public static List<RexNode> convertIntervalListToTuple(RexBuilder rexBuilder,
List<SargInterval> intervalList)
SargInterval representing intervals on
multiple columns into the directive tuple representation expected by
Fennel BTree searches.
rexBuilder - builder for tuple valuesintervalList - intervalList to be converted
public static RelNode convertIntervalTupleToRel(RelTraitSet callTraits,
RelDataType keyRowType,
RelOptCluster cluster,
List<RexNode> tuple)
SargInterval into a
relational expression.
callTraits - traits to apply to new rels generatedkeyRowType - input row type expected by BTree searchcluster - query clustertuple - tuple to be converted
public static RexLiteral convertEndpoint(RexBuilder rexBuilder,
SargEndpoint endpoint)
SargEndpoint into the literal representation for a
lower/upper bound directive expected by Fennel BTree searches.
rexBuilder - builder for rex expressionsendpoint - endpoint to be converted
public static RexNode convertCoordinate(RexBuilder rexBuilder,
SargEndpoint endpoint)
SargEndpoint into the rex coordinate representation
expected by Fennel BTree searches.
rexBuilder - builder for rex expressionsendpoint - endpoint to be converted
public static FennelRelImplementor getRelImplementor(RelNode rel)
rel - Relational expression
public static String convertTuplesToBase64String(RelDataType rowType,
List<List<RexLiteral>> tuples)
RexLiterals representing tuples into
a base-64 encoded string.
rowType - the row type of the tuplestuples - the tuples
public static boolean extractSimplePredicates(List<SargBinding> sargBindingList,
List<RexInputRef> filterCols,
List<RexNode> filterOperands,
List<CompOperatorEnum> op)
sargBindingList - filter represented as a SargBinding listfilterCols - returns the list of filter columns in the expressionfilterOperands - returns the list of expressions that the filter
columns are compared toop - returns COMP_EQ if the predicates are all equality; otherwise,
returns the value of the one non-equality predicate
public static FennelBufferRel bufferRight(RelNode left,
RelNode right)
left - left hand input into the cartesian joinright - right hand input into the cartesian join
public static void defineAggStream(List<AggregateCall> aggCalls,
int groupCount,
FarragoRepos repos,
FemAggStreamDef aggStream)
FemAggStreamDef.
aggCalls - List of calls to aggregate functionsgroupCount - Number of grouping columns =repos - RepositoryaggStream - Agg stream to configurepublic static AggFunction lookupAggFunction(AggregateCall call)
call - Call
IllegalArgumentException - if aggregate is not one of the builtins
supported by Fennel
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||