[teiid-issues] [JBoss JIRA] (TEIID-3794) Impala Count Distinct with Case Statement Generates Bad SQL

Scott Wallace (JIRA) issues at jboss.org
Thu Oct 29 16:54:00 EDT 2015


Scott Wallace created TEIID-3794:
------------------------------------

             Summary: Impala Count Distinct with Case Statement Generates Bad SQL
                 Key: TEIID-3794
                 URL: https://issues.jboss.org/browse/TEIID-3794
             Project: Teiid
          Issue Type: Feature Request
          Components: Misc. Connectors
    Affects Versions: 8.12
            Reporter: Scott Wallace
            Assignee: Steven Hawkins
             Fix For: 8.12.x


Executing a query like:
{noformat}
select count(distinct case when string_column='X' then bigint_column end)
from some_vdb
{noformat}

Translates as the following in Impala:
{noformat}
SELECT COUNT(DISTINCT (CASE WHEN (`string_column` = 'X') THEN `bigint_column` ELSE CAST(NULL AS STRING) END)) as `EXPR_0` FROM `some_table`
{noformat}

Which fails with the following error:
{noformat}
AnalysisException: Incompatible return types 'BIGINT' and 'STRING' of exprs 'integer_column' and 'CAST(NULL AS STRING)'.
{noformat}



--
This message was sent by Atlassian JIRA
(v6.4.11#64026)


More information about the teiid-issues mailing list