Skip to content

HIVE-29262: Incorrect column ordering output in case of different ordering of mutual columns in query & window function in vectorized PTF#6512

Open
tanishq-chugh wants to merge 5 commits into
apache:masterfrom
tanishq-chugh:HIVE-29262
Open

Conversation

@tanishq-chugh

@tanishq-chugh tanishq-chugh commented May 27, 2026

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

Reorder partition columns so they match the key input column sequence during Partitioned Table Function (PTF) execution

Why are the changes needed?

To ensure, the query column ordering is maintained in case of mutual columns in query and PTF having different ordering

Does this PR introduce any user-facing change?

Yes, the column ordering in the query now matches as the input column sequence provided by the user

How was this patch tested?

Manual Testing + added Qtest

@tanishq-chugh tanishq-chugh changed the title [WIP] HIVE-29262: Incorrect column ordering output in case of different ord… [WIP] HIVE-29262: Incorrect column ordering output in case of different ordering of mutual columns in query & window function Jun 16, 2026
@tanishq-chugh tanishq-chugh changed the title [WIP] HIVE-29262: Incorrect column ordering output in case of different ordering of mutual columns in query & window function HIVE-29262: Incorrect column ordering output in case of different ordering of mutual columns in query & window function Jun 17, 2026
LOAD DATA LOCAL INPATH '../../data/files/web_sales_2k' OVERWRITE INTO TABLE web_sales_txt;
select ws_bill_customer_sk,ws_item_sk from web_sales_txt;

SET hive.vectorized.execution.enabled;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why is this line needed? hive.vectorized.execution.enabled is set to true on line 1.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Hi @difin , Thanks for checking this!
was a leftover, removed in commit: a5e3bfc

ws_sold_date_sk,
ws_sales_price,
LAG(ws_sales_price) OVER (
PARTITION BY ws_item_sk,ws_bill_customer_sk

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please add a space between ws_item_sk,ws_bill_customer_sk

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added in commit: a5e3bfc

Comment on lines +97 to +99
SET hive.vectorized.execution.enabled=false;

SET hive.vectorized.execution.enabled;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This line seems unnecessary: SET hive.vectorized.execution.enabled;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Leftover, removed in commit: a5e3bfc

ORDER BY ws_sold_date_sk
) AS sales_price_diff
FROM
web_sales_txt;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you add comments explaining what test case is being tested before this and other SELECT queries in this .q file?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, comments would be essential to explain this Qtest. Added comments to explain all the SELECT queries being run in the Qtest in commit: a5e3bfc

@tanishq-chugh tanishq-chugh changed the title HIVE-29262: Incorrect column ordering output in case of different ordering of mutual columns in query & window function HIVE-29262: Incorrect column ordering output in case of different ordering of mutual columns in query & window function in vectorized PTF Jun 19, 2026
@sonarqubecloud

Copy link
Copy Markdown

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.

3 participants