Skip to content

HIVE-29470: Add unit test to verify commonLocalResources after openin…#6338

Merged
abstractdog merged 1 commit intoapache:masterfrom
kokila-19:jar_localization
Mar 4, 2026
Merged

HIVE-29470: Add unit test to verify commonLocalResources after openin…#6338
abstractdog merged 1 commit intoapache:masterfrom
kokila-19:jar_localization

Conversation

@kokila-19
Copy link
Contributor

…g a Tez session

Ensures buildCommonLocalResources populates the map with the hive-exec app jar and localized resources so regressions are caught if resource registration is removed.

What changes were proposed in this pull request?

Added testCommonLocalResourcesPopulatedOnSessionOpen() to assert that commonLocalResources includes:
the hive-exec app jar and all localized resources when opening a Tez session.

Why are the changes needed?

Resource registration in openInternalUnsafe (adding the app jar and localized resources to commonLocalResources) had no test coverage. Because of that, tests still passed when that registration was removed or commented out, so a regression could go undetected.
This PR adds unit test coverage so that if the commonLocalResources.put() calls for the app jar or localized resources are removed, the new test fails and the regression is caught.

Does this PR introduce any user-facing change?

No

How was this patch tested?

Unit test

HiveConf hiveConf = new HiveConfForTest(getClass());
hiveConf.set("hive.security.authorization.manager",
"org.apache.hadoop.hive.ql.security.authorization.plugin.sqlstd.SQLStdConfOnlyAuthorizerFactory");
SessionState.start(hiveConf);
Copy link
Contributor

Choose a reason for hiding this comment

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

start method returns the SessionState object with can be used later instead of SessionState.get(): while this also work, the object is better to be seen clearly here, instead of relying on the whole ThreadLocal magic of the SessionState universe

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Addressed the issue and also added common method to reuse for all test cases.

@abstractdog
Copy link
Contributor

thanks @kokila-19 , looks good to me, I only had a minor comment

…g a Tez session

Ensures buildCommonLocalResources populates the map with the hive-exec app
jar and localized resources so regressions are caught if resource
registration is removed.
@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 4, 2026

@abstractdog
Copy link
Contributor

LGTM, using createSessionState is even better, thanks! (and you fixed the same issue in another method that I wrote earlier :D )

@abstractdog abstractdog self-requested a review March 4, 2026 10:08
@abstractdog abstractdog merged commit 89631dc into apache:master Mar 4, 2026
4 checks passed
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