[ 
https://issues.apache.org/jira/browse/CALCITE-1979?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Hequn Cheng updated CALCITE-1979:
---------------------------------
    Description: 
Considering such query:
{quote}
"SELECT a, case when c = 'Hi' then 'ARRIVAL' else 'DEPARTURE' end as cc, b FROM 
sourceTable"
{quote}
The result type of {{case when}} will be {{BasicSqlType}} with precision 9. 
This makes "ARRIVAL" to "ARRIVAL   " with two spaces behind.  
Also users may write the following query(with one space behind ARRIVAL):
{quote}
"SELECT a, case when c = 'Hi' then 'ARRIVAL ' else 'DEPARTURE' end as cc, b 
FROM sourceTable"
{quote}
The result type of {{case when}} will also be {{BasicSqlType}} with precision 9.
These may not what the users want. And I am wondering if there is a way to 
solve this problem?

  was:
Considering such query:
{quote}
"SELECT a, case when c = 'Hi' then 'ARRIVAL' else 'DEPARTURE' end as cc, b FROM 
sourceTable"
{quote}
The result type of {{case when}} will be {{BasicSqlType}} with precision 9. 
This makes "ARRIVAL" to "ARRIVAL   " with two spaces behind.  
Also users may write the following query(with one space behind ARRIVAL):
"SELECT a, case when c = 'Hi' then 'ARRIVAL ' else 'DEPARTURE' end as cc, b 
FROM sourceTable"
{quote}
The result type of {{case when}} will also be {{BasicSqlType}} with precision 9.
These may not what the users want. And I am wondering if there is a way to 
solve this problem?


> Case When result type precision problem
> ---------------------------------------
>
>                 Key: CALCITE-1979
>                 URL: https://issues.apache.org/jira/browse/CALCITE-1979
>             Project: Calcite
>          Issue Type: Improvement
>          Components: core
>            Reporter: Hequn Cheng
>            Assignee: Julian Hyde
>
> Considering such query:
> {quote}
> "SELECT a, case when c = 'Hi' then 'ARRIVAL' else 'DEPARTURE' end as cc, b 
> FROM sourceTable"
> {quote}
> The result type of {{case when}} will be {{BasicSqlType}} with precision 9. 
> This makes "ARRIVAL" to "ARRIVAL   " with two spaces behind.  
> Also users may write the following query(with one space behind ARRIVAL):
> {quote}
> "SELECT a, case when c = 'Hi' then 'ARRIVAL ' else 'DEPARTURE' end as cc, b 
> FROM sourceTable"
> {quote}
> The result type of {{case when}} will also be {{BasicSqlType}} with precision 
> 9.
> These may not what the users want. And I am wondering if there is a way to 
> solve this problem?



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to