Skip to content

Conversation

@liyafan82
Copy link
Contributor

When adding a byte 0xff to a UInt1Vector, the toString method produces [-1]. Since the vector contains unsinged integers, the correct result should be [255].

@github-actions
Copy link

public void testUInt2VectorToString() {
try (final UInt2Vector uInt2Vector = new UInt2Vector("uInt2Vector", allocator)) {
setVector(uInt2Vector, (char) 0xffff);
assertEquals("[" + new Character((char) 0xffff) + "]", uInt2Vector.toString());
Copy link
Contributor

Choose a reason for hiding this comment

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

lets use the exact string expected please.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for your feedback. Revised accordingly.

@emkornfield
Copy link
Contributor

LGTM, one minor comment on the tests.

public void testUInt2VectorToString() {
try (final UInt2Vector uInt2Vector = new UInt2Vector("uInt2Vector", allocator)) {
setVector(uInt2Vector, (char) 0xffff);
assertEquals("[\uffff]", uInt2Vector.toString());
Copy link
Contributor

Choose a reason for hiding this comment

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

actually, this doesn't look write. weshould convert this to the integer representation I think.

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 see your point. Please check if it looks right now?

@emkornfield
Copy link
Contributor

+1 thanks!

ViniciusSouzaRoque pushed a commit to s1mbi0se/arrow that referenced this pull request Oct 20, 2021
…gned integer vectors

When adding a byte `0xff` to a UInt1Vector, the toString method produces `[-1]`. Since the vector contains unsinged integers, the correct result should be `[255]`.

Closes apache#11029 from liyafan82/fly_0830_uin

Authored-by: liyafan82 <fan_li_ya@foxmail.com>
Signed-off-by: Micah Kornfield <emkornfield@gmail.com>
pribor pushed a commit to GlobalWebIndex/arrow that referenced this pull request Oct 24, 2025
…gned integer vectors

When adding a byte `0xff` to a UInt1Vector, the toString method produces `[-1]`. Since the vector contains unsinged integers, the correct result should be `[255]`.

Closes apache#11029 from liyafan82/fly_0830_uin

Authored-by: liyafan82 <fan_li_ya@foxmail.com>
Signed-off-by: Micah Kornfield <emkornfield@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.

2 participants