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

HIVE-28582: OOM when compiling query with many GROUP BY columns aliased multiple times #5583

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

zabetak
Copy link
Member

@zabetak zabetak commented Dec 19, 2024

What changes were proposed in this pull request?

Copy RelMdUniqueKeys#getProjectUniqueKeys to HiveRelMdUniqueKeys handler to overcome the OOM till we upgrade to a Calcite version with the necessary fixes. The copy is almost exact minus a small adaptation in Util#transform that transforms the colMask bitset to a list.

Why are the changes needed?

The RelMdUniqueKeys handler has some logic that leads to an exponential increase of results (unique keys) when certain query/plan patterns appear. The problem has been addressed by CALCITE-6640 and CALCITE-6704 but those are not available in current Calcite version.

For more details see HIVE-28582.

Does this PR introduce any user-facing change?

No

Is the change a dependency upgrade?

No

How was this patch tested?

mvn test -Dtest=TestMiniLlapLocalCliDriver.java -Dqfile="cbo_unique_keys_oom.q"

…ed multiple times

The RelMdUniqueKeys handler has some logic that leads to an exponential increase of results (unique keys) when certain query/plan patterns appear.
The problem has been addressed by CALCITE-6640 and CALCITE-6704 but those are not available in current Calcite version.

Copy RelMdUniqueKeys#getProjectUniqueKeys
(https://github.com/apache/calcite/blob/648a832e0b3abc0f1cd4887847bdef7c133cb383/core/src/main/java/org/apache/calcite/rel/metadata/RelMdUniqueKeys.java#L162)
to HiveRelMdUniqueKeys handler to overcome the OOM till we upgrade to a Calcite version with the afforementioned fixes.
The copy is almost exact minus a small adaptation in Util#transform that transforms the colMask bitset to a list.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants