Repository navigation
GH-37728: [Java] Add methods to get an Iterable for a ValueVector - #41895
Conversation
|
|
There was a problem hiding this comment.
I suppose eventually we can add typed/generic versions? (I suppose we'd have to write out overloads per class so that IntVector returns Iterator<Integer> etc. Or else accept Class<T> and assert at runtime that the vector is of the right type.)
There was a problem hiding this comment.
@lidavidm We can. I view this as functionality that is meant to only be used by the unit tests. It could be enhanced to support the Iterator type matching the ValueVector type. For that I would favour adding the type information to the ValueVector classes and using that to determine the type of the Iterator.
The Iterator and Iterable are publicly available. Is there anything more that can be done to discourage their use in Arrow applications?
Are you looking for properly typed Iterators in this PR or should that wait for a future PR?
There was a problem hiding this comment.
If you mean for this to only be available in unit tests then it should be in a distinct module.
There was a problem hiding this comment.
@lidavidm I have updated this. There is a new interface that a ValueVector can implement. The new interface provides methods for getting an Iterator or Iterable. The new interface also allows the value type to be specified so that the Iterator will be properly typed.
There was a problem hiding this comment.
Can we set the version in dependencyManagement at the root level? I believe a few other modules use hamcrest too.
|
@lidavidm should we upgrade to Junit5? |
|
We can do that separately |
There was a problem hiding this comment.
Can't this extend ValueVector to avoid the repeated declarations?
9da8f79 to
e6c5efa
Compare
lidavidm
left a comment
There was a problem hiding this comment.
Thanks. I think the last thing is just, can we add a test suite that exercises these new methods for each vector?
|
@lidavidm I have added unit tests for each vector that implements ValueIterableVector.
|
* The new interface indicates that a ValueVector is iterable * Contains default methods for getting an Iterator and Iterable
bff79a2 to
804c0b4
Compare
|
After merging your PR, Conbench analyzed the 8 benchmarking runs that have been run so far on merge-commit 4413110. There were no benchmark performance regressions. 🎉 The full Conbench report has more details. It also includes information about 119 possible false positives for unstable benchmarks that are known to sometimes produce them. |
…or (apache#41895) ### 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: apache#37728 Authored-by: Norman Jordan <norman.jordan@improving.com> Signed-off-by: David Li <li.davidm96@gmail.com>
Rationale for this change
Simplify validating the values in a
ValueVectorin unit tests.What changes are included in this PR?
Methods for creating an
IterableandIteratorfor aValueVector. 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
ValueVectorUtilityclass.