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

MSQ window functions: Fix boost column not being written to the frame in window stage #17141

Merged

Conversation

Akshat-Jain
Copy link
Contributor

@Akshat-Jain Akshat-Jain commented Sep 24, 2024

Description

In WindowOperatorQueryFrameProcessor, currently we were not adding the partition boost column to the ColumnSelectorFactory used to create the FrameWriter. Because of this, the boost column was not being written to the frame.

This was causing the quantile sketch to misjudge the number of output partitions to create, as it was creating a single partition boundary because we had the same value for boost column (null byte) across all rows.

For example, for the following query with maxNumTasks=5:

REPLACE INTO "test_1" OVERWRITE ALL
SELECT
  "__time",
  "countryName",
  "cityName",
  count(cityName) over (partition by countryName) as countCity,
  ROW_NUMBER() over (partition by countryName) as rowNumberCity
FROM "wikipedia"
group by __time, countryName, cityName
PARTITIONED BY HOUR
CLUSTERED BY countryName

Currently, we were getting 1 worker in the Scan stage after the Window stage:

image

With this PR's change, we get multiple workers in the Scan stage after the Window stage:

image

Test changes of the PR

  • I had to update some MSQ drill tests to use single worker as they were giving a different correct result. I could add some order by to try and make the output deterministically correct for queries of these tests, but since these were tests from the drill suite, I thought it's best to leave them untouched and just use a single worker for these.
  • The changes in testWindowOnMixOfEmptyAndNonEmptyOverWithMultipleWorkers reflects the above situation where previously we were getting 1 worker in the stage after the Window stage, but now we're getting 4 workers (as we use maxNumTasks=5 in this particular test).

This PR has:

  • been self-reviewed.
  • added documentation for new or modified features or behaviors.
  • a release note entry in the PR description.
  • added Javadocs for most classes and all non-trivial methods. Linked related entities via Javadoc links.
  • added or updated version, license, or notice information in licenses.yaml
  • added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader.
  • added unit tests or modified existing tests to cover new code paths, ensuring the threshold for code coverage is met.
  • added integration tests.
  • been tested in a test Druid cluster.

@github-actions github-actions bot added Area - Batch Ingestion Area - MSQ For multi stage queries - https://github.com/apache/druid/issues/12262 labels Sep 24, 2024
Copy link
Contributor

@LakshSingla LakshSingla left a comment

Choose a reason for hiding this comment

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

LGTM

@LakshSingla LakshSingla added this to the 31.0.0 milestone Sep 24, 2024
@LakshSingla LakshSingla merged commit 446ffc3 into apache:master Sep 25, 2024
56 checks passed
@317brian 317brian added the Bug label Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area - Batch Ingestion Area - MSQ For multi stage queries - https://github.com/apache/druid/issues/12262 Bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants