Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bigquery fail - Error when use function STRING_AGG with IGNORE NULLS #142

Closed
lveras opened this issue Nov 18, 2022 · 2 comments
Closed

Bigquery fail - Error when use function STRING_AGG with IGNORE NULLS #142

lveras opened this issue Nov 18, 2022 · 2 comments

Comments

@lveras
Copy link

lveras commented Nov 18, 2022

Error when use function STRING_AGG with IGNORE NULLS

Query sample:

WITH agg_phones AS (
    SELECT
        m.stone_code,
        ct.name AS type,
        c.contact_name AS name,
        ARRAY_AGG(DISTINCT email IGNORE NULLS) AS email,
        ARRAY_AGG(DISTINCT c.mobile_phone_number IGNORE NULLS) AS m_phone,
        ARRAY_AGG(DISTINCT c.phone_number IGNORE NULLS) AS phone,
        MAX(c.last_modified_date) as last_modified_date
    FROM
        ...
)
​
SELECT
    stone_code,
    type,
    name,
    email,
    ARRAY(SELECT DISTINCT phones
        FROM
            UNNEST(ARRAY_CONCAT(m_phone, phone)) AS phones
    ) AS phones_array,
    last_modified_date,
    CURRENT_TIMESTAMP AS processed_at
FROM
    agg_phones

How to reproduce?

@klahnakoski
Copy link
Owner

6191ba9

@klahnakoski
Copy link
Owner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants