Skip to content

Conversation

@siddharthteotia
Copy link
Contributor

The changes here expose the ability to set "lastSet" on NullableVector.
I believe this is needed only for NullableVarCharVector and NullableVarBinaryVector. Hence the API is exposed through NullableValueVectors.java

@wesm
Copy link
Member

wesm commented Jul 19, 2017

Is it possible to add a unit test for this? Can you also indicate in the PR title that this is a Java patch, e.g. [Java] or [JAVA]?

@siddharthteotia siddharthteotia changed the title ARROW-1237: expose the ability to set lastSet ARROW-1237: [JAVA] expose the ability to set lastSet Jul 19, 2017
@siddharthteotia
Copy link
Contributor Author

Edited the PR title to include [JAVA].
Let me get back after giving a thought on unit-tests

Copy link

@DremioQA DremioQA left a comment

Choose a reason for hiding this comment

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

Let's add some unit tests for each version that has last set. Basically, set some data via memory access then update last set, then confirm a correct vector output.

}

public void setLastSet(int value) {
<#if type.major = "VarLen">lastSet = value;</#if>

Choose a reason for hiding this comment

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

Is there a lastset for the list vector as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Writing the unit tests.

Yes, the ListVector also has lastSet. Will add the API for ListVector as well and unit tests for each vector type; NullableVarCharVector, NullableVarBinaryVector, ListVector.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@siddharthteotia
Copy link
Contributor Author

@jacques-n
I have added some unit tests to ensure correctness of vector data with the usage of setLastSet().

There is a slightly orthogonal test case test based on VectorLoader and VectorUnloader.
If it looks redundant, I will remove it. It was written since my initial understanding on loading a vector was based on VectorLoader and VectorUnloader. Probably no harm to leave it since it still tests the loading-unloading of Nullable vector.

final NullableVarCharVector.Accessor accessor1 = vector1.getAccessor();
assertArrayEquals(STR1, accessor1.get(0));
assertArrayEquals(STR2, accessor1.get(1));
assertArrayEquals(STR3, accessor1.get(2));
Copy link
Contributor

Choose a reason for hiding this comment

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

Given the main issue of holes/blanks in the items set, I suggest you modify these tests to set the valuecount to something higher (e.g. 15). Then verify that everything looks good.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added additional test and slightly modified existing ones.

@asfgit asfgit closed this in 457bb07 Jul 24, 2017
@siddharthteotia siddharthteotia deleted the ARROW-1237 branch July 24, 2017 17:20
pribor pushed a commit to GlobalWebIndex/arrow that referenced this pull request Oct 24, 2025
The changes here expose the ability to set "lastSet" on Nullable<var length>Vector.
I believe this is needed only for NullableVarCharVector and NullableVarBinaryVector. Hence the API is exposed through NullableValueVectors.java

Author: siddharth <[email protected]>

Closes apache#868 from siddharthteotia/ARROW-1237 and squashes the following commits:

786dfea [siddharth] ARROW-1237: addressed review comments and added more tests
73b2fc5 [siddharth] ARROW-1237: added some unit tests
f8c7277 [siddharth] ARROW-1237: expose the ability to set lastSet
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.

4 participants