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

ARROW-17962: [Java] Remove unused schema creation from try with resources #14346

Merged
merged 3 commits into from
Oct 10, 2022

Conversation

lwhite1
Copy link
Contributor

@lwhite1 lwhite1 commented Oct 7, 2022

No description provided.

@github-actions
Copy link

github-actions bot commented Oct 7, 2022

@github-actions
Copy link

github-actions bot commented Oct 7, 2022

⚠️ Ticket has no components in JIRA, make sure you assign one.

@github-actions
Copy link

github-actions bot commented Oct 7, 2022

⚠️ Ticket has not been started in JIRA, please click 'Start Progress'.

@@ -673,8 +673,7 @@ public void testTable() {
Table table = new Table(vsr);
) {
// Producer creates structures from existing memory pointers
try (ArrowSchema arrowSchema = ArrowSchema.wrap(consumerArrowSchema.memoryAddress());
ArrowArray arrowArray = ArrowArray.wrap(consumerArrowArray.memoryAddress())) {
try (ArrowArray arrowArray = ArrowArray.wrap(consumerArrowArray.memoryAddress())) {
Copy link
Member

Choose a reason for hiding this comment

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

Hmm, how does this fix the issue? Closing a schema created via ArrowArray.wrap shouldn't actually do anything to the original data, from what I can see (unless ArrowBuf.close() zeroes the memory or something?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure, but arrowSchema was unused. My assumption was that it was being closed at the end of the try, and also by 'something else'. It's really hard to tell how to fix it since it works in my environment, but given that the variable was unused, I thought it worth a try.

Copy link
Member

Choose a reason for hiding this comment

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

So on the contrary I think exportTable should be passed the arrowSchema here, since below we import from consumerArrowSchema. If we never export to it, it'll be uninitialized, and I don't know off the top of my head if the buffer will be zeroed or just contain random bytes, but that could cause an exception/crash.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The unused variable had to go anyway, but it looks like there is sill a problem. I see that the build is multi-threaded here, which makes me wonder if that could be it. Also, not sure why it only fails in this one job:
Java JNI / AMD64 manylinux2014 Java JNI (pull_request)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So on the contrary I think exportTable should be passed the arrowSchema here, since below we import from consumerArrowSchema. If we never export to it, it'll be uninitialized, and I don't know off the top of my head if the buffer will be zeroed or just contain random bytes, but that could cause an exception/crash.

Ok. I will look into it over the weekend.

Copy link
Member

Choose a reason for hiding this comment

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

Ok, no pressure. Let me know if you'd like me to dig into it too.

@lidavidm
Copy link
Member

lidavidm commented Oct 7, 2022

CI still seems to fail here.

@lwhite1
Copy link
Contributor Author

lwhite1 commented Oct 8, 2022

@lidavidm Thanks for the offer. IDK if this is related or not, but there was a bug in the production code where a VSR was created for exporting, but was not closed. That is fixed here. If you could unstick the workflows when you have time that would be great.

@lwhite1
Copy link
Contributor Author

lwhite1 commented Oct 8, 2022

@lidavidm Thanks for the offer. IDK if this is related or not, but there was a bug in the production code where a VSR was created for exporting, but was not closed. That is fixed here. If you could unstick the workflows when you have time that would be great.

Also, I passed the ArrowSchema into the import method. Strictly speaking, the ArrowSchema is optional, but it might be the case in this round-trip test that if you pass one in one direction you should pass one in the other

@lidavidm
Copy link
Member

lidavidm commented Oct 9, 2022

Looks like it still fails, but it's just due to Checkstyle

[WARN] /arrow/java/c/src/main/java/org/apache/arrow/c/Data.java:170: 'try' child has incorrect indentation level 4, expected level should be 6. [Indentation]

@lidavidm
Copy link
Member

@github-actions submit java

@lidavidm
Copy link
Member

@github-actions crossbow submit java

@github-actions
Copy link

Revision: 87bbc85

Submitted crossbow builds: ursacomputing/crossbow @ actions-4544d4bf0c

Task Status
java-jars Github Actions
verify-rc-source-java-linux-almalinux-8-amd64 Github Actions
verify-rc-source-java-linux-conda-latest-amd64 Github Actions
verify-rc-source-java-linux-ubuntu-18.04-amd64 Github Actions
verify-rc-source-java-linux-ubuntu-20.04-amd64 Github Actions
verify-rc-source-java-linux-ubuntu-22.04-amd64 Github Actions
verify-rc-source-java-macos-amd64 Github Actions

@lidavidm lidavidm merged commit 5120e1a into apache:master Oct 10, 2022
@ursabot
Copy link

ursabot commented Oct 10, 2022

Benchmark runs are scheduled for baseline = 21dbf4a and contender = 5120e1a. 5120e1a is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
Conbench compare runs links:
[Finished ⬇️0.0% ⬆️0.0%] ec2-t3-xlarge-us-east-2
[Failed ⬇️0.0% ⬆️0.0%] test-mac-arm
[Failed ⬇️0.27% ⬆️0.0%] ursa-i9-9960x
[Finished ⬇️0.18% ⬆️0.0%] ursa-thinkcentre-m75q
Buildkite builds:
[Finished] 5120e1a7 ec2-t3-xlarge-us-east-2
[Failed] 5120e1a7 test-mac-arm
[Failed] 5120e1a7 ursa-i9-9960x
[Finished] 5120e1a7 ursa-thinkcentre-m75q
[Finished] 21dbf4ac ec2-t3-xlarge-us-east-2
[Failed] 21dbf4ac test-mac-arm
[Failed] 21dbf4ac ursa-i9-9960x
[Finished] 21dbf4ac ursa-thinkcentre-m75q
Supported benchmarks:
ec2-t3-xlarge-us-east-2: Supported benchmark langs: Python, R. Runs only benchmarks with cloud = True
test-mac-arm: Supported benchmark langs: C++, Python, R
ursa-i9-9960x: Supported benchmark langs: Python, R, JavaScript
ursa-thinkcentre-m75q: Supported benchmark langs: C++, Java

fatemehp pushed a commit to fatemehp/arrow that referenced this pull request Oct 17, 2022
…rces (apache#14346)

Authored-by: Larry White <lwhite1@users.noreply.github.com>
Signed-off-by: David Li <li.davidm96@gmail.com>
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.

None yet

3 participants