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

Limit columns selected in expression_is_true if failures not stored. #686

Merged
merged 3 commits into from
Sep 28, 2022

Conversation

elyobo
Copy link
Contributor

@elyobo elyobo commented Sep 25, 2022

Fixes #683

resolves #

This is a:

  • documentation update
  • bug fix with no breaking changes
  • new functionality
  • a breaking change

All pull requests from community contributors should target the main branch (default).

Description & motivation

As discussed in #683, the default behaviour for the expression_is_true test is to SELECT * which is expensive in some engines. The change instead does SELECT 1 unless should_store_failures() is true, resulting in faster and cheaper tests.

Checklist

  • This code is associated with an Issue which has been triaged and accepted for development.
  • I have verified that these changes work locally on the following warehouses (Note: it's okay if you do not have access to all warehouses, this helps us understand what has been covered)
    • BigQuery
    • Postgres
    • Redshift
    • Snowflake
  • I followed guidelines to ensure that my changes will work on "non-core" adapters by: Not applicable
    • dispatching any new macro(s) so non-core adapters can also use them (e.g. the star() source)
    • using the limit_zero() macro in place of the literal string: limit 0
    • using dbt.type_* macros instead of explicit datatypes (e.g. dbt.type_timestamp() instead of TIMESTAMP
  • I have updated the README.md (if applicable) Not applicable
  • I have added tests & descriptions to my models (and macros if applicable) not sure if required, existing tests pass
  • I have added an entry to CHANGELOG.md

Maayan-s and others added 2 commits September 20, 2022 07:34
* Update from template to dbt copyright

I want to give proper attribution and licensing to code from dbt_utils that I'm using, so made this fix. Hope it's ok.

* Update LICENSE
@elyobo
Copy link
Contributor Author

elyobo commented Sep 25, 2022

Tests not added, but existing tests pass; happy to add tests but not sure how to do so.

@joellabes joellabes changed the base branch from main to utils-v1 September 28, 2022 02:31
Copy link
Contributor

@joellabes joellabes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @elyobo! Since this is changing the behaviour of the test, I've moved it to come out with the v1 release of dbt utils next month.

@joellabes joellabes merged commit c15d55e into dbt-labs:utils-v1 Sep 28, 2022
@elyobo elyobo deleted the cheaper-expression-is-true branch September 28, 2022 04:36
@elyobo
Copy link
Contributor Author

elyobo commented Sep 28, 2022

Cool, thanks @joellabes, appreciate the merge.

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

Successfully merging this pull request may close these issues.

expression_is_true is costly when applied to a large table
3 participants