This is an automated email from the ASF dual-hosted git repository.

kou pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/main by this push:
     new 5d3f5b61b9 MINOR: [Docs][Java] Fix incorrect example (#39941)
5d3f5b61b9 is described below

commit 5d3f5b61b9585e88b0672840d13d0a065647b11e
Author: Zhen Wang <[email protected]>
AuthorDate: Tue Feb 20 07:33:04 2024 +0800

    MINOR: [Docs][Java] Fix incorrect example (#39941)
    
    ### Rationale for this change
    
    `setRowCount` should be called after filling vectors.
    
    ### What changes are included in this PR?
    
    Move `setRowCount` to after filling vectors.
    
    ### Are these changes tested?
    
    No
    
    ### Are there any user-facing changes?
    
    Documentation
    
    Authored-by: wforget <[email protected]>
    Signed-off-by: Sutou Kouhei <[email protected]>
---
 docs/source/java/quickstartguide.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/docs/source/java/quickstartguide.rst 
b/docs/source/java/quickstartguide.rst
index 5ce643db01..e358681c57 100644
--- a/docs/source/java/quickstartguide.rst
+++ b/docs/source/java/quickstartguide.rst
@@ -180,7 +180,6 @@ Example: Create a dataset of names (strings) and ages 
(32-bit signed integers).
         IntVector ageVector = (IntVector) root.getVector("age");
         VarCharVector nameVector = (VarCharVector) root.getVector("name");
     ){
-        root.setRowCount(3);
         ageVector.allocateNew(3);
         ageVector.set(0, 10);
         ageVector.set(1, 20);
@@ -189,6 +188,7 @@ Example: Create a dataset of names (strings) and ages 
(32-bit signed integers).
         nameVector.set(0, "Dave".getBytes(StandardCharsets.UTF_8));
         nameVector.set(1, "Peter".getBytes(StandardCharsets.UTF_8));
         nameVector.set(2, "Mary".getBytes(StandardCharsets.UTF_8));
+        root.setRowCount(3);
         System.out.println("VectorSchemaRoot created: \n" + 
root.contentToTSVString());
     }
 

Reply via email to