Skip to content

ARROW-2604: [Java] Add convenience method to VarCharVector to set Text - #2071

Closed
BryanCutler wants to merge 1 commit into
apache:masterfrom
BryanCutler:java-varchar-from-string-ARROW-2604
Closed

ARROW-2604: [Java] Add convenience method to VarCharVector to set Text#2071
BryanCutler wants to merge 1 commit into
apache:masterfrom
BryanCutler:java-varchar-from-string-ARROW-2604

Conversation

@BryanCutler

Copy link
Copy Markdown
Member

This adds a convenience method to easily set values in VarCharVector using the friendly type Text. This allows the user to set values without having to think about the correct encoding. Text objects can be constructed from a String using the constructor Text(String string).

Extended existing test to set/get a VarCharVector using Text objects.

@BryanCutler

BryanCutler commented May 21, 2018

Copy link
Copy Markdown
Member Author

I had also wondered why there was no method to set a String directly in VarCharVector but after looking into it, it seems like the "friendly type" is Text - this is the type of object that the vector returns in getObject. It seems like maybe the Text class is being encouraged over String, so I only added the ability to set a Text and not String directly, although it is easy to create Text from String. I'm neutral on whether or not to also add set methods for a String, but maybe it would make the API too crowded and be confusing to the user. What are your thoughts @siddharthteotia @icexelloss @xhochy ?

btw, it seems hadoop users are familiar with using Text over String..

@icexelloss icexelloss left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM! Thanks!

@icexelloss

Copy link
Copy Markdown
Contributor

I am curious about the choice of using Text over String too, maybe @jacques-n can shed some lights?

@BryanCutler

BryanCutler commented May 23, 2018

Copy link
Copy Markdown
Member Author

I'll commit this later today if no more comments. We can discuss further if there is still interest in adding an api directly for setting Strings.

@siddharthteotia siddharthteotia left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

+1

@BryanCutler

Copy link
Copy Markdown
Member Author

Thanks @icexelloss and @siddharthteotia ! merged to master

@BryanCutler
BryanCutler deleted the java-varchar-from-string-ARROW-2604 branch May 23, 2018 22:30
pribor pushed a commit to GlobalWebIndex/arrow that referenced this pull request Oct 24, 2025
This adds a convenience method to easily set values in `VarCharVector` using the friendly type `Text`.  This allows the user to set values without having to think about the correct encoding.  Text objects can be constructed from a String using the constructor `Text(String string)`.

Extended existing test to set/get a `VarCharVector` using `Text` objects.

Author: Bryan Cutler <cutlerb@gmail.com>

Closes apache#2071 from BryanCutler/java-varchar-from-string-ARROW-2604 and squashes the following commits:

5579edb <Bryan Cutler> add set Text to VarCharVector
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants