Package org.apache.calcite.tools
Class PigRelBuilder
java.lang.Object
org.apache.calcite.tools.RelBuilder
org.apache.calcite.tools.PigRelBuilder
Extension to
RelBuilder
for Pig relational operators.-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Option for performing group efficiently if data set is already sorted.Nested classes/interfaces inherited from class org.apache.calcite.tools.RelBuilder
RelBuilder.AggCall, RelBuilder.Config, RelBuilder.GroupKey, RelBuilder.OverCall
-
Field Summary
Fields inherited from class org.apache.calcite.tools.RelBuilder
cluster, relOptSchema
-
Constructor Summary
ModifierConstructorDescriptionprotected
PigRelBuilder
(Context context, RelOptCluster cluster, @Nullable RelOptSchema relOptSchema) -
Method Summary
Modifier and TypeMethodDescriptionAs super-class method, but also retains alias for naming of aggregates.static PigRelBuilder
create
(FrameworkConfig config) Creates a PigRelBuilder.distinct
(@Nullable org.apache.calcite.tools.PigRelBuilder.Partitioner partitioner, int parallel) Removes duplicate tuples in a relation.@Nullable String
getAlias()
group
(PigRelBuilder.GroupOption option, @Nullable org.apache.calcite.tools.PigRelBuilder.Partitioner partitioner, int parallel, Iterable<? extends RelBuilder.GroupKey> groupKeys) group
(PigRelBuilder.GroupOption option, @Nullable org.apache.calcite.tools.PigRelBuilder.Partitioner partitioner, int parallel, RelBuilder.GroupKey... groupKeys) Groups the data in one or more relations.load
(String path, RexNode loadFunction, RelDataType rowType) Loads a data set.Creates aTableScan
of the table with a given name.Creates aTableScan
of the table with a given name.protected void
validateGroupList
(List<RelBuilder.GroupKey> groupKeyList) Methods inherited from class org.apache.calcite.tools.RelBuilder
adoptConvention, aggregate, aggregate, aggregate, aggregateCall, aggregateCall, aggregateCall, aggregateCall, aggregateCall, aggregateCall, aggregateCall, aggregateCall, aggregateCall, aggregateCall, aggregateCall, aggregateCall, aggregateRex, aggregateRex, alias, all, and, and, antiJoin, antiJoin, arrayQuery, asofJoin, avg, avg, avg, avg, between, build, call, call, cast, cast, cast, cast, cast, cast, clear, convert, correlate, correlate, count, count, count, count, countStar, currentRow, cursor, desc, distinct, dot, dot, empty, equals, exchange, exists, field, field, field, field, field, field, field, field, fields, fields, fields, fields, fields, fields, fields, filter, filter, filter, filter, following, functionScan, functionScan, getCluster, getRelOptSchema, getRexBuilder, getScanFactory, getTypeFactory, greaterThan, greaterThanOrEqual, groupKey, groupKey, groupKey, groupKey, groupKey, groupKey, groupKey, groupKey, groupKey, groupKey, hints, hints, in, in, in, in, intersect, intersect, isDistinctFrom, isNotDistinctFrom, isNotNull, isNull, join, join, join, join, join, lessThan, lessThanOrEqual, let, limit, literal, literalAgg, mapQuery, match, max, max, min, min, minus, minus, multisetQuery, not, notEquals, nullsFirst, nullsLast, or, or, patternAlter, patternAlter, patternConcat, patternConcat, patternExclude, patternField, patternPermute, patternPermute, patternQuantify, patternQuantify, peek, peek, peek, permute, pivot, preceding, project, project, project, project, project, projectExcept, projectExcept, projectNamed, projectNamed, projectPlus, projectPlus, proto, proto, push, pushAll, rename, repeatUnion, repeatUnion, sample, scalarQuery, semiJoin, semiJoin, size, snapshot, some, sort, sort, sort, sort, sortExchange, sortLimit, sortLimit, sortLimit, sum, sum, sum, sum, toString, transform, transientScan, transientScan, unboundedFollowing, unboundedPreceding, uncollect, union, union, unique, unpivot, values, values, values, values, variable, variable, with, withPredicates, withSimplifier
-
Constructor Details
-
PigRelBuilder
protected PigRelBuilder(Context context, RelOptCluster cluster, @Nullable RelOptSchema relOptSchema)
-
-
Method Details
-
create
Creates a PigRelBuilder. -
scan
Description copied from class:RelBuilder
Creates aTableScan
of the table with a given name.Throws if the table does not exist.
Returns this builder.
- Overrides:
scan
in classRelBuilder
- Parameters:
tableNames
- Name of table (can optionally be qualified)
-
scan
Description copied from class:RelBuilder
Creates aTableScan
of the table with a given name.Throws if the table does not exist.
Returns this builder.
- Overrides:
scan
in classRelBuilder
- Parameters:
tableNames
- Name of table (can optionally be qualified)
-
load
Loads a data set.Equivalent to Pig Latin:
LOAD 'path' USING loadFunction AS rowType
loadFunction
androwType
are optional.- Parameters:
path
- File pathloadFunction
- Load functionrowType
- Row type (what Pig calls 'schema')- Returns:
- This builder
-
distinct
public PigRelBuilder distinct(@Nullable org.apache.calcite.tools.PigRelBuilder.Partitioner partitioner, int parallel) Removes duplicate tuples in a relation.Equivalent Pig Latin:
alias = DISTINCT alias [PARTITION BY partitioner] [PARALLEL n];
- Parameters:
partitioner
- Partitioner; null means no partitionerparallel
- Degree of parallelism; negative means unspecified- Returns:
- This builder
-
group
public PigRelBuilder group(PigRelBuilder.GroupOption option, @Nullable org.apache.calcite.tools.PigRelBuilder.Partitioner partitioner, int parallel, RelBuilder.GroupKey... groupKeys) Groups the data in one or more relations.Pig Latin syntax:
alias = GROUP alias { ALL | BY expression } [, alias ALL | BY expression ...] [USING 'collected' | 'merge'] [PARTITION BY partitioner] [PARALLEL n];
- Parameters:
option
- Whether to use an optimized method combining the data (COLLECTED for one input or MERGE for two or more inputs)partitioner
- Partitioner; null means no partitionerparallel
- Degree of parallelism; negative means unspecifiedgroupKeys
- One of more group keys; useRelBuilder.groupKey()
for ALL- Returns:
- This builder
-
group
public PigRelBuilder group(PigRelBuilder.GroupOption option, @Nullable org.apache.calcite.tools.PigRelBuilder.Partitioner partitioner, int parallel, Iterable<? extends RelBuilder.GroupKey> groupKeys) -
validateGroupList
-
getAlias
-
as
As super-class method, but also retains alias for naming of aggregates.- Overrides:
as
in classRelBuilder
-