You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by tw...@apache.org on 2019/01/14 12:39:34 UTC
[flink] branch master updated: [FLINK-11304][docs][table] Fix typo
in time attributes doc
This is an automated email from the ASF dual-hosted git repository.
twalthr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git
The following commit(s) were added to refs/heads/master by this push:
new 2be178c [FLINK-11304][docs][table] Fix typo in time attributes doc
2be178c is described below
commit 2be178c36bb1fae19d3089be43d789c66813f191
Author: JaryZhen <ja...@JZ.local>
AuthorDate: Mon Jan 14 12:30:10 2019 +0800
[FLINK-11304][docs][table] Fix typo in time attributes doc
This closes #7477.
---
docs/dev/table/streaming/time_attributes.md | 24 ++++++++++++++++++------
1 file changed, 18 insertions(+), 6 deletions(-)
diff --git a/docs/dev/table/streaming/time_attributes.md b/docs/dev/table/streaming/time_attributes.md
index 101bad6..9522909 100644
--- a/docs/dev/table/streaming/time_attributes.md
+++ b/docs/dev/table/streaming/time_attributes.md
@@ -264,7 +264,7 @@ Moreover, the `DataStream` returned by the `getDataStream()` method must have wa
<div data-lang="java" markdown="1">
{% highlight java %}
// define a table source with a rowtime attribute
-public class UserActionSource implements StreamTableSource<Row>, DefinedRowtimeAttribute {
+public class UserActionSource implements StreamTableSource<Row>, DefinedRowtimeAttributes {
@Override
public TypeInformation<Row> getReturnType() {
@@ -284,9 +284,15 @@ public class UserActionSource implements StreamTableSource<Row>, DefinedRowtimeA
}
@Override
- public String getRowtimeAttribute() {
+ public List<RowtimeAttributeDescriptor> getRowtimeAttributeDescriptors() {
// Mark the "UserActionTime" attribute as event-time attribute.
- return "UserActionTime";
+ // We create one attribute descriptor of "UserActionTime".
+ RowtimeAttributeDescriptor rowtimeAttrDescr = new RowtimeAttributeDescriptor(
+ "UserActionTime",
+ new ExistingField("UserActionTime"),
+ new AscendingTimestamps());
+ List<RowtimeAttributeDescriptor> listRowtimeAttrDescr = Collections.singletonList(rowtimeAttrDescr);
+ return listRowtimeAttrDescr;
}
}
@@ -301,7 +307,7 @@ WindowedTable windowedTable = tEnv
<div data-lang="scala" markdown="1">
{% highlight scala %}
// define a table source with a rowtime attribute
-class UserActionSource extends StreamTableSource[Row] with DefinedRowtimeAttribute {
+class UserActionSource extends StreamTableSource[Row] with DefinedRowtimeAttributes {
override def getReturnType = {
val names = Array[String]("Username" , "Data", "UserActionTime")
@@ -317,9 +323,15 @@ class UserActionSource extends StreamTableSource[Row] with DefinedRowtimeAttribu
stream
}
- override def getRowtimeAttribute = {
+ override def getRowtimeAttributeDescriptors: util.List[RowtimeAttributeDescriptor] = {
// Mark the "UserActionTime" attribute as event-time attribute.
- "UserActionTime"
+ // We create one attribute descriptor of "UserActionTime".
+ val rowtimeAttrDescr = new RowtimeAttributeDescriptor(
+ "UserActionTime",
+ new ExistingField("UserActionTime"),
+ new AscendingTimestamps)
+ val listRowtimeAttrDescr = Collections.singletonList(rowtimeAttrDescr)
+ listRowtimeAttrDescr
}
}