Jonathan Leech created PHOENIX-1716:
---------------------------------------

             Summary: queries with to_char() return incorrect results
                 Key: PHOENIX-1716
                 URL: https://issues.apache.org/jira/browse/PHOENIX-1716
             Project: Phoenix
          Issue Type: Bug
    Affects Versions: 4.2
            Reporter: Jonathan Leech


Using to_char() in a nested query causes it to get confused and return the 
value of the first column twice. 

Example:
select 
 to_char(case when foo < 0 then 18446744073709551616.0 + foo else foo end, '0') 
foo,
 to_char(case when bar < 0 then 18446744073709551616.0 + bar else bar end, '0') 
bar
from (
select cast(12345 as bigint) foo, cast(233456 as bigint) bar  from 
system."SEQUENCE" limit 1
);

Workarounds: Use different but equivalent format strings in each column, make 
subtle changes to the beginning of the columns; e.g. change to 0 + case 
when..., 0.0 + case when....





--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to