raminqaf opened a new pull request, #30206:
URL: https://github.com/apache/flink/pull/30206
## What is the purpose of the change
Part of FLINK-23804, next to #30200: every collection function and every row
and structured type function gets a page of its own, generated from YAML. Each
page was rechecked against the implementation, and every example result comes
from running its SQL in batch and streaming mode. The recheck changed what the
docs say, for example:
| Function | Old docs
| Master
|
|--------------------|-------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `arr[pos]` | "Returns the element at position INT in array. The
index starts from 1." | Past the end of an array with a NOT
NULL element type, a placeholder comes back instead of NULL: `ARRAY[10, 20,
30][pos]` with a `pos` of 4 is `-1`, and `IS NULL` is FALSE |
| `ARRAY_CONTAINS` | "The given element is cast implicitly to the array's
element type if necessary." | The cast cuts strings:
`ARRAY_CONTAINS(ARRAY['USA', 'CAN', 'MX'], country)` is TRUE for a `country` of
`'CANADA'` |
| `ARRAY_UNION` | "Returns an array of the elements in the union of
array1 and array2, without duplicates." | Inside `UNNEST`, the elements aren't
cast to their common type: `UNNEST(ARRAY_UNION(ARRAY[a], ARRAY[2.5E0]))`
returns `4.9E-324` instead of `1.0` for an `INT` `a` of 1. Seven other
functions lose their implicit casts there too |
| `map[key]` | "Returns the value specified by key value in map."
| Fails the job with a `ClassCastException`
on the result of `MAP_FROM_ARRAYS` or `MAP_FROM_ENTRIES`, and of `MAP_UNION`
once a map after the first has entries |
| `IS DISTINCT FROM` | "returns FALSE if both values are equal or both are
NULL, and TRUE otherwise" | On rows of two fields or more, TRUE
only if every field differs: `ROW(a, 'x') IS DISTINCT FROM ROW(a + 1, 'x')` is
FALSE |
## Brief change log
- Add 29 pages for the 30 rows of the Collection table and 5 pages for the 5
rows of the Row & Structured table, and point every row at its page.
CARDINALITY gets one page for arrays and maps. The ARRAY and MAP subscripts get
pages of their own, like the VARIANT subscript.
- Arguments are named after their role: `arr`, `arr1`, `arr2`, `m`, `map1`,
`map2`, `needle`, `element`, `pos` and `key_expr`. The Table API column shows
the Java calls.
- The `ARRAY_JOIN` and `ARRAY_SORT` rows lose their Table API column. They
listed `array.arrayJoin(...)` and `array.arraySort(...)`, which the Table API
doesn't have.
- The third commit adds one note on rows and structured objects to the
existing `IS DISTINCT FROM` page. It's a separate commit because it links to
the new ROW constructor page.
- Chinese pages show the English sections. Where a row had a Chinese
description, its first sentence becomes the summary. Three summaries
contradicted or misstated their page and were dropped. This drops 584 of the
930 Chinese characters of the two tables. FLINK-41746 translates these pages,
as FLINK-41738 does for the string functions.
## Verifying this change
This change is documentation only.
- Every SQL example ran in batch and streaming mode on master with a local
runner, which isn't part of this PR. The results on the pages are pasted from
those runs. Collections built in a `VALUES` row get folded into literals at
planning, so the runtime claims were also checked on a `datagen` source.
- A second review checked each statement against the type strategies, the
code generation, the runtime classes and the tests. A third pass removed what
the reviews of #29864 and #30033 asked to leave out.
- Hugo 0.126.3 builds both languages without warnings at every commit. A
link check finds no new broken internal links.
The recheck found bugs in the code, which this PR doesn't fix. The pages
describe the current behavior, also where it's a bug that users would plausibly
hit, such as the results above. The pages name no tickets. I'll file the bugs
separately.
#29882 changes what an element access past the end returns. Whichever of the
two PRs merges second updates the notes on the ARRAY subscript, MAP subscript,
ELEMENT and Field access pages.
## Does this pull request potentially affect one of the following parts:
- Dependencies (does it add or upgrade a dependency): no
- The public API, i.e., is any changed class annotated with
`@Public(Evolving)`: no
- The serializers: no
- The runtime per-record code paths (performance sensitive): no
- Anything that affects deployment or recovery: JobManager (and its
components), Checkpointing, Kubernetes/Yarn, ZooKeeper: no
- The S3 file system connector: no
## Documentation
- Does this pull request introduce a new feature? no
- If yes, how is the feature documented? not applicable
---
##### Was generative AI tooling used to co-author this PR?
- [X] Yes (please specify the tool below)
Generated-by: Claude Code 2.1.332 (Claude Opus 5.5)
--
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]