You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@beam.apache.org by "Sonam Ramchand (Jira)" <ji...@apache.org> on 2021/01/27 07:39:00 UTC

[jira] [Created] (BEAM-11696) Problems when implementing LOGICAL_AND aggregation function in ZetaSQL

Sonam Ramchand created BEAM-11696:
-------------------------------------

             Summary: Problems when implementing LOGICAL_AND aggregation function in ZetaSQL
                 Key: BEAM-11696
                 URL: https://issues.apache.org/jira/browse/BEAM-11696
             Project: Beam
          Issue Type: Bug
          Components: dsl-sql-zetasql
            Reporter: Sonam Ramchand


Reference: [https://github.com/google/zetasql/blob/master/docs/functions-and-operators.md#logical_and]

Performs a logical AND operation on expression and returns the result.

Supported Argument Types: BOOL
Returned Data Types: BOOL


Example:

 
{code:java}
SELECT LOGICAL_AND(x) AS logical_and FROM UNNEST([true, false, true]) AS x;

+-------------+
| logical_and |
+-------------+
| false       |
+-------------+
{code}
 

Problems: 

After implementation, there are two problems:
 * When input contains both null and non null values, the output is incorrect.
 * When input contains all null values, the output is:

{code:java}
No matching signature for aggregate function LOGICAL_AND for argument types: INT64. Supported signature: LOGICAL_AND(BOOL)  {code}

         which is same behavior as of BigQuery console. Though, it should return null.

How to test: unit tests

 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)