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

Fix for #848 (not_constant fails within groups with 1 element) #849

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

igor-lobanov-maersk
Copy link

resolves #848

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 described in the bug report for #848, not_constant generic test fails when grouping is used and one of the groups has only one element. The implementation considers the value of this one element constant and fails the test. Whilst such interpretation is technically correct, the context where such test is used a different interpretation arguably would be preferable. I provided additional details in the bug report.

Checklist

  • This code is associated with an Issue which has been triaged and accepted for development. Not really, I just filed a bug report, but found it's trivial to fix
  • 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) I only have access to Dremio environment, and I tested it there
    • BigQuery
    • Postgres
    • Redshift
    • Snowflake
  • I followed guidelines to ensure that my changes will work on "non-core" adapters by:
    • dispatching any new macro(s) so non-core adapters can also use them (e.g. the star() source) N/A
    • using the limit_zero() macro in place of the literal string: limit 0 N/A
    • using dbt.type_* macros instead of explicit datatypes (e.g. dbt.type_timestamp() instead of TIMESTAMP N/A
  • I have updated the README.md (if applicable) N/A
  • I have added tests & descriptions to my models (and macros if applicable) No, see below
  • I have added an entry to CHANGELOG.md

I did not add a test, because it's not clear to me how such tests are written. There is no prior test for not_constant macro to extend. That said, I'm happy to write one with some guidance from the core team.

Copy link

This PR has been marked as Stale because it has been open with no activity as of late. If you would like the PR to remain open, please comment on the PR or else it will be closed in 7 days.

@github-actions github-actions bot added the Stale label Apr 16, 2024
@dbeatty10 dbeatty10 added bug Something isn't working and removed Stale labels Apr 18, 2024
Copy link
Contributor

@dbeatty10 dbeatty10 left a comment

Choose a reason for hiding this comment

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

@igor-lobanov-maersk many apologies for the delayed review here!

Could you add a test case for the scenario that your PR is fixing? That way we can confirm it fails without your fix but succeeds afterwards.

Here's an example:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

not_constant may generate false positive if used with group_by_column
2 participants