public class HiveSubQRemoveRelBuilder extends Object
RelBuilder
does not make possible anything that you could not
also accomplish by calling the factory methods of the particular relational
expression. But it makes common tasks more straightforward and concise.
RelBuilder
uses factories to create relational expressions.
By default, it uses the default factories, which create logical relational
expressions (LogicalFilter
,
LogicalProject
and so forth).
But you could override those factories so that, say, filter
creates
instead a HiveFilter
.
It is not thread-safe.
Modifier and Type | Class and Description |
---|---|
static interface |
HiveSubQRemoveRelBuilder.AggCall
Information necessary to create a call to an aggregate function.
|
static interface |
HiveSubQRemoveRelBuilder.GroupKey
Information necessary to create the GROUP BY clause of an Aggregate.
|
protected static class |
HiveSubQRemoveRelBuilder.GroupKeyImpl
Implementation of
RelBuilder.GroupKey . |
Modifier and Type | Field and Description |
---|---|
protected org.apache.calcite.plan.RelOptCluster |
cluster |
protected org.apache.calcite.plan.RelOptSchema |
relOptSchema |
Constructor and Description |
---|
HiveSubQRemoveRelBuilder(org.apache.calcite.plan.Context context,
org.apache.calcite.plan.RelOptCluster cluster,
org.apache.calcite.plan.RelOptSchema relOptSchema) |
Modifier and Type | Method and Description |
---|---|
HiveSubQRemoveRelBuilder |
aggregate(HiveSubQRemoveRelBuilder.GroupKey groupKey,
HiveSubQRemoveRelBuilder.AggCall... aggCalls)
Creates an
Aggregate with an array of
calls. |
HiveSubQRemoveRelBuilder |
aggregate(HiveSubQRemoveRelBuilder.GroupKey groupKey,
Iterable<HiveSubQRemoveRelBuilder.AggCall> aggCalls)
Creates an
Aggregate with a list of
calls. |
HiveSubQRemoveRelBuilder |
aggregate(HiveSubQRemoveRelBuilder.GroupKey groupKey,
List<org.apache.calcite.rel.core.AggregateCall> aggregateCalls) |
HiveSubQRemoveRelBuilder.AggCall |
aggregateCall(org.apache.calcite.sql.SqlAggFunction aggFunction,
boolean distinct,
org.apache.calcite.rex.RexNode filter,
String alias,
Iterable<? extends org.apache.calcite.rex.RexNode> operands)
Creates a call to an aggregate function.
|
HiveSubQRemoveRelBuilder.AggCall |
aggregateCall(org.apache.calcite.sql.SqlAggFunction aggFunction,
boolean distinct,
org.apache.calcite.rex.RexNode filter,
String alias,
org.apache.calcite.rex.RexNode... operands)
Creates a call to an aggregate function.
|
org.apache.calcite.rex.RexNode |
alias(org.apache.calcite.rex.RexNode expr,
String alias)
Returns an expression wrapped in an alias.
|
org.apache.calcite.rex.RexNode |
and(Iterable<? extends org.apache.calcite.rex.RexNode> operands)
Creates an AND.
|
org.apache.calcite.rex.RexNode |
and(org.apache.calcite.rex.RexNode... operands)
Creates an AND.
|
HiveSubQRemoveRelBuilder |
as(String alias)
Assigns a table alias to the top entry on the stack.
|
HiveSubQRemoveRelBuilder.AggCall |
avg(boolean distinct,
String alias,
org.apache.calcite.rex.RexNode operand)
Creates a call to the AVG aggregate function.
|
org.apache.calcite.rel.RelNode |
build()
Returns the final relational expression.
|
org.apache.calcite.rex.RexNode |
call(org.apache.calcite.sql.SqlOperator operator,
Iterable<? extends org.apache.calcite.rex.RexNode> operands)
Creates a call to a scalar operator.
|
org.apache.calcite.rex.RexNode |
call(org.apache.calcite.sql.SqlOperator operator,
org.apache.calcite.rex.RexNode... operands)
Creates a call to a scalar operator.
|
org.apache.calcite.rex.RexNode |
cast(org.apache.calcite.rex.RexNode expr,
org.apache.calcite.sql.type.SqlTypeName typeName)
Creates an expression that casts an expression to a given type.
|
org.apache.calcite.rex.RexNode |
cast(org.apache.calcite.rex.RexNode expr,
org.apache.calcite.sql.type.SqlTypeName typeName,
int precision)
Creates an expression that casts an expression to a type with a given name
and precision or length.
|
org.apache.calcite.rex.RexNode |
cast(org.apache.calcite.rex.RexNode expr,
org.apache.calcite.sql.type.SqlTypeName typeName,
int precision,
int scale)
Creates an expression that casts an expression to a type with a given
name, precision and scale.
|
void |
clear()
Clears the stack.
|
HiveSubQRemoveRelBuilder |
convert(org.apache.calcite.rel.type.RelDataType castRowType,
boolean rename)
Creates a projection that converts the current relational expression's
output to a desired row type.
|
HiveSubQRemoveRelBuilder.AggCall |
count(boolean distinct,
String alias,
org.apache.calcite.rex.RexNode... operands)
Creates a call to the COUNT aggregate function.
|
HiveSubQRemoveRelBuilder.AggCall |
countStar(String alias)
Creates a call to the COUNT(*) aggregate function.
|
static HiveSubQRemoveRelBuilder |
create(org.apache.calcite.tools.FrameworkConfig config)
Creates a RelBuilder.
|
org.apache.calcite.rex.RexNode |
desc(org.apache.calcite.rex.RexNode node)
Converts a sort expression to descending.
|
HiveSubQRemoveRelBuilder |
distinct()
Creates an
Aggregate that makes the
relational expression distinct on all fields. |
org.apache.calcite.rex.RexNode |
dot(org.apache.calcite.rex.RexNode node,
int fieldOrdinal)
Creates an access to a field by ordinal.
|
org.apache.calcite.rex.RexNode |
dot(org.apache.calcite.rex.RexNode node,
String fieldName)
Creates an access to a field by name.
|
HiveSubQRemoveRelBuilder |
empty()
Empty relationship can be expressed in many different ways, e.g.,
filter(cond=false), empty LogicalValues(), etc.
|
org.apache.calcite.rex.RexNode |
equals(org.apache.calcite.rex.RexNode operand0,
org.apache.calcite.rex.RexNode operand1)
Creates an =.
|
org.apache.calcite.rex.RexInputRef |
field(int fieldOrdinal)
Creates a reference to an input field by ordinal.
|
org.apache.calcite.rex.RexInputRef |
field(int inputCount,
int inputOrdinal,
int fieldOrdinal)
Creates a reference to a field of a given input relational expression
by ordinal.
|
org.apache.calcite.rex.RexInputRef |
field(int inputCount,
int inputOrdinal,
String fieldName)
Creates a reference to a field of given input relational expression
by name.
|
org.apache.calcite.rex.RexNode |
field(org.apache.calcite.rex.RexNode e,
String name)
Returns a reference to a given field of a record-valued expression.
|
org.apache.calcite.rex.RexInputRef |
field(String fieldName)
Creates a reference to a field by name.
|
org.apache.calcite.rex.RexNode |
field(String alias,
String fieldName)
Creates a reference to a field of the current record which originated
in a relation with a given alias.
|
com.google.common.collect.ImmutableList<org.apache.calcite.rex.RexNode> |
fields()
Returns references to the fields of the top input.
|
com.google.common.collect.ImmutableList<org.apache.calcite.rex.RexNode> |
fields(int inputCount,
int inputOrdinal)
Returns references to the fields of a given input.
|
com.google.common.collect.ImmutableList<org.apache.calcite.rex.RexNode> |
fields(Iterable<String> fieldNames)
Returns references to fields identified by name.
|
com.google.common.collect.ImmutableList<org.apache.calcite.rex.RexNode> |
fields(List<? extends Number> ordinals)
Returns references to fields for a given list of input ordinals.
|
com.google.common.collect.ImmutableList<org.apache.calcite.rex.RexNode> |
fields(org.apache.calcite.util.mapping.Mappings.TargetMapping mapping)
Returns references to fields identified by a mapping.
|
com.google.common.collect.ImmutableList<org.apache.calcite.rex.RexNode> |
fields(org.apache.calcite.rel.RelCollation collation)
Returns references to fields for a given collation.
|
HiveSubQRemoveRelBuilder |
filter(Iterable<? extends org.apache.calcite.rex.RexNode> predicates)
Creates a
Filter of a list of
predicates. |
HiveSubQRemoveRelBuilder |
filter(org.apache.calcite.rex.RexNode... predicates)
Creates a
Filter of an array of
predicates. |
protected String |
getAlias() |
org.apache.calcite.rex.RexBuilder |
getRexBuilder()
Returns the builder for
RexNode expressions. |
org.apache.calcite.rel.type.RelDataTypeFactory |
getTypeFactory()
Returns the type factory.
|
HiveSubQRemoveRelBuilder.GroupKey |
groupKey()
Creates an empty group key.
|
HiveSubQRemoveRelBuilder.GroupKey |
groupKey(org.apache.calcite.util.ImmutableBitSet groupSet,
boolean indicator,
com.google.common.collect.ImmutableList<org.apache.calcite.util.ImmutableBitSet> groupSets)
Creates a group key with grouping sets, both identified by field positions
in the underlying relational expression.
|
HiveSubQRemoveRelBuilder.GroupKey |
groupKey(int... fieldOrdinals)
Creates a group key of fields identified by ordinal.
|
HiveSubQRemoveRelBuilder.GroupKey |
groupKey(Iterable<? extends org.apache.calcite.rex.RexNode> nodes)
Creates a group key.
|
HiveSubQRemoveRelBuilder.GroupKey |
groupKey(Iterable<? extends org.apache.calcite.rex.RexNode> nodes,
boolean indicator,
Iterable<? extends Iterable<? extends org.apache.calcite.rex.RexNode>> nodeLists)
Creates a group key with grouping sets.
|
HiveSubQRemoveRelBuilder.GroupKey |
groupKey(org.apache.calcite.rex.RexNode... nodes)
Creates a group key.
|
HiveSubQRemoveRelBuilder.GroupKey |
groupKey(String... fieldNames)
Creates a group key of fields identified by name.
|
HiveSubQRemoveRelBuilder |
intersect(boolean all)
Creates an
Intersect of the two most
recent relational expressions on the stack. |
HiveSubQRemoveRelBuilder |
intersect(boolean all,
int n)
Creates an
Intersect of the n
most recent relational expressions on the stack. |
org.apache.calcite.rex.RexNode |
isNotNull(org.apache.calcite.rex.RexNode operand)
Creates a IS NOT NULL.
|
org.apache.calcite.rex.RexNode |
isNull(org.apache.calcite.rex.RexNode operand)
Creates a IS NULL.
|
HiveSubQRemoveRelBuilder |
join(org.apache.calcite.rel.core.JoinRelType joinType,
Iterable<? extends org.apache.calcite.rex.RexNode> conditions)
Creates a
Join with multiple
conditions. |
HiveSubQRemoveRelBuilder |
join(org.apache.calcite.rel.core.JoinRelType joinType,
org.apache.calcite.rex.RexNode condition) |
HiveSubQRemoveRelBuilder |
join(org.apache.calcite.rel.core.JoinRelType joinType,
org.apache.calcite.rex.RexNode condition0,
org.apache.calcite.rex.RexNode... conditions)
Creates a
Join . |
HiveSubQRemoveRelBuilder |
join(org.apache.calcite.rel.core.JoinRelType joinType,
org.apache.calcite.rex.RexNode condition,
Set<org.apache.calcite.rel.core.CorrelationId> variablesSet)
Creates a
Join with correlating
variables. |
HiveSubQRemoveRelBuilder |
join(org.apache.calcite.rel.core.JoinRelType joinType,
String... fieldNames)
Creates a
Join using USING syntax. |
HiveSubQRemoveRelBuilder |
limit(int offset,
int fetch)
Creates a limit without a sort.
|
org.apache.calcite.rex.RexNode |
literal(Object value)
Creates a literal (constant expression).
|
HiveSubQRemoveRelBuilder.AggCall |
max(String alias,
org.apache.calcite.rex.RexNode operand)
Creates a call to the MAX aggregate function.
|
HiveSubQRemoveRelBuilder.AggCall |
min(String alias,
org.apache.calcite.rex.RexNode operand)
Creates a call to the MIN aggregate function.
|
HiveSubQRemoveRelBuilder |
minus(boolean all)
Creates a
Minus of the two most recent
relational expressions on the stack. |
HiveSubQRemoveRelBuilder |
minus(boolean all,
int n)
Creates a
Minus of the n
most recent relational expressions on the stack. |
org.apache.calcite.rex.RexNode |
not(org.apache.calcite.rex.RexNode operand)
Creates a NOT.
|
org.apache.calcite.rex.RexNode |
nullsFirst(org.apache.calcite.rex.RexNode node)
Converts a sort expression to nulls first.
|
org.apache.calcite.rex.RexNode |
nullsLast(org.apache.calcite.rex.RexNode node)
Converts a sort expression to nulls last.
|
org.apache.calcite.rex.RexNode |
or(Iterable<? extends org.apache.calcite.rex.RexNode> operands)
Creates an OR.
|
org.apache.calcite.rex.RexNode |
or(org.apache.calcite.rex.RexNode... operands)
Creates an OR.
|
org.apache.calcite.rel.RelNode |
peek()
Returns the relational expression at the top of the stack, but does not
remove it.
|
org.apache.calcite.rel.RelNode |
peek(int n)
Returns the relational expression
n positions from the top of the
stack, but does not remove it. |
org.apache.calcite.rel.RelNode |
peek(int inputCount,
int inputOrdinal)
Returns the relational expression
n positions from the top of the
stack, but does not remove it. |
HiveSubQRemoveRelBuilder |
permute(org.apache.calcite.util.mapping.Mapping mapping) |
HiveSubQRemoveRelBuilder |
project(Iterable<? extends org.apache.calcite.rex.RexNode> nodes)
Creates a
Project of the given list
of expressions. |
HiveSubQRemoveRelBuilder |
project(Iterable<? extends org.apache.calcite.rex.RexNode> nodes,
Iterable<String> fieldNames)
Creates a
Project of the given list
of expressions and field names. |
HiveSubQRemoveRelBuilder |
project(Iterable<? extends org.apache.calcite.rex.RexNode> nodes,
Iterable<String> fieldNames,
boolean force)
Creates a
Project of the given list
of expressions, using the given names. |
HiveSubQRemoveRelBuilder |
project(org.apache.calcite.rex.RexNode... nodes)
Creates a
Project of the given
expressions. |
HiveSubQRemoveRelBuilder |
push(org.apache.calcite.rel.RelNode node)
Adds a relational expression to be the input to the next relational
expression constructed.
|
HiveSubQRemoveRelBuilder |
pushAll(Iterable<? extends org.apache.calcite.rel.RelNode> nodes)
Pushes a collection of relational expressions.
|
HiveSubQRemoveRelBuilder |
scan(Iterable<String> tableNames)
Creates a
TableScan of the table
with a given name. |
HiveSubQRemoveRelBuilder |
scan(String... tableNames)
Creates a
TableScan of the table
with a given name. |
HiveSubQRemoveRelBuilder |
semiJoin(Iterable<? extends org.apache.calcite.rex.RexNode> conditions)
Creates a
SemiJoin . |
HiveSubQRemoveRelBuilder |
semiJoin(org.apache.calcite.rex.RexNode... conditions)
Creates a
SemiJoin . |
HiveSubQRemoveRelBuilder |
sort(int... fields)
Creates a
Sort by field ordinals. |
HiveSubQRemoveRelBuilder |
sort(Iterable<? extends org.apache.calcite.rex.RexNode> nodes)
Creates a
Sort by expressions. |
HiveSubQRemoveRelBuilder |
sort(org.apache.calcite.rex.RexNode... nodes)
Creates a
Sort by expressions. |
HiveSubQRemoveRelBuilder |
sortLimit(int offset,
int fetch,
Iterable<? extends org.apache.calcite.rex.RexNode> nodes)
Creates a
Sort by a list of expressions, with limit and offset. |
HiveSubQRemoveRelBuilder |
sortLimit(int offset,
int fetch,
org.apache.calcite.rex.RexNode... nodes)
Creates a
Sort by expressions, with limit and offset. |
HiveSubQRemoveRelBuilder.AggCall |
sum(boolean distinct,
String alias,
org.apache.calcite.rex.RexNode operand)
Creates a call to the SUM aggregate function.
|
HiveSubQRemoveRelBuilder |
union(boolean all)
Creates a
Union of the two most recent
relational expressions on the stack. |
HiveSubQRemoveRelBuilder |
union(boolean all,
int n)
Creates a
Union of the n
most recent relational expressions on the stack. |
HiveSubQRemoveRelBuilder |
values(Iterable<? extends List<org.apache.calcite.rex.RexLiteral>> tupleList,
org.apache.calcite.rel.type.RelDataType rowType)
Creates a
Values with a specified row type. |
HiveSubQRemoveRelBuilder |
values(org.apache.calcite.rel.type.RelDataType rowType)
Creates a
Values with a specified row type and
zero rows. |
HiveSubQRemoveRelBuilder |
values(org.apache.calcite.rel.type.RelDataType rowType,
Object... columnValues)
Creates a
Values with a specified row type. |
HiveSubQRemoveRelBuilder |
values(String[] fieldNames,
Object... values)
Creates a
Values . |
HiveSubQRemoveRelBuilder |
variable(org.apache.calcite.util.Holder<org.apache.calcite.rex.RexCorrelVariable> v)
Creates a correlation variable for the current input, and writes it into
a Holder.
|
protected final org.apache.calcite.plan.RelOptCluster cluster
protected final org.apache.calcite.plan.RelOptSchema relOptSchema
public HiveSubQRemoveRelBuilder(org.apache.calcite.plan.Context context, org.apache.calcite.plan.RelOptCluster cluster, org.apache.calcite.plan.RelOptSchema relOptSchema)
public static HiveSubQRemoveRelBuilder create(org.apache.calcite.tools.FrameworkConfig config)
public org.apache.calcite.rel.type.RelDataTypeFactory getTypeFactory()
public org.apache.calcite.rex.RexBuilder getRexBuilder()
RexNode
expressions.public HiveSubQRemoveRelBuilder push(org.apache.calcite.rel.RelNode node)
This method is usual when you want to weave in relational expressions
that are not supported by the builder. If, while creating such expressions,
you need to use previously built expressions as inputs, call
build()
to pop those inputs.
public HiveSubQRemoveRelBuilder pushAll(Iterable<? extends org.apache.calcite.rel.RelNode> nodes)
public org.apache.calcite.rel.RelNode build()
Throws if the stack is empty.
public org.apache.calcite.rel.RelNode peek()
public org.apache.calcite.rel.RelNode peek(int n)
n
positions from the top of the
stack, but does not remove it.public org.apache.calcite.rel.RelNode peek(int inputCount, int inputOrdinal)
n
positions from the top of the
stack, but does not remove it.public org.apache.calcite.rex.RexNode literal(Object value)
public org.apache.calcite.rex.RexInputRef field(String fieldName)
Equivalent to field(1, 0, fieldName)
.
fieldName
- Field namepublic org.apache.calcite.rex.RexInputRef field(int inputCount, int inputOrdinal, String fieldName)
inputCount
- Number of inputsinputOrdinal
- Input ordinalfieldName
- Field namepublic org.apache.calcite.rex.RexInputRef field(int fieldOrdinal)
Equivalent to field(1, 0, ordinal)
.
fieldOrdinal
- Field ordinalpublic org.apache.calcite.rex.RexInputRef field(int inputCount, int inputOrdinal, int fieldOrdinal)
inputCount
- Number of inputsinputOrdinal
- Input ordinalfieldOrdinal
- Field ordinal within inputpublic org.apache.calcite.rex.RexNode field(String alias, String fieldName)
public com.google.common.collect.ImmutableList<org.apache.calcite.rex.RexNode> fields()
public com.google.common.collect.ImmutableList<org.apache.calcite.rex.RexNode> fields(int inputCount, int inputOrdinal)
public com.google.common.collect.ImmutableList<org.apache.calcite.rex.RexNode> fields(org.apache.calcite.rel.RelCollation collation)
public com.google.common.collect.ImmutableList<org.apache.calcite.rex.RexNode> fields(List<? extends Number> ordinals)
public com.google.common.collect.ImmutableList<org.apache.calcite.rex.RexNode> fields(Iterable<String> fieldNames)
public com.google.common.collect.ImmutableList<org.apache.calcite.rex.RexNode> fields(org.apache.calcite.util.mapping.Mappings.TargetMapping mapping)
public org.apache.calcite.rex.RexNode dot(org.apache.calcite.rex.RexNode node, String fieldName)
public org.apache.calcite.rex.RexNode dot(org.apache.calcite.rex.RexNode node, int fieldOrdinal)
public org.apache.calcite.rex.RexNode call(org.apache.calcite.sql.SqlOperator operator, org.apache.calcite.rex.RexNode... operands)
public org.apache.calcite.rex.RexNode call(org.apache.calcite.sql.SqlOperator operator, Iterable<? extends org.apache.calcite.rex.RexNode> operands)
public org.apache.calcite.rex.RexNode and(org.apache.calcite.rex.RexNode... operands)
public org.apache.calcite.rex.RexNode and(Iterable<? extends org.apache.calcite.rex.RexNode> operands)
Simplifies the expression a little:
e AND TRUE
becomes e
;
e AND e2 AND NOT e
becomes e2
.
public org.apache.calcite.rex.RexNode or(org.apache.calcite.rex.RexNode... operands)
public org.apache.calcite.rex.RexNode or(Iterable<? extends org.apache.calcite.rex.RexNode> operands)
public org.apache.calcite.rex.RexNode not(org.apache.calcite.rex.RexNode operand)
public org.apache.calcite.rex.RexNode equals(org.apache.calcite.rex.RexNode operand0, org.apache.calcite.rex.RexNode operand1)
public org.apache.calcite.rex.RexNode isNull(org.apache.calcite.rex.RexNode operand)
public org.apache.calcite.rex.RexNode isNotNull(org.apache.calcite.rex.RexNode operand)
public org.apache.calcite.rex.RexNode cast(org.apache.calcite.rex.RexNode expr, org.apache.calcite.sql.type.SqlTypeName typeName)
public org.apache.calcite.rex.RexNode cast(org.apache.calcite.rex.RexNode expr, org.apache.calcite.sql.type.SqlTypeName typeName, int precision)
public org.apache.calcite.rex.RexNode cast(org.apache.calcite.rex.RexNode expr, org.apache.calcite.sql.type.SqlTypeName typeName, int precision, int scale)
public org.apache.calcite.rex.RexNode alias(org.apache.calcite.rex.RexNode expr, String alias)
public org.apache.calcite.rex.RexNode desc(org.apache.calcite.rex.RexNode node)
public org.apache.calcite.rex.RexNode nullsLast(org.apache.calcite.rex.RexNode node)
public org.apache.calcite.rex.RexNode nullsFirst(org.apache.calcite.rex.RexNode node)
public HiveSubQRemoveRelBuilder.GroupKey groupKey()
public HiveSubQRemoveRelBuilder.GroupKey groupKey(org.apache.calcite.rex.RexNode... nodes)
public HiveSubQRemoveRelBuilder.GroupKey groupKey(Iterable<? extends org.apache.calcite.rex.RexNode> nodes)
public HiveSubQRemoveRelBuilder.GroupKey groupKey(Iterable<? extends org.apache.calcite.rex.RexNode> nodes, boolean indicator, Iterable<? extends Iterable<? extends org.apache.calcite.rex.RexNode>> nodeLists)
public HiveSubQRemoveRelBuilder.GroupKey groupKey(int... fieldOrdinals)
public HiveSubQRemoveRelBuilder.GroupKey groupKey(String... fieldNames)
public HiveSubQRemoveRelBuilder.GroupKey groupKey(org.apache.calcite.util.ImmutableBitSet groupSet, boolean indicator, com.google.common.collect.ImmutableList<org.apache.calcite.util.ImmutableBitSet> groupSets)
This method of creating a group key does not allow you to group on new
expressions, only column projections, but is efficient, especially when you
are coming from an existing Aggregate
.
public HiveSubQRemoveRelBuilder.AggCall aggregateCall(org.apache.calcite.sql.SqlAggFunction aggFunction, boolean distinct, org.apache.calcite.rex.RexNode filter, String alias, org.apache.calcite.rex.RexNode... operands)
public HiveSubQRemoveRelBuilder.AggCall aggregateCall(org.apache.calcite.sql.SqlAggFunction aggFunction, boolean distinct, org.apache.calcite.rex.RexNode filter, String alias, Iterable<? extends org.apache.calcite.rex.RexNode> operands)
public HiveSubQRemoveRelBuilder.AggCall count(boolean distinct, String alias, org.apache.calcite.rex.RexNode... operands)
public HiveSubQRemoveRelBuilder.AggCall countStar(String alias)
public HiveSubQRemoveRelBuilder.AggCall sum(boolean distinct, String alias, org.apache.calcite.rex.RexNode operand)
public HiveSubQRemoveRelBuilder.AggCall avg(boolean distinct, String alias, org.apache.calcite.rex.RexNode operand)
public HiveSubQRemoveRelBuilder.AggCall min(String alias, org.apache.calcite.rex.RexNode operand)
public HiveSubQRemoveRelBuilder.AggCall max(String alias, org.apache.calcite.rex.RexNode operand)
public HiveSubQRemoveRelBuilder scan(Iterable<String> tableNames)
TableScan
of the table
with a given name.
Throws if the table does not exist.
Returns this builder.
tableNames
- Name of table (can optionally be qualified)public HiveSubQRemoveRelBuilder scan(String... tableNames)
TableScan
of the table
with a given name.
Throws if the table does not exist.
Returns this builder.
tableNames
- Name of table (can optionally be qualified)public HiveSubQRemoveRelBuilder filter(org.apache.calcite.rex.RexNode... predicates)
Filter
of an array of
predicates.
The predicates are combined using AND,
and optimized in a similar way to the and(org.apache.calcite.rex.RexNode...)
method.
If the result is TRUE no filter is created.
public HiveSubQRemoveRelBuilder filter(Iterable<? extends org.apache.calcite.rex.RexNode> predicates)
Filter
of a list of
predicates.
The predicates are combined using AND,
and optimized in a similar way to the and(org.apache.calcite.rex.RexNode...)
method.
If the result is TRUE no filter is created.
public HiveSubQRemoveRelBuilder project(Iterable<? extends org.apache.calcite.rex.RexNode> nodes)
Project
of the given list
of expressions.
Infers names as would project(Iterable, Iterable)
if all
suggested names were null.
nodes
- Expressionspublic HiveSubQRemoveRelBuilder project(Iterable<? extends org.apache.calcite.rex.RexNode> nodes, Iterable<String> fieldNames)
Project
of the given list
of expressions and field names.
Infers names as would project(Iterable, Iterable)
if all
suggested names were null.
nodes
- ExpressionsfieldNames
- field names for expressionspublic HiveSubQRemoveRelBuilder project(Iterable<? extends org.apache.calcite.rex.RexNode> nodes, Iterable<String> fieldNames, boolean force)
Project
of the given list
of expressions, using the given names.
Names are deduced as follows:
fieldNames
is greater than the index of
the current entry in nodes
, and the entry in
fieldNames
is not null, uses it; otherwise
SqlStdOperatorTable.AS
(see alias(org.apache.calcite.rex.RexNode, java.lang.String)
), removes the call but uses the intended alias.
After the field names have been inferred, makes the field names unique by appending numeric suffixes.
nodes
- ExpressionsfieldNames
- Suggested field namesforce
- create project even if it is identitypublic HiveSubQRemoveRelBuilder project(org.apache.calcite.rex.RexNode... nodes)
Project
of the given
expressions.public HiveSubQRemoveRelBuilder distinct()
Aggregate
that makes the
relational expression distinct on all fields.public HiveSubQRemoveRelBuilder aggregate(HiveSubQRemoveRelBuilder.GroupKey groupKey, HiveSubQRemoveRelBuilder.AggCall... aggCalls)
Aggregate
with an array of
calls.public HiveSubQRemoveRelBuilder aggregate(HiveSubQRemoveRelBuilder.GroupKey groupKey, Iterable<HiveSubQRemoveRelBuilder.AggCall> aggCalls)
Aggregate
with a list of
calls.public HiveSubQRemoveRelBuilder union(boolean all)
Union
of the two most recent
relational expressions on the stack.all
- Whether to create UNION ALLpublic HiveSubQRemoveRelBuilder union(boolean all, int n)
Union
of the n
most recent relational expressions on the stack.all
- Whether to create UNION ALLn
- Number of inputs to the UNION operatorpublic HiveSubQRemoveRelBuilder intersect(boolean all)
Intersect
of the two most
recent relational expressions on the stack.all
- Whether to create INTERSECT ALLpublic HiveSubQRemoveRelBuilder intersect(boolean all, int n)
Intersect
of the n
most recent relational expressions on the stack.all
- Whether to create INTERSECT ALLn
- Number of inputs to the INTERSECT operatorpublic HiveSubQRemoveRelBuilder minus(boolean all)
Minus
of the two most recent
relational expressions on the stack.all
- Whether to create EXCEPT ALLpublic HiveSubQRemoveRelBuilder minus(boolean all, int n)
Minus
of the n
most recent relational expressions on the stack.all
- Whether to create EXCEPT ALLpublic HiveSubQRemoveRelBuilder join(org.apache.calcite.rel.core.JoinRelType joinType, org.apache.calcite.rex.RexNode condition0, org.apache.calcite.rex.RexNode... conditions)
Join
.public HiveSubQRemoveRelBuilder join(org.apache.calcite.rel.core.JoinRelType joinType, Iterable<? extends org.apache.calcite.rex.RexNode> conditions)
Join
with multiple
conditions.public HiveSubQRemoveRelBuilder join(org.apache.calcite.rel.core.JoinRelType joinType, org.apache.calcite.rex.RexNode condition)
public HiveSubQRemoveRelBuilder variable(org.apache.calcite.util.Holder<org.apache.calcite.rex.RexCorrelVariable> v)
public org.apache.calcite.rex.RexNode field(org.apache.calcite.rex.RexNode e, String name)
public HiveSubQRemoveRelBuilder join(org.apache.calcite.rel.core.JoinRelType joinType, org.apache.calcite.rex.RexNode condition, Set<org.apache.calcite.rel.core.CorrelationId> variablesSet)
Join
with correlating
variables.public HiveSubQRemoveRelBuilder join(org.apache.calcite.rel.core.JoinRelType joinType, String... fieldNames)
Join
using USING syntax.
For each of the field names, both left and right inputs must have a field of that name. Constructs a join condition that the left and right fields are equal.
joinType
- Join typefieldNames
- Field namespublic HiveSubQRemoveRelBuilder semiJoin(Iterable<? extends org.apache.calcite.rex.RexNode> conditions)
SemiJoin
.public HiveSubQRemoveRelBuilder semiJoin(org.apache.calcite.rex.RexNode... conditions)
SemiJoin
.public HiveSubQRemoveRelBuilder as(String alias)
public HiveSubQRemoveRelBuilder values(String[] fieldNames, Object... values)
Values
.
The values
array must have the same number of entries as
fieldNames
, or an integer multiple if you wish to create multiple
rows.
If there are zero rows, or if all values of a any column are
null, this method cannot deduce the type of columns. For these cases,
call values(Iterable, RelDataType)
.
fieldNames
- Field namesvalues
- Valuespublic HiveSubQRemoveRelBuilder empty()
public HiveSubQRemoveRelBuilder values(org.apache.calcite.rel.type.RelDataType rowType, Object... columnValues)
Values
with a specified row type.
This method can handle cases that values(String[], Object...)
cannot, such as all values of a column being null, or there being zero
rows.
rowType
- Row typecolumnValues
- Valuespublic HiveSubQRemoveRelBuilder values(Iterable<? extends List<org.apache.calcite.rex.RexLiteral>> tupleList, org.apache.calcite.rel.type.RelDataType rowType)
Values
with a specified row type.
This method can handle cases that values(String[], Object...)
cannot, such as all values of a column being null, or there being zero
rows.
tupleList
- Tuple listrowType
- Row typepublic HiveSubQRemoveRelBuilder values(org.apache.calcite.rel.type.RelDataType rowType)
Values
with a specified row type and
zero rows.rowType
- Row typepublic HiveSubQRemoveRelBuilder limit(int offset, int fetch)
public HiveSubQRemoveRelBuilder sort(int... fields)
Sort
by field ordinals.
Negative fields mean descending: -1 means field(0) descending, -2 means field(1) descending, etc.
public HiveSubQRemoveRelBuilder sort(org.apache.calcite.rex.RexNode... nodes)
Sort
by expressions.public HiveSubQRemoveRelBuilder sort(Iterable<? extends org.apache.calcite.rex.RexNode> nodes)
Sort
by expressions.public HiveSubQRemoveRelBuilder sortLimit(int offset, int fetch, org.apache.calcite.rex.RexNode... nodes)
Sort
by expressions, with limit and offset.public HiveSubQRemoveRelBuilder sortLimit(int offset, int fetch, Iterable<? extends org.apache.calcite.rex.RexNode> nodes)
Sort
by a list of expressions, with limit and offset.offset
- Number of rows to skip; non-positive means don't skip anyfetch
- Maximum number of rows to fetch; negative means no limitnodes
- Sort expressionspublic HiveSubQRemoveRelBuilder convert(org.apache.calcite.rel.type.RelDataType castRowType, boolean rename)
castRowType
- row type after castrename
- if true, use field names from castRowType; if false,
preserve field names from relpublic HiveSubQRemoveRelBuilder permute(org.apache.calcite.util.mapping.Mapping mapping)
public HiveSubQRemoveRelBuilder aggregate(HiveSubQRemoveRelBuilder.GroupKey groupKey, List<org.apache.calcite.rel.core.AggregateCall> aggregateCalls)
public void clear()
The builder's state is now the same as when it was created.
protected String getAlias()
Copyright © 2021 The Apache Software Foundation. All rights reserved.