public class Table extends Object implements scala.Product, scala.Serializable
DataSet
and
DataStream
.
Use the methods of Table
to transform data. Use
TableEnvironment
to convert a Table
back to a DataSet
or DataStream.
When using Scala a Table
can also be converted using implicit conversions.
Example:
val table = set.toTable('a, 'b)
...
val table2 = ...
val set = table2.toDataSet[MyType]
Operations such as join
, select
, where
and groupBy
either take arguments
in a Scala DSL or as an expression String. Please refer to the documentation for the expression
syntax.
Modifier and Type | Method and Description |
---|---|
Table |
as(scala.collection.Seq<Expression> fields)
Renames the fields of the expression result.
|
Table |
as(String fields)
Renames the fields of the expression result.
|
String |
explain() |
String |
explain(boolean extended)
Get the process of the sql parsing, print AST and physical execution plan.The AST
show the structure of the supplied statement.
|
Table |
filter(Expression predicate)
Filters out elements that don't pass the filter predicate.
|
Table |
filter(String predicate)
Filters out elements that don't pass the filter predicate.
|
Table |
groupBy(scala.collection.Seq<Expression> fields)
Groups the elements on some grouping keys.
|
Table |
groupBy(String fields)
Groups the elements on some grouping keys.
|
Table |
join(Table right)
Joins two
Table s. |
PlanNode |
operation() |
Table |
select(scala.collection.Seq<Expression> fields)
Performs a selection operation.
|
Table |
select(String fields)
Performs a selection operation.
|
String |
toString() |
Table |
unionAll(Table right)
Union two
Table s. |
Table |
where(Expression predicate)
Filters out elements that don't pass the filter predicate.
|
Table |
where(String predicate)
Filters out elements that don't pass the filter predicate.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
public Table(PlanNode operation)
public PlanNode operation()
public Table select(scala.collection.Seq<Expression> fields)
Example:
in.select('key, 'value.avg + " The average" as 'average, 'other.substring(0, 10))
public Table select(String fields)
Example:
in.select("key, value.avg + " The average" as average, other.substring(0, 10)")
public Table as(scala.collection.Seq<Expression> fields)
Example:
in.as('a, 'b)
public Table as(String fields)
Example:
in.as("a, b")
public Table filter(Expression predicate)
Example:
in.filter('name === "Fred")
public Table filter(String predicate)
Example:
in.filter("name = 'Fred'")
public Table where(Expression predicate)
Example:
in.where('name === "Fred")
public Table where(String predicate)
Example:
in.where("name = 'Fred'")
public Table groupBy(scala.collection.Seq<Expression> fields)
Example:
in.groupBy('key).select('key, 'value.avg)
public Table groupBy(String fields)
Example:
in.groupBy("key").select("key, value.avg")
public Table join(Table right)
Table
s. Similar to an SQL join. The fields of the two joined
operations must not overlap, use as
to rename fields if necessary. You can use
where and select clauses after a join to further specify the behaviour of the join.
Example:
left.join(right).where('a === 'b && 'c > 3).select('a, 'b, 'd)
public Table unionAll(Table right)
Table
s. Similar to an SQL UNION ALL. The fields of the two union operations
must fully overlap.
Example:
left.unionAll(right)
public String explain(boolean extended)
public String explain()
Copyright © 2014–2017 The Apache Software Foundation. All rights reserved.