Skip to content

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

Merged
LakshSingla merged 1 commit intoapache:masterfrom
Akshat-Jain:msq-wf-fix-missing-boost-column
Sep 25, 2024
Merged

MSQ window functions: Fix boost column not being written to the frame in window stage#17141
LakshSingla merged 1 commit intoapache:masterfrom
Akshat-Jain:msq-wf-fix-missing-boost-column

Conversation

@Akshat-Jain
Copy link
Copy Markdown
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
Copy Markdown
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

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