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

Steven Hawkins (JIRA) issues at jboss.org
Thu Oct 29 19:12:00 EDT 2015


     [ https://issues.jboss.org/browse/TEIID-3794?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Steven Hawkins updated TEIID-3794:
----------------------------------
    Issue Type: Bug  (was: Feature Request)


> Impala Count Distinct with Case Statement Generates Bad SQL
> -----------------------------------------------------------
>
>                 Key: TEIID-3794
>                 URL: https://issues.jboss.org/browse/TEIID-3794
>             Project: Teiid
>          Issue Type: Bug
>          Components: Misc. Connectors
>    Affects Versions: 8.12
>            Reporter: Scott Wallace
>            Assignee: Steven Hawkins
>
> 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