alamb commented on issue #16903:
URL: https://github.com/apache/datafusion/issues/16903#issuecomment-3689591663

   > Also encountered a similar case for substr, the return type of `substr` is 
utf8view, so if we create a table with utf8view, then the column type will 
silently turn into `utf8view`, though we expect it to keep the input column's 
type -- utf8
   > 
   > ```
   > create table t as select substr(a, 5, 3) from t1; --t1.a is `uft8`
   > 
   > show columns from t;
   > 
   > datafusion public  t       substr(Utf8("a"),Int64(5),Int64(3))     
Utf8View        NO
   > ```
   
   Maybe we should just turn off that "optimization" for substr -- and maybe 
formalize the invariant that functions should try to maintain the same type as 
their inputs 🤔 
   
   For your particular case @xudong963 I think you could potentially workaround 
the issue by override your `substr` method with one that outputs Utf8 when 
given utf8 input


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to