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 SourceScanOptimizer generating duplicated columns #1494

Merged
merged 9 commits into from
Nov 5, 2024

Commits on Oct 30, 2024

  1. Check when optimizing metric scans with similar aliases

    This commit adds a check to `can_combine`, which is called by the
    `SourceScanOptimizer` when determining whether it can combine two
    branches into one.
    
    The new check makes sure we only combine branches if:
    - both branches don't share aliases
    - if they do share aliases, the aliases refer to different things
    serramatutu committed Oct 30, 2024
    Configuration menu
    Copy the full SHA
    b0a54fe View commit details
    Browse the repository at this point in the history
  2. Add tests for derived metrics with shared aliases

    This commit adds dataflow and SQL snapshot tests that verify we're not
    generating duplicated aliases when combining branches.
    
    I created 3 new dummy metrics for these tests: `derived_sharedalias_1a`,
    `derived_sharedalias_1b` and `derived_sharedalias_2`. The `1a` and `1b`
    variant both make `shared_alias` refer to `bookings`, while the `2`
    variant makes it refer to `instant_bookings`. This way we can test the 2
    cases:
    - If the alias refers to the same thing (`1a` vs `1b`), we can merge
    branches safely
    - If the alias refers to different things (`1a` vs `2`), we cannot merge
    branches safely
    serramatutu committed Oct 30, 2024
    Configuration menu
    Copy the full SHA
    cac1d59 View commit details
    Browse the repository at this point in the history
  3. Add integration test for derived metrics with shared aliases

    This commit adds a new integration test that uses
    `derived_sharedalias_1a` and `derived_sharedalias_2`.
    
    I manually optimized the SQL from the output of the optimized SQL
    snapshot.
    serramatutu committed Oct 30, 2024
    Configuration menu
    Copy the full SHA
    2f9bf6b View commit details
    Browse the repository at this point in the history
  4. Changelog entry

    serramatutu committed Oct 30, 2024
    Configuration menu
    Copy the full SHA
    ba207b9 View commit details
    Browse the repository at this point in the history

Commits on Nov 4, 2024

  1. fixup! Changelog entry

    serramatutu committed Nov 4, 2024
    Configuration menu
    Copy the full SHA
    86fbfbd View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    1b7d1bc View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    8a7b603 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    57e0611 View commit details
    Browse the repository at this point in the history

Commits on Nov 5, 2024

  1. Configuration menu
    Copy the full SHA
    3583f92 View commit details
    Browse the repository at this point in the history