You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "viirya (via GitHub)" <gi...@apache.org> on 2024/09/06 21:00:01 UTC

[PR] GH-43996: [JAVA] chore: mark new allocated ArrowSchema as released [arrow]

viirya opened a new pull request, #43997:
URL: https://github.com/apache/arrow/pull/43997

   <!--
   Thanks for opening a pull request!
   If this is your first pull request you can find detailed information on how 
   to contribute here:
     * [New Contributor's Guide](https://arrow.apache.org/docs/dev/developers/guide/step_by_step/pr_lifecycle.html#reviews-and-merge-of-the-pull-request)
     * [Contributing Overview](https://arrow.apache.org/docs/dev/developers/overview.html)
   
   
   If this is not a [minor PR](https://github.com/apache/arrow/blob/main/CONTRIBUTING.md#Minor-Fixes). Could you open an issue for this pull request on GitHub? https://github.com/apache/arrow/issues/new/choose
   
   Opening GitHub issues ahead of time contributes to the [Openness](http://theapacheway.com/open/#:~:text=Openness%20allows%20new%20users%20the,must%20happen%20in%20the%20open.) of the Apache Arrow project.
   
   Then could you also rename the pull request title in the following format?
   
       GH-${GITHUB_ISSUE_ID}: [${COMPONENT}] ${SUMMARY}
   
   or
   
       MINOR: [${COMPONENT}] ${SUMMARY}
   
   In the case of PARQUET issues on JIRA the title also supports:
   
       PARQUET-${JIRA_ISSUE_ID}: [${COMPONENT}] ${SUMMARY}
   
   -->
   
   ### Rationale for this change
   
   <!--
    Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed.
    Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes.  
   -->
   
   ### What changes are included in this PR?
   
   <!--
   There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR.
   -->
   
   ### Are these changes tested?
   
   <!--
   We typically require tests for all PRs in order to:
   1. Prevent the code from being accidentally broken by subsequent changes
   2. Serve as another way to document the expected behavior of the code
   
   If tests are not included in your PR, please explain why (for example, are they covered by existing tests)?
   -->
   
   ### Are there any user-facing changes?
   
   <!--
   If there are user-facing changes then we may require documentation to be updated before approving the PR.
   -->
   
   <!--
   If there are any breaking changes to public APIs, please uncomment the line below and explain which changes are breaking.
   -->
   <!-- **This PR includes breaking changes to public APIs.** -->
   
   <!--
   Please uncomment the line below (and provide explanation) if the changes fix either (a) a security vulnerability, (b) a bug that caused incorrect or invalid data to be produced, or (c) a bug that causes a crash (even when the API contract is upheld). We use this to highlight fixes to issues that may affect users without their knowledge. For this reason, fixing bugs that cause errors don't count, since those are usually obvious.
   -->
   <!-- **This PR contains a "Critical Fix".** -->


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-43996: [JAVA] Mark new allocated ArrowSchema as released [arrow]

Posted by "viirya (via GitHub)" <gi...@apache.org>.
viirya commented on PR #43997:
URL: https://github.com/apache/arrow/pull/43997#issuecomment-2339785682

   > Compilation issue?
   
   Yea, fixed it now. I cannot run the test locally so previous commits have some issues.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-43996: [JAVA] Mark new allocated ArrowSchema as released [arrow]

Posted by "viirya (via GitHub)" <gi...@apache.org>.
viirya commented on code in PR #43997:
URL: https://github.com/apache/arrow/pull/43997#discussion_r1751044847


##########
java/c/src/test/java/org/apache/arrow/c/ArrowArrayUtilityTest.java:
##########
@@ -50,6 +50,14 @@ void afterEach() {
     allocator.close();
   }
 
+  @Test
+  void arraySchemaInit {
+    ArrowSchema schema = ArrowSchema.allocateNew(allocator);
+    Snapshot snapshot = schema.snapshot();
+    assertThat(snapshot.release).isEqualTo(0);
+    schema.close();
+  }

Review Comment:
   Not sure why there is style error in CI. The diff looks good, but in CI it is `voidarraySchemaInit`
   
   ```
   Error:  Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:3.4.0:check (validate) on project arrow-c-data: Failed during checkstyle configuration: Exception was thrown while processing /build/java/c/src/test/java/org/apache/arrow/c/ArrowArrayUtilityTest.java: IllegalStateException occurred while parsing file /build/java/c/src/test/java/org/apache/arrow/c/ArrowArrayUtilityTest.java. 54:23: no viable alternative at input 'voidarraySchemaInit{': NoViableAltException -> [Help 1]
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-43996: [JAVA] Mark new allocated ArrowSchema as released [arrow]

Posted by "viirya (via GitHub)" <gi...@apache.org>.
viirya commented on code in PR #43997:
URL: https://github.com/apache/arrow/pull/43997#discussion_r1751083456


##########
java/c/src/test/java/org/apache/arrow/c/ArrowArrayUtilityTest.java:
##########
@@ -50,6 +50,14 @@ void afterEach() {
     allocator.close();
   }
 
+  @Test
+  void arraySchemaInit {
+    ArrowSchema schema = ArrowSchema.allocateNew(allocator);
+    Snapshot snapshot = schema.snapshot();
+    assertThat(snapshot.release).isEqualTo(0);
+    schema.close();
+  }

Review Comment:
   Oops.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-43996: [Java] Mark new allocated ArrowSchema as released [arrow]

Posted by "conbench-apache-arrow[bot] (via GitHub)" <gi...@apache.org>.
conbench-apache-arrow[bot] commented on PR #43997:
URL: https://github.com/apache/arrow/pull/43997#issuecomment-2341194571

   After merging your PR, Conbench analyzed the 4 benchmarking runs that have been run so far on merge-commit fed5fcbbd5f1ca578f2eb3661a8260b4e21965ea.
   
   There was 1 benchmark result indicating a performance regression:
   
   - Commit Run on `amd64-m5-4xlarge-linux` at [2024-09-10 09:53:20Z](https://conbench.ursa.dev/compare/runs/d8549401df314522896f235fe1285530...8cfe128d4cbf4f4e93ec756790e84996/)
     - [`partitioned-dataset-filter` (R) with dataset=dataset-taxi-parquet, language=R, query=vignette](https://conbench.ursa.dev/compare/benchmarks/066e01f222177b8b8000c06542f4e8a1...066e037c9514714180008eb945641b74)
   
   The [full Conbench report](https://github.com/apache/arrow/runs/29941767172) has more details. It also includes information about 115 possible false positives for unstable benchmarks that are known to sometimes produce them.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-43996: [JAVA] Mark new allocated ArrowSchema as released [arrow]

Posted by "viirya (via GitHub)" <gi...@apache.org>.
viirya commented on code in PR #43997:
URL: https://github.com/apache/arrow/pull/43997#discussion_r1749400621


##########
java/c/src/main/java/org/apache/arrow/c/ArrowSchema.java:
##########
@@ -103,14 +104,21 @@ public static ArrowSchema wrap(long memoryAddress) {
    * @return A new ArrowSchema instance
    */
   public static ArrowSchema allocateNew(BufferAllocator allocator) {
-    return new ArrowSchema(allocator.buffer(ArrowSchema.SIZE_OF));
+    ArrowSchema schema = new ArrowSchema(allocator.buffer(ArrowSchema.SIZE_OF));
+    schema.markReleased();
+    return schema;

Review Comment:
   I think marking them released should be enough. According to the spec, to use the structures, the users must check if they are not released yet.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-43996: [Java] Mark new allocated ArrowSchema as released [arrow]

Posted by "viirya (via GitHub)" <gi...@apache.org>.
viirya commented on PR #43997:
URL: https://github.com/apache/arrow/pull/43997#issuecomment-2341284901

   Thanks @lidavidm 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-43996: [JAVA] Mark new allocated ArrowSchema as released [arrow]

Posted by "viirya (via GitHub)" <gi...@apache.org>.
viirya commented on PR #43997:
URL: https://github.com/apache/arrow/pull/43997#issuecomment-2336869037

   > Could we add a unit test?
   
   Sure. I was looking for an existing test file to add test for it, but didn't find one for ArrowArray/ArrowSchema. I will find one or create a new one instead.
   
   Thank you.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-43996: [JAVA] Mark new allocated ArrowSchema as released [arrow]

Posted by "lidavidm (via GitHub)" <gi...@apache.org>.
lidavidm commented on PR #43997:
URL: https://github.com/apache/arrow/pull/43997#issuecomment-2339680585

   Compilation issue?
   
   ```
    Error:  Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.13.0:testCompile (default-testCompile) on project arrow-c-data: Compilation failure
   Error:  /build/java/c/src/test/java/org/apache/arrow/c/ArrowArrayUtilityTest.java:[56,4] error: cannot find symbol
   Error:    symbol:   class Snapshot
   Error:    location: class ArrowArrayUtilityTest
   Error:  -> [Help 1]
   ```
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-43996: [JAVA] Mark new allocated ArrowSchema as released [arrow]

Posted by "lidavidm (via GitHub)" <gi...@apache.org>.
lidavidm commented on code in PR #43997:
URL: https://github.com/apache/arrow/pull/43997#discussion_r1749398436


##########
java/c/src/main/java/org/apache/arrow/c/ArrowSchema.java:
##########
@@ -103,14 +104,21 @@ public static ArrowSchema wrap(long memoryAddress) {
    * @return A new ArrowSchema instance
    */
   public static ArrowSchema allocateNew(BufferAllocator allocator) {
-    return new ArrowSchema(allocator.buffer(ArrowSchema.SIZE_OF));
+    ArrowSchema schema = new ArrowSchema(allocator.buffer(ArrowSchema.SIZE_OF));
+    schema.markReleased();
+    return schema;

Review Comment:
   Would it be safer to simply zero out the entire buffer?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-43996: [JAVA] Mark new allocated ArrowSchema as released [arrow]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #43997:
URL: https://github.com/apache/arrow/pull/43997#issuecomment-2334802986

   :warning: GitHub issue #43996 **has been automatically assigned in GitHub** to PR creator.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-43996: [Java] Mark new allocated ArrowSchema as released [arrow]

Posted by "lidavidm (via GitHub)" <gi...@apache.org>.
lidavidm merged PR #43997:
URL: https://github.com/apache/arrow/pull/43997


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-43996: [JAVA] Mark new allocated ArrowSchema as released [arrow]

Posted by "lidavidm (via GitHub)" <gi...@apache.org>.
lidavidm commented on code in PR #43997:
URL: https://github.com/apache/arrow/pull/43997#discussion_r1751082736


##########
java/c/src/test/java/org/apache/arrow/c/ArrowArrayUtilityTest.java:
##########
@@ -50,6 +50,14 @@ void afterEach() {
     allocator.close();
   }
 
+  @Test
+  void arraySchemaInit {
+    ArrowSchema schema = ArrowSchema.allocateNew(allocator);
+    Snapshot snapshot = schema.snapshot();
+    assertThat(snapshot.release).isEqualTo(0);
+    schema.close();
+  }

Review Comment:
   It looks wrong here. The parentheses are missing.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org