Skip to content

Commit

Permalink
MINOR: [Docs][Java] Fix incorrect example (#39941)
Browse files Browse the repository at this point in the history
### 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 <643348094@qq.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
  • Loading branch information
wForget authored Feb 19, 2024
1 parent bfddfa2 commit 5d3f5b6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion docs/source/java/quickstartguide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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());
}
Expand Down

0 comments on commit 5d3f5b6

Please sign in to comment.