raminqaf commented on code in PR #29864:
URL: https://github.com/apache/flink/pull/29864#discussion_r4601064178


##########
docs/data/functions/window/lag.yml:
##########
@@ -0,0 +1,105 @@
+# 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
+
+name: LAG
+summary: Returns a value from a row before the current row in its partition.
+
+syntax:
+  sql: LAG(expression [, offset [, default]]) OVER ([PARTITION BY expression 
[, ...]] [ORDER BY expression [ASC | DESC] [, ...]])
+  java: |
+    lag($("expression"))
+    lag($("expression"), offset)
+    lag($("expression"), offset, defaultValue)
+  python: |
+    lag(col("expression"))
+    lag(col("expression"), offset)
+    lag(col("expression"), offset, default)
+
+arguments:
+  - name: expression
+    type: Any type
+    required: true
+    description: The value to read from the other row.
+  - name: offset
+    type: An integer
+    required: false
+    default: "`1`"
+    description: How many rows before the current row to look. `0` returns the 
value of the current row. A negative offset looks the other way, so `LAG(x, 
-1)` returns the same as `LEAD(x, 1)` in batch mode.
+  - name: default
+    type: The type of `expression`
+    required: false
+    default: NULL
+    description: The value to return if there is no row at that offset. It is 
evaluated on the current row. Give it the type of `expression`, such as `CAST(0 
AS BIGINT)` for a `BIGINT` expression.
+
+returns:
+  description: The value of `expression` in the row that comes `offset` rows 
before the current row in its partition, by the `ORDER BY` of the window.
+  nulls: Returns NULL if that row has a NULL value, or if there is no such row 
and `default` is NULL or omitted.
+  type: The type of `expression`. NOT NULL if `default` is NOT NULL.

Review Comment:
   The page now describes the current behavior: the type is NOT NULL with a NOT 
NULL `default`, and a note and an example show the `-1`.



##########
docs/data/functions/window/lead.yml:
##########
@@ -0,0 +1,105 @@
+# 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
+
+name: LEAD
+summary: Returns a value from a row after the current row in its partition.
+
+syntax:
+  sql: LEAD(expression [, offset [, default]]) OVER ([PARTITION BY expression 
[, ...]] [ORDER BY expression [ASC | DESC] [, ...]])
+  java: |
+    lead($("expression"))
+    lead($("expression"), offset)
+    lead($("expression"), offset, defaultValue)
+  python: |
+    lead(col("expression"))
+    lead(col("expression"), offset)
+    lead(col("expression"), offset, default)
+
+arguments:
+  - name: expression
+    type: Any type
+    required: true
+    description: The value to read from the other row.
+  - name: offset
+    type: An integer
+    required: false
+    default: "`1`"
+    description: How many rows after the current row to look. `0` returns the 
value of the current row. A negative offset looks the other way, so `LEAD(x, 
-1)` returns the same as `LAG(x, 1)` in batch mode.
+  - name: default
+    type: The type of `expression`
+    required: false
+    default: NULL
+    description: The value to return if there is no row at that offset. It is 
evaluated on the current row. Give it the type of `expression`, such as `CAST(0 
AS BIGINT)` for a `BIGINT` expression.
+
+returns:
+  description: The value of `expression` in the row that comes `offset` rows 
after the current row in its partition, by the `ORDER BY` of the window.
+  nulls: Returns NULL if that row has a NULL value, or if there is no such row 
and `default` is NULL or omitted.
+  type: The type of `expression`. NOT NULL if `default` is NOT NULL.

Review Comment:
   same as LAG



-- 
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]

Reply via email to