pnowojski edited a comment on issue #6519: [FLINK-9559] [table] The type of a 
union of CHAR columns of different lengths should be VARCHAR
URL: https://github.com/apache/flink/pull/6519#issuecomment-416559091
 
 
   Yes, sorry for my mistake there, I realised about it too late and was in the 
process of fixing it, but it took me quite some time to find a way to determine 
the actual data type returned from `case`. 
   
   In your examples, you are missing one important issue: what's the type of 
string literal. Check out those examples:
   
   PostgreSQL
   http://sqlfiddle.com/#!17/c6522/1
   
   - string literals are of `UNKNOWN` type, that behaves like `VARCHAR`
   - `case when` on `CHAR` arguments returns `CHAR` type.
   
   MSSQL:
   http://sqlfiddle.com/#!18/50a92/1/0
   (click `browser` schema button and explore `types_test` view)
   
   - string literals are `VARCHAR`
   - `case when` return type strictly follows the standard - `CHAR(8)`
   
   Oracle:
   http://sqlfiddle.com/#!4/50a92/1/0
   (click `browser` schema button and explore `types_test` view)
   
   - string literals are `CHAR`
   - `case when` return type `VARCHAR`
   
   This is still hardly conclusive to motivate the change for me.
   
   I'm not sure why are you rejecting my proposal to change default string 
literal type to `VARCHAR`. It would fix all of our `CHAR` problems 
(comparisons, connector support, functions support, etc)  for now and `case 
when` would return `VARCHAR` automatically. Even if in the future we would want 
to provide a configuration switch `string-literals-type: char/varchar`, such 
configuration option would be cleaner and much easier to understand compared to 
`shouldConvertRaggedUnionTypesToVarying`.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to