You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@beam.apache.org by "Gleb Kanterov (Jira)" <ji...@apache.org> on 2019/08/23 07:16:00 UTC

[jira] [Commented] (BEAM-8039) SUM(CASE WHEN xxx THEN 1 ELSE 0)

    [ https://issues.apache.org/jira/browse/BEAM-8039?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16914005#comment-16914005 ] 

Gleb Kanterov commented on BEAM-8039:
-------------------------------------

A workaround would be supporting COUNTIF function from ZetaSQL, that might be easier to implement than more generic rewrites.

> SUM(CASE WHEN xxx THEN 1 ELSE 0)
> --------------------------------
>
>                 Key: BEAM-8039
>                 URL: https://issues.apache.org/jira/browse/BEAM-8039
>             Project: Beam
>          Issue Type: Sub-task
>          Components: dsl-sql-zetasql
>            Reporter: Rui Wang
>            Priority: Major
>
> java.lang.RuntimeException: Aggregate function only accepts Column Reference or CAST(Column Reference) as its input.
> I was able to rewrite SQL using WITH statement, and it seemed to work, but requires us rewriting a lot of queries and makes them pretty much unreadable.



--
This message was sent by Atlassian Jira
(v8.3.2#803003)