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

[b/330573524] Prevent IF from treating NULL as FALSE #49

Merged
merged 1 commit into from
Mar 28, 2024

Commits on Mar 27, 2024

  1. [b/330573524] Prevent IF from treating NULL as FALSE

    Tableau offers the IIF function with the signature IIF(bool, val1, val2[, val3]). If bool is TRUE, it returns val1, if it is FALSE, it returns val2, and if it is NULL, it returns val3 if provided, otherwise it returns NULL.
    
    Previously, we translated this behavior by rewriting it as BigQuery's IF. The issue however, is that if bool is NULL, BigQuery defaults to val2 instead of NULL or val3.
    
    This commit corrects for that by wrapping the expression in another IF that checks if bool is NULL. If it is, it returns val3 if specified, otherwise NULL. If bool is not null, it follows normal IF behavior.
    tanclary committed Mar 27, 2024
    Configuration menu
    Copy the full SHA
    18117bb View commit details
    Browse the repository at this point in the history