Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Java] Using an Iterator/Iterable/Stream to provide objects to a Java Collection for testing assertions #37728

Closed
davisusanibar opened this issue Sep 14, 2023 · 2 comments

Comments

@davisusanibar
Copy link
Contributor

Describe the enhancement requested

Use an Iterator/Iterable/Stream to provide objects into a Java Collection and use it for standard assertions.

Improve this method of comparing values of Vector Value objects, for example:

        assertTrue(reader.getVectorSchemaRoot().getVector("id").toString().equals("[19, 1, 11]"));
        assertTrue(reader.getVectorSchemaRoot().getVector("name").toString()
            .equals("[value_19, value_1, value_11]"));

Component(s)

Java

@lidavidm
Copy link
Member

So to clarify, the idea is that we could build some wrapper/adapter over a Vector (or VectorSchemaRoot) to support iteration over it as Java objects, as a more convenient (if less performant) version of the Reader classes. Then you could easily turn that into a testing API.

normanj-bitquill added a commit to Bit-Quill/arrow that referenced this issue May 30, 2024
* Added a method to get an Iterator for a ValueVector
* Added a method to get an Iterable for a ValueVector
* The Iterator/Iterable are typed to Object
lidavidm pushed a commit that referenced this issue Jun 18, 2024
…1895)

### Rationale for this change

Simplify validating the values in a `ValueVector` in unit tests.

### What changes are included in this PR?

Methods for creating an `Iterable` and `Iterator` for a `ValueVector`. Also updated some unit tests to use the new methods.

### Are these changes tested?

Some unit tests were updated.

### Are there any user-facing changes?

The new methods are publicly available in the `ValueVectorUtility` class.
* GitHub Issue: #37728

Authored-by: Norman Jordan <[email protected]>
Signed-off-by: David Li <[email protected]>
@lidavidm lidavidm changed the title [Java]: Using an Iterator/Iterable/Stream to provide objects to a Java Collection for testing assertions [Java] Using an Iterator/Iterable/Stream to provide objects to a Java Collection for testing assertions Jun 18, 2024
@lidavidm lidavidm added this to the 17.0.0 milestone Jun 18, 2024
@lidavidm
Copy link
Member

Issue resolved by pull request 41895
#41895

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants