-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
ARROW-15755: [Java] Support Java 17 #12941
Conversation
…g.apache.hadoop.shaded.com.ctc.wstx.io.InputBootstrapper
You will want to rebase to get CI to run. Can we add a CI job that tests JDK17? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working this out. I think we just need to make sure to cover this in CI.
@@ -736,6 +738,7 @@ | |||
See https://github.com/jbosstools/m2e-apt/issues/62 for details | |||
--> | |||
<activation> | |||
<jdk>1.8</jdk> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, we already have a 1.8-specific profile below. What's the difference?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed
<arg>-XDcompilePolicy=simple</arg> | ||
<arg> | ||
-Xplugin:ErrorProne \ | ||
-XepExcludedPaths:.*/(target/generated-sources)/.* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit, but can these be two separate <arg>
blocks or does it not work that way?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does not work on that way.
Be aware that when running on JDK 8 the flags cannot be wrapped across multiple lines. JDK 9 and above do allow the flags to be separated by newlines. That is, the second element above can also be formatted as follows on JDK 9+, but not on JDK 8:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, weird.
@@ -111,6 +111,7 @@ public void testNullPointersHashCode() { | |||
} | |||
|
|||
@Test | |||
@SuppressWarnings("ReturnValueIgnored") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe instead of suppresing we can check that the hash code changes/doesn't change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can remove the suppression now right?
@@ -77,6 +77,7 @@ | |||
/** | |||
* Flight client with Flight SQL semantics. | |||
*/ | |||
@SuppressWarnings({"ProtoBuilderReturnValueIgnored", "ReturnValueIgnored"}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, this is a very wide scope to suppress. Is it possible to refactor things?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed
@@ -97,6 +97,7 @@ public void mixedProperties() { | |||
testHeaders(headers); | |||
} | |||
|
|||
@SuppressWarnings("ReturnValueIgnored") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, maybe an assertTrue(....hasNext())
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed
<groupId>commons-logging</groupId> | ||
<artifactId>commons-logging</artifactId> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a brief comment about why we need to exclude these?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the reason is [WARNING] Rule 0: org.apache.maven.plugins.enforcer.BannedDependencies failed with message: Found Banned Dependency: commons-logging:commons-logging:jar:1.1.3
. Let me add some message on the exclude tag.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I didn't realize we had a bannedDependencies set. Ok, it's probably fine to leave this as is then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Though uh wow, that's been there since the initial Arrow commit in 2016. Are we sure Hadoop functions without this dependency, incidentally?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unit test is working without problems in JSE 8, JSE 11 but not in JSE 17, that is the reason because we added now.
@lwhite1 You might want to take a look at this. |
@pitrou will do |
For CI jobs please take a look at https://issues.apache.org/jira/browse/ARROW-15177. Thank for your support @raulcd |
Well I don't think we should merge this without a CI job to actually validate it. |
Either that, or we should make sure to validate JDK17 during the 8.0.0 vote. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than my one nit on SuppressWarnings, this looks good to me.
@@ -246,9 +246,11 @@ public FlightClientMiddleware onCallStarted(CallInfo info) { | |||
} | |||
|
|||
// Used to test that middleware can send and receive multi-valued text and binary headers. | |||
@SuppressWarnings({"DoubleBraceInitialization"}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe just initialize these values (here and below) the old-fashioned way, rather than add the SuppressWarnings?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, changed
EXPECTED_BINARY_HEADERS.put("x-binary-bin", Arrays.asList(new byte[] {0}, new byte[]{1})); | ||
EXPECTED_TEXT_HEADERS.put("x-text", Arrays.asList("foo", "bar")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, inline the declarations here too if they're only used in this test? Else put the initialization in a static
block
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed
java/flight/flight-sql/src/main/java/org/apache/arrow/flight/sql/FlightSqlClient.java
Show resolved
Hide resolved
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED</arg> | ||
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED</arg> | ||
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED</arg> | ||
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED</arg> | ||
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED</arg> | ||
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED</arg> | ||
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED</arg> | ||
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED</arg> | ||
<arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED</arg> | ||
<arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED</arg> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this change mean that consumers of this library will still need to pass add-opens
to get Arrow to work with JDK 17? (I think so since you are just making the compilation work with these arguments, no code is changed to not use those modules?).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are two part on this question:
-
Changed for arrow side: Changes related to
--add-exports"
are needed to continue supporting erroProne base on JSE11+ installation doc. It mean you won't need this changes if you run arrow java building code without errorProne validation (mvn clean install -P-error-prone-jdk11+ ....) -
Changes as a user of arrow: If the user are planning to use Arrow with JSE17 is needed to pass modules needed. For example if I run cookbook for IO https://arrow.apache.org/cookbook/java/io.html it finished with an error mention
Unable to make field long java.nio.Buffer.address accessible: module java.base does not "opens java.nio" to unnamed module
for that reason as a user for JSE17 (not for arrow changes) is needed to add VM arguments as-ea --add-opens=java.base/java.nio=ALL-UNNAMED
and it will finished without errors.
Please let me know if you have some additional doubts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add point (2) to the docs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add point (2) to the docs?
Hi Team, just send this PR to update Arrow JavaSE17/18 documentation. Please if you could review that, thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@davisusanibar It looks like this is a half-finished solution because VM arguments should be considered a temporary solution. Is it possible to use ARROW with JDK 17 and not have VM arguments? Every time I see posts with VM arguments I feel a little worried. In JEP-261 there's a warning about the usage of --add-opens
:
The --add-exports and --add-opens options must be used with great care. You can use them to gain access to an internal API of a library module, or even of the JDK itself, but you do so at your own risk: If that internal API is changed or removed then your library or application will fail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @iamzafar as per the jar artifacts are exposed as a legacy mode (it means any jar are running in the classpath is consider as a unnamed module) and base on JEP 200 The Modular JDK: yes, this is needed:
--add-opens ${module}/${package}=${target_modules}
Let the ${target_modules} access all types and members, regardless of visibility, from ${module}'s ${package}
Yes, this is an intermediate step: (1) Legacy mode (already implemented, (2) single module and (3) multi-module will be the last steps.
This is a draft for implement JPMS and be more restrict about to not give ALL-UNNAMED access but there is a lot of discussion we need to close before to convert this draft into PR: #13072. This is the document that I am going to send for discussion to the ML.
Related to #12941 (comment) Closes #12990 from davisusanibar/java-ARROW-16292 Lead-authored-by: david dali susanibar arce <[email protected]> Co-authored-by: David Li <[email protected]> Signed-off-by: David Li <[email protected]>
Hi @davisusanibar I have created this draft PR to add Java 17 to CI (#13021). As you can see from the triggered jobs, there is a new Java job:
I have validated java version was the correct when testing:
I am not sure how we do this but probably you might want to cherrypick my commit and apply it on your PR. |
Thanks @raulcd! I think we can merge this, then rebase your PR and check that it passes in CI, and then merge that as well? |
java/flight/flight-core/src/test/java/org/apache/arrow/flight/TestClientMiddleware.java
Outdated
Show resolved
Hide resolved
@@ -111,6 +111,7 @@ public void testNullPointersHashCode() { | |||
} | |||
|
|||
@Test | |||
@SuppressWarnings("ReturnValueIgnored") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can remove the suppression now right?
Thanks @raulcd. Let me solve pending comments. Consider: in my local test was needed to add this environment variable |
…TestClientMiddleware.java Co-authored-by: David Li <[email protected]>
@github-actions crossbow submit java |
Revision: 439403b Submitted crossbow builds: ursacomputing/crossbow @ actions-1988 |
Just a note here as a reminder that https://arrow.apache.org/docs/dev/developers/java/building.html will need updates once support for additional JDK versions is added. |
Good point. @davisusanibar can we include the docs changes here? |
Thanks @toddfarmer. Just updated. |
Co-authored-by: David Li <[email protected]>
Great milestone, thanks a lot @davisusanibar ! |
This PR aims to add support for java 17 on CI as required on #12941 We probably should cherrypick the commit here on that PR. Closes #13021 from raulcd/ARROW-16327 Authored-by: Raúl Cumplido <[email protected]> Signed-off-by: Sutou Kouhei <[email protected]>
Benchmark runs are scheduled for baseline = 3f2c33f and contender = 760ad20. 760ad20 is a master commit associated with this PR. Results will be available as each benchmark for each run completes. |
Changes needed to support JDK17:
--add-exports
and--add-opens
maven-surefire-plugin
with<argLine>--add-opens=java.base/java.nio=ALL-UNNAMED</argLine>