Skip to content
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

map_from_entries: empty subquery returns null map #19835

Open
maingoh opened this issue Dec 17, 2024 · 1 comment
Open

map_from_entries: empty subquery returns null map #19835

maingoh opened this issue Dec 17, 2024 · 1 comment
Labels
type/bug Something isn't working
Milestone

Comments

@maingoh
Copy link

maingoh commented Dec 17, 2024

Describe the bug

I couldn't create a sample as I don't know how to how to create an empty array of rows. But a query like below return a null map when the subquery return no rows. I expected it to return an empty map instead.

Also, couldn't we simplify the syntax by removing the explicit array() ?

Error message/log

No response

To Reproduce

select map_from_entries(array(select row(foo.id, foo.name) from foo where foo.id=unrelated.id))

Expected behavior

Return an empty map instead of null

How did you deploy RisingWave?

No response

The version of RisingWave

version | PostgreSQL 13.14.0-RisingWave-2.0.4 (2d75798)

Additional context

No response

@maingoh maingoh added the type/bug Something isn't working label Dec 17, 2024
@maingoh maingoh changed the title map_from_entries: empty subquery returns null map_from_entries: empty subquery returns null map Dec 17, 2024
@github-actions github-actions bot added this to the release-2.2 milestone Dec 17, 2024
@xxchan
Copy link
Member

xxchan commented Dec 26, 2024

It seems to return empty map, instead of null:

dev=> select * from t;
┌───┐
│ x │
├───┤
└───┘
(0 rows)

dev=> select map_from_entries( array( select row(x,x) from t ));
┌──────────────────┐
│ map_from_entries │
├──────────────────┤
│ {}               │
└──────────────────┘
(1 row)

Could you provide a reproduciable example?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants