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


##########
docs/data/functions/window/lag.yml:
##########
@@ -0,0 +1,119 @@
+# 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 exactly the type of `expression`, such as 
`CAST(0 AS BIGINT)` for a `BIGINT` expression. A wider type, such as a `BIGINT` 
default for an `INT` expression, fails the query.
+
+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 there is no such row and `default` is NULL or 
omitted, or if that row has a NULL value and `default` is nullable or omitted.
+  type: The type of `expression`. NOT NULL if `default` is NOT NULL.
+
+notes:
+  - The window can't have a frame clause, such as `ROWS BETWEEN 1 PRECEDING 
AND CURRENT ROW`.
+  - Without an `ORDER BY`, the order of the rows is undefined.
+  - "In streaming mode, the `ORDER BY` of the window follows the rules of an 
[OVER aggregation]({{< ref \"docs/sql/reference/queries/over-agg\" 
>}}#order-by): one column in ascending order."
+  - In batch mode, `expression` can't be an `ARRAY`, `MAP`, `ROW` or `VARIANT` 
value.

Review Comment:
   BYTES and TIMESTAMP_LTZ fail at planning too. `createLeadLagAggFunction` 
only takes numeric, boolean, string, DATE, TIME and TIMESTAMP types, so I think 
naming those is simpler.



##########
docs/data/functions/window/lead.yml:
##########
@@ -0,0 +1,119 @@
+# 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 exactly the type of `expression`, such as 
`CAST(0 AS BIGINT)` for a `BIGINT` expression. A wider type, such as a `BIGINT` 
default for an `INT` expression, fails the query.
+
+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 there is no such row and `default` is NULL or 
omitted, or if that row has a NULL value and `default` is nullable or omitted.
+  type: The type of `expression`. NOT NULL if `default` is NOT NULL.
+
+notes:
+  - The window can't have a frame clause, such as `ROWS BETWEEN 1 PRECEDING 
AND CURRENT ROW`.
+  - Without an `ORDER BY`, the order of the rows is undefined.
+  - Not supported in streaming mode.
+  - "`expression` can't be an `ARRAY`, `MAP`, `ROW` or `VARIANT` value."

Review Comment:
   Same as for LAG.



##########
docs/data/functions/utility/descriptor.yml:
##########
@@ -0,0 +1,58 @@
+# 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: DESCRIPTOR
+summary: Passes a list of column names to a table function.
+
+syntax:
+  sql: DESCRIPTOR(column1 [, column2]*)
+  java: descriptor("column1", "column2")

Review Comment:
   I tried it with py4j 0.10.9.7: `descriptor("a")` fails with `Method 
descriptor([class java.lang.String]) does not exist`. So leaving it out is 
right.



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