Skip to content

HIVE-28643: Fix "Error getting slot value" for Java 12 and above #5828

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

vrozov
Copy link
Member

@vrozov vrozov commented May 27, 2025

What changes were proposed in this pull request?

Use getDeclaredFields0 to try getting slot Field if getDeclaredField fails. Fallback to the old non deterministic behavior if slot field is not accessible.

Why are the changes needed?

Java 12 and above filters out private fields of the Field class causing "Error getting slot value".

Does this PR introduce any user-facing change?

No

How was this patch tested?

Verified manually that the error is gone on Java 17. Using existing test for the rest.

@kokila-19
Copy link
Contributor

kokila-19 commented May 27, 2025

@vrozov
Slot value was used as non-deterministic result would result in flaky test. Falling back to it won't be a good idea.

There is an alternative provided for this so I have already fixed it which is present JDK 17 PR , currently in WIP which will be rebased to the main PR soon.
94c3bb6

Using the MethodHandles privateLookupIn , slot can be accessed.

@vrozov
Copy link
Member Author

vrozov commented May 28, 2025

@kokila-19

Slot value was used as non-deterministic result would result in flaky test. Falling back to it won't be a good idea.

  1. Most of the time there will be no fallback. Field.class.getDeclaredField(name) will work in Java 8 and getDeclaredFields0.invoke will work in Java 12 and above.
  2. The fallback is provided as the last resort option to the old not deterministic behavior.

Using the MethodHandles privateLookupIn , slot can be accessed.

It requires JDK 9 and above. Do you suggest that support for JDK 8 is completely dropped in 4.1?

Copy link

@kokila-19
Copy link
Contributor

Yes. We can't support JDK8 and JDK17 together.
one example is "--add-opens" which won't be recognized by JDK8 because it does not know such an option.
Also, most of the dependencies that are upgraded use jdk17 specifically.

@vrozov
Copy link
Member Author

vrozov commented May 28, 2025

Yes. We can't support JDK8 and JDK17 together.

It is possible to compile to Java 8 byte code and test both with Java 8 and any other version of Java including 17. IMO, dropping support for Java 8 should be done as part of major version upgrade.

one example is "--add-opens" which won't be recognized by JDK8 because it does not know such an option.

The option applies only at runtime and may be provided for Java 17 only if necessary

Also, most of the dependencies that are upgraded use jdk17 specifically.

Which dependencies? All current dependencies are Java 8 compatible.

@deniskuzZ
Copy link
Member

deniskuzZ commented Jun 6, 2025

We are dropping support for jdk8 in Hive-4.1. jdk17 would be required for the compilation.

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.

4 participants