You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2018/10/22 19:22:47 UTC

[GitHub] dawidwys commented on a change in pull request #6897: [FLINK-9737] [FLINK-8880] [sql-client] Support defining temporal tables in environment files

dawidwys commented on a change in pull request #6897: [FLINK-9737] [FLINK-8880] [sql-client] Support defining temporal tables in environment files
URL: https://github.com/apache/flink/pull/6897#discussion_r226996878
 
 

 ##########
 File path: docs/dev/table/sqlClient.md
 ##########
 @@ -503,7 +504,49 @@ Views created within a CLI session can also be removed again using the `DROP VIE
 DROP VIEW MyNewView;
 {% endhighlight %}
 
-<span class="label label-danger">Attention</span> The definition of views is limited to the mentioned syntax above. Defining a schema for views or escape whitespaces in table names will be supported in future versions.
+<span class="label label-danger">Attention</span> The definition of views in the CLI is limited to the mentioned syntax above. Defining a schema for views or escaping whitespaces in table names will be supported in future versions.
+
+{% top %}
+
+Temporal Tables
+---------------
+
+A [temporal table](./streaming/temporal_tables.html) allows for a (parameterized) view on a changing history table that returns the content of a table at a specific point in time. This is especially useful for joining a table with the content of another table at a particular timestamp. More information can be found in the [temporal table joins](./streaming/joins.html#join-with-a-temporal-table) page.
+
+The following example shows how to define a temporal table `SourceTemporalTable`:
+
+{% highlight yaml %}
+tables:
+
+  # Define the table source (or view) that contains updates to a temporal table
+  - name: HistorySource
+    type: source-table
+    update-mode: append
+    connector: # ...
+    format: # ...
+    schema:
+      - name: integerField
+        type: INT
+      - name: stringField
+        type: VARCHAR
+      - name: rowtimeField
+        type: TIMESTAMP
+        rowtime:
+          timestamps:
+            type: from-field
+            from: rowtimeField
+          watermarks:
+            type: from-source
+
+  # Define a temporal table over the changing history table with time attribute and primary key
+  - name: SourceTemporalTable
+    type: temporal-table
+    changing-table: HistorySource
+    primary-key: integerField
+    time-attribute: rowtimeField
+{% endhighlight %}
+
+Similar to views, temporal tables are registered in the order in which they are defined in the environment file.
 
 Review comment:
   Should we somewhere mention that we can mix views/tables/temporal tables, and the order is important there? So that it is clear we can have e.g. a chain `view A -> temporal table B depends on A -> view C depends on B`.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services