alpinegizmo commented on a change in pull request #14292: URL: https://github.com/apache/flink/pull/14292#discussion_r539417802
########## File path: docs/dev/table/streaming/legacy.md ########## @@ -0,0 +1,135 @@ +--- +title: "Legacy Features" +nav-parent_id: streaming_tableapi +nav-pos: 1001 +--- +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +As Flink SQL has matured there are some features that have been replaced with more modern and better functioning substitutes. +These legacy features remain documented here for those users that have not yet or are unable to, upgrade to the more modern variant. + +* This will be replaced by the TOC +{:toc} + +# Temporal Table Function + +The temporal table function is the legacy way of defining something akin to a [versioned table]({% link dev/table/streaming/temporal_tables.md %}) +that can be used in a temporal table join. +Please define temporal joins using [versioned table]({% link dev/table/streaming/temporal_tables.md %}) as described above in new queries. Review comment: Temporal tables are no longer "above". ```suggestion Please define temporal joins using [versioned tables]({% link dev/table/streaming/temporal_tables.md %}) in new queries. ``` ########## File path: docs/dev/table/streaming/legacy.md ########## @@ -0,0 +1,135 @@ +--- +title: "Legacy Features" +nav-parent_id: streaming_tableapi +nav-pos: 1001 +--- +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +As Flink SQL has matured there are some features that have been replaced with more modern and better functioning substitutes. +These legacy features remain documented here for those users that have not yet or are unable to, upgrade to the more modern variant. + +* This will be replaced by the TOC +{:toc} + +# Temporal Table Function + +The temporal table function is the legacy way of defining something akin to a [versioned table]({% link dev/table/streaming/temporal_tables.md %}) +that can be used in a temporal table join. +Please define temporal joins using [versioned table]({% link dev/table/streaming/temporal_tables.md %}) as described above in new queries. + +Unlike a versioned table, temporal table functions can only be defined on top of append-only streams +— it does not support changelog inputs. +Additionally, a temporal table function cannot be defined in pure SQL DDL. + +#### Defining a Temporal Table Function + +Temporal table function can be defined on top of append-only streams using the [Table API]({% link dev/table/tableApi.md %}). +The table is registered with one or more key columns, and a time attribute used for versioning. + +Suppose we have an append-only table of currency rates that we would like to +register as a temporal table function. + +{% highlight sql %} +SELECT * FROM currency_rates; + +update_time currency rate +============= ========= ==== +09:00:00 Yen 102 +09:00:00 Euro 114 +09:00:00 USD 1 +11:15:00 Euro 119 +11:49:00 Pounds 108 +{% endhighlight %} + +Using the Table API, we can register this stream using `currency` for the key and `update_time` as +the versioning time attribute. + +<div class="codetabs" markdown="1"> +<div data-lang="java" markdown="1"> +{% highlight java %} +TemporalTableFunction rates = tEnv + .from("currency_rates"). + .createTemporalTableFunction("update_time", "currency"); + +tEnv.registerFunction("rates", rates); +{% endhighlight %} +</div> +<div data-lang="scala" markdown="1"> +{% highlight scala %} +rates = tEnv + .from("currency_rates"). + .createTemporalTableFunction("update_time", "currency") + +tEnv.registerFunction("rates", rates) +{% endhighlight %} +</div> +</div> + +#### Temporal Table Function Join + +Once defined, a temporal table function is used as a standard [table function]({% link dev/table/functions/udfs.md %}#table-functions). +Append-only tables (left input/probe side) can join with a temporal table (right input/build side), +i.e., a table that changes over time and tracks its changes, to retrieve the value for a key as it was at a particular point in time. + +Consider an append-only table `orders` that tracks customers orders in different currencies. Review comment: ```suggestion Consider an append-only table `orders` that tracks customers' orders in different currencies. ``` ########## File path: docs/dev/table/streaming/legacy.md ########## @@ -0,0 +1,135 @@ +--- +title: "Legacy Features" +nav-parent_id: streaming_tableapi +nav-pos: 1001 +--- +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +As Flink SQL has matured there are some features that have been replaced with more modern and better functioning substitutes. +These legacy features remain documented here for those users that have not yet or are unable to, upgrade to the more modern variant. + +* This will be replaced by the TOC +{:toc} + +# Temporal Table Function + +The temporal table function is the legacy way of defining something akin to a [versioned table]({% link dev/table/streaming/temporal_tables.md %}) +that can be used in a temporal table join. +Please define temporal joins using [versioned table]({% link dev/table/streaming/temporal_tables.md %}) as described above in new queries. + +Unlike a versioned table, temporal table functions can only be defined on top of append-only streams +— it does not support changelog inputs. +Additionally, a temporal table function cannot be defined in pure SQL DDL. + +#### Defining a Temporal Table Function + +Temporal table function can be defined on top of append-only streams using the [Table API]({% link dev/table/tableApi.md %}). Review comment: ```suggestion Temporal table functions can be defined on top of append-only streams using the [Table API]({% link dev/table/tableApi.md %}). ``` ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
