-
Notifications
You must be signed in to change notification settings - Fork 590
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(expr): array_to_string
should handle multidimensional array recursively
#10469
Conversation
for element in array.flatten() { | ||
let Some(element) = element else { continue }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The old .iter().flatten()
means to iter 1 layer, then remove nulls.
The new .flatten()
means to flatten (unnest) recursively. Nulls are removed via let-else.
The 2 flatten
are completely different, one on Iterator<Item=Option<T>>
while the other on ListRef
Codecov Report
@@ Coverage Diff @@
## main #10469 +/- ##
==========================================
- Coverage 70.51% 70.50% -0.01%
==========================================
Files 1260 1260
Lines 215075 215076 +1
==========================================
- Hits 151651 151649 -2
- Misses 63424 63427 +3
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 4 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
So have we decided to be compatible with PG's behavior for those function with the same name? |
Yes. To elaborate:
|
I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.
What's changed and what's your intention?
Fixes #8680. See #3811 (comment) for rationale.
This is consistent with
unnest
andcardinality
(andarray_replace
in the future).Note the following (with
::text[]
rather than::text[][]
) is still different from PostgreSQL:This is not related to the
array_to_string
function. In PostgreSQL,::text[]
still returns a 2d array with 4 elements, while we return a 1d array with 2 elements, first of which is a result ofarray['one', 'two']::text
. This is intentional.We do not guarantee backward compatibility of experimental multidimensional array.
Checklist
./risedev check
(or alias,./risedev c
)Documentation
Click here for Documentation
Types of user-facing changes
Please keep the types that apply to your changes, and remove the others.
Release note