luoyuxia commented on code in PR #23109: URL: https://github.com/apache/flink/pull/23109#discussion_r1284335758
########## docs/content/docs/dev/table/sql/queries/time-travel.md: ########## @@ -0,0 +1,68 @@ +--- +title: Time Travel +weight: 18 +type: docs +--- +<!-- +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. +--> + +# Time Travel + +{{< label Batch >}} {{< label Streaming >}} + +Time travel is an SQL syntax used for querying historical data. It allows users to specify a point in time, query the corresponding table data, and use the schema that corresponds to that time. Review Comment: I don't think we need to refer to schema as `query the corresponding table data` also means the schema at that time. WDTY? ########## docs/content/docs/dev/table/sql/queries/time-travel.md: ########## @@ -0,0 +1,68 @@ +--- +title: Time Travel +weight: 18 +type: docs +--- +<!-- +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. +--> + +# Time Travel + +{{< label Batch >}} {{< label Streaming >}} + +Time travel is an SQL syntax used for querying historical data. It allows users to specify a point in time, query the corresponding table data, and use the schema that corresponds to that time. + +<span class="label label-danger">Attention</span> Currently, `Time Travel` requires corresponding Catalog implement the {{< gh_link file="flink-table/flink-table-common/src/main/java/org/apache/flink/table/catalog/Catalog.java" name="getTable(ObjectPath tablePath, long timestamp)" >}} method。 + +```sql +SELECT select_list FROM paimon_tb FOR SYSTEM_TIME AS OF TIMESTAMP '2023-07-31 00:00:00' +``` + +## Expression Description + +<span class="label label-danger">Attention</span> `Time Travel` currently only supports some constant expressions and does not support the use of functions or udf. + +### Constant Expression + +```sql +SELECT select_list FROM paimon_tb FOR SYSTEM_TIME AS OF TIMESTAMP '2023-07-31 00:00:00' +``` + +### Constant Expression Addition and Subtraction + +```sql +SELECT select_list FROM paimon_tb FOR SYSTEM_TIME AS OF TIMESTAMP '2023-07-31 00:00:00' - INTERVAL '1' DAY +``` + +### Time Function or UDF (Not Supported) + +When using UDF or functions, a valid timestamp cannot be generated due to limitations of the current framework, and an exception will be thrown when executing the following query. + +```sql +SELECT select_list FROM paimon_tb FOR SYSTEM_TIME AS OF TO_TIMESTAMP_LTZ(0, 3) +``` + +## Time Zone Handling + +By default, the data type generated by the TIMESTAMP expression should be TIMESTAMP type, while the Review Comment: Do we really need the implement details as it just a doc to user. I think we just should descibe the behavior for time travel with time zone handling. ########## docs/content/docs/dev/table/sql/queries/time-travel.md: ########## @@ -0,0 +1,68 @@ +--- +title: Time Travel +weight: 18 +type: docs +--- +<!-- +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. +--> + +# Time Travel + +{{< label Batch >}} {{< label Streaming >}} + +Time travel is an SQL syntax used for querying historical data. It allows users to specify a point in time, query the corresponding table data, and use the schema that corresponds to that time. + +<span class="label label-danger">Attention</span> Currently, `Time Travel` requires corresponding Catalog implement the {{< gh_link file="flink-table/flink-table-common/src/main/java/org/apache/flink/table/catalog/Catalog.java" name="getTable(ObjectPath tablePath, long timestamp)" >}} method。 Review Comment: ```suggestion <span class="label label-danger">Attention</span> Currently, `Time Travel` requires the corresponding catalog that the table belongs to implement the {{< gh_link file="flink-table/flink-table-common/src/main/java/org/apache/flink/table/catalog/Catalog.java" name="getTable(ObjectPath tablePath, long timestamp)" >}} method。 ``` ########## docs/content.zh/docs/dev/table/sql/queries/time-travel.md: ########## @@ -0,0 +1,64 @@ +--- +title: 时间旅行 +type: docs +--- +<!-- +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. +--> + +# 时间旅行 Review Comment: Some comments in en doc are also suitable for zh doc. ########## docs/content/docs/dev/table/sql/queries/time-travel.md: ########## @@ -0,0 +1,68 @@ +--- +title: Time Travel +weight: 18 +type: docs +--- +<!-- +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. +--> + +# Time Travel + +{{< label Batch >}} {{< label Streaming >}} + +Time travel is an SQL syntax used for querying historical data. It allows users to specify a point in time, query the corresponding table data, and use the schema that corresponds to that time. + +<span class="label label-danger">Attention</span> Currently, `Time Travel` requires corresponding Catalog implement the {{< gh_link file="flink-table/flink-table-common/src/main/java/org/apache/flink/table/catalog/Catalog.java" name="getTable(ObjectPath tablePath, long timestamp)" >}} method。 Review Comment: ```suggestion <span class="label label-danger">Attention</span> Currently, `Time Travel` requires the corresponding catalog that the table belongs to implement the {{< gh_link file="flink-table/flink-table-common/src/main/java/org/apache/flink/table/catalog/Catalog.java" name="getTable(ObjectPath tablePath, long timestamp)" >}} method。 ``` -- 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. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
