alamb opened a new issue, #12101:
URL: https://github.com/apache/datafusion/issues/12101

   ### Describe the bug
   
   When I try to concat two dictionary encoded columns it doesn't work
   
   
   
   ### To Reproduce
   
   Concat constants
   
   ```sql
   > 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
   ```sql
   > 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 https://github.com/apache/datafusion/pull/12063 with 
@dharanad 
   
   I believe the fix will be to extend `string_concat_coercion` (also changed 
in https://github.com/apache/datafusion/pull/12063) to also handle dictionaries.
   
   We can likely follow the model of dictionary comparison coercion: 
https://github.com/apache/datafusion/blob/121f330a6ccca008da4bf6ffc4efa4ffbf961fd7/datafusion/expr-common/src/type_coercion/binary.rs#L886


-- 
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: github-unsubscr...@datafusion.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to