Skip to content

Regression: Coercion stopped working for coalesce on a dictionary column #9925

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
Tracked by #9904
alamb opened this issue Apr 3, 2024 · 3 comments · Fixed by #9958
Closed
Tracked by #9904

Regression: Coercion stopped working for coalesce on a dictionary column #9925

alamb opened this issue Apr 3, 2024 · 3 comments · Fixed by #9958
Labels
bug Something isn't working regression Something that used to work no longer does

Comments

@alamb
Copy link
Contributor

alamb commented Apr 3, 2024

Describe the bug

coalesce on a dictionary column worked on 36.0.0 but does not in 37.0.0

To Reproduce

It works in 3.6.0

DataFusion CLI v36.0.0

❯ create table test as values (arrow_cast('foo', 'Dictionary(Int32, Utf8)')), (null);
0 rows in set. Query took 0.035 seconds.

❯ select  coalesce(column1, 'none_set') from test;
+-----------------------------------------+
| coalesce(test.column1,Utf8("none_set")) |
+-----------------------------------------+
| foo                                     |
| none_set                                |
+-----------------------------------------+
2 rows in set. Query took 0.018 seconds.

Fails in 37.0.0:

DataFusion CLI v37.0.0
❯ create table test as values (arrow_cast('foo', 'Dictionary(Int32, Utf8)')), (null);
0 row(s) fetched.
Elapsed 0.021 seconds.

❯ select  coalesce(column1, 'none_set') from test;
Error during planning: No function matches the given name and argument types 'coalesce(Dictionary(Int32, Utf8), Utf8)'. You might need to add explicit type casts.
	Candidate functions:
coalesce(CoercibleT, .., CoercibleT)

Expected behavior

Should get the same answer as 36.0.0

Additional context

Maybe related to #9459

Kudos to @btasker for reporting this internally ❤

@alamb alamb changed the title Regression: Coercsion stopped working for coalesce on a dictionary column Regression: Coercion stopped working for coalesce on a dictionary column Apr 3, 2024
@alamb alamb added bug Something isn't working regression Something that used to work no longer does labels Apr 3, 2024
@alamb
Copy link
Contributor Author

alamb commented Apr 3, 2024

Workaround is to cast colum1 to string:

select coalesce(column1::string, 'none_set') from test

@Lordworms
Copy link
Contributor

interested in this one

@alamb
Copy link
Contributor Author

alamb commented Apr 3, 2024

Thanks @Lordworms

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working regression Something that used to work no longer does
Projects
None yet
2 participants