flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] hequn8128 commented on issue #6519: [FLINK-9559] [table] The type of a union of CHAR columns of different lengths should be VARCHAR
Date Fri, 24 Aug 2018 11:48:40 GMT
hequn8128 commented 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-415735866
 
 
   Hi @pnowojski , thanks for your reply. There are many cases need this feature. Not only
`case when`, but also `nvl`, `greatest` and `least`.  Most users encounter the blank problem
is `case when`. Examples have been added in the test cases. Below I will add some more examples:
   1. 
   ```
   SELECT country_name
   FROM (
   	SELECT CASE id
   			WHEN 1 THEN 'GERMANY'
   			WHEN 2 THEN 'CANADA'
   			ELSE 'INVALID COUNTRY ID'
   		END AS country_name
   	FROM country_id
   )
   WHERE country_name = 'GERMANY'
   ```
   This sql will output nothing since the blank problem. It is very confused.
   
   2. 
   ```
   SELECT country_name, country_info 
   FROM (
   	SELECT CASE id
   			WHEN 1 THEN 'GERMANY'
   			WHEN 2 THEN 'CANADA'
   			ELSE 'INVALID COUNTRY ID'
   		END AS country_name
   	FROM country_id
   ) nameTable join infoTable on nameTable.country_name = infoTable.country_name;
   ```
   This sql cannot join correctly since the blank problem. 'GERMANY' in nameTable becomes
'GERMANY           '.
   
   It is true the sql standard returns CHAR type, but nearly all major DBMSs return VARCHAR
without blank-padded.
   
   Thanks, Hequn
   

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message