Skip to content

Cannot infer common string type for string concat operation Dictionary(Int32, Utf8) || Dictionary(Int32, Utf8) #12101

@alamb

Description

@alamb

Describe the bug

When I try to concat two dictionary encoded columns it doesn't work

To Reproduce

Concat constants

> select arrow_cast('foo', 'Dictionary(Int32, Utf8)') || arrow_cast('bar', 'Dictionary(Int32, Utf8)');
Error during planning: Cannot infer common string type for string concat operation Dictionary(Int32, Utf8) || Dictionary(Int32, Utf8)

Concat columns

> create table t as values (arrow_cast('foo', 'Dictionary(Int32, Utf8)'), arrow_cast('bar', 'Dictionary(Int32, Utf8)'));
0 row(s) fetched.
Elapsed 0.010 seconds.

> select column1 || column2 from t;
Error during planning: Cannot infer common string type for string concat operation Dictionary(Int32, Utf8) || Dictionary(Int32, Utf8)

Expected behavior

Both queries should result in the single string foobar

Additional context

Found this working on #12063 with @dharanad

I believe the fix will be to extend string_concat_coercion (also changed in #12063) to also handle dictionaries.

We can likely follow the model of dictionary comparison coercion:

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinggood first issueGood for newcomers

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions