-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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] Add ListVector#setInitialCapacity overload that takes an exact inner capacity #37703
Comments
take |
Not sure if I follow this issue. There is already setInitialCapacity(int numRecords) on both BaseRepeatedValueVector and ListVector so I'm not clear on what's missing. |
There's a |
This seems like adding a setInitialCapacity(int, int) overload for specifying the exact number of elements in each inner list. |
Yes, except I think the latter parameter would be the total number of elements across all lists |
Hmm, that seems error prone though. That there's a setInitialCapacity(int, double) where the last parameter is the density/elements per list and another that's setInitialCapacity(int, int) where the last parameter is the total number of elements across all lists. |
Fair point; we could give the latter a different name? Or we could cancel this and have @davisusanibar document how to explicitly set the list and child capacities separately. |
I'm favoring creating a separate method setInitialTotalCapacity() or something along those lines. |
Sounds good to me. |
… in ListVector Add setInitialTotalCapacity() to BaseRepeatedVector and ListVector to specify the exact total number of records in the backing vector. This is an alternative to using the density argument in setInitialCapacity() that allows the caller to precisely specify the capacity.
… in ListVector Add setInitialTotalCapacity() to BaseRepeatedVector and ListVector to specify the exact total number of records in the backing vector. This is an alternative to using the density argument in setInitialCapacity() that allows the caller to precisely specify the capacity.
… in ListVector Add setInitialTotalCapacity() to BaseRepeatedVector, ListVector and LargeListVector to specify the exact total number of records in the backing vector. This is an alternative to using the density argument in setInitialCapacity() that allows the caller to precisely specify the capacity.
…ctor (#37838) ### Rationale for this change There is currently a setInitialCapacity() function that can be used to set a number of records and density factor when setting the capacity on a ListVector. A developer may want to specify the exact total number of records instead and can use the new methods introduced here. ### What changes are included in this PR? Add setInitialTotalCapacity() to BaseRepeatedVector, ListVector, DensityAwareVector, and LargeListVector to specify the exact total number of records in the backing vector. This is an alternative to using the density argument in setInitialCapacity() that allows the caller to precisely specify the capacity. ### Are these changes tested? Yes. ### Are there any user-facing changes? No. * Closes: #37703 Authored-by: James Duong <duong.james@gmail.com> Signed-off-by: David Li <li.davidm96@gmail.com>
…ListVector (apache#37838) ### Rationale for this change There is currently a setInitialCapacity() function that can be used to set a number of records and density factor when setting the capacity on a ListVector. A developer may want to specify the exact total number of records instead and can use the new methods introduced here. ### What changes are included in this PR? Add setInitialTotalCapacity() to BaseRepeatedVector, ListVector, DensityAwareVector, and LargeListVector to specify the exact total number of records in the backing vector. This is an alternative to using the density argument in setInitialCapacity() that allows the caller to precisely specify the capacity. ### Are these changes tested? Yes. ### Are there any user-facing changes? No. * Closes: apache#37703 Authored-by: James Duong <duong.james@gmail.com> Signed-off-by: David Li <li.davidm96@gmail.com>
…ListVector (apache#37838) ### Rationale for this change There is currently a setInitialCapacity() function that can be used to set a number of records and density factor when setting the capacity on a ListVector. A developer may want to specify the exact total number of records instead and can use the new methods introduced here. ### What changes are included in this PR? Add setInitialTotalCapacity() to BaseRepeatedVector, ListVector, DensityAwareVector, and LargeListVector to specify the exact total number of records in the backing vector. This is an alternative to using the density argument in setInitialCapacity() that allows the caller to precisely specify the capacity. ### Are these changes tested? Yes. ### Are there any user-facing changes? No. * Closes: apache#37703 Authored-by: James Duong <duong.james@gmail.com> Signed-off-by: David Li <li.davidm96@gmail.com>
…ListVector (apache#37838) ### Rationale for this change There is currently a setInitialCapacity() function that can be used to set a number of records and density factor when setting the capacity on a ListVector. A developer may want to specify the exact total number of records instead and can use the new methods introduced here. ### What changes are included in this PR? Add setInitialTotalCapacity() to BaseRepeatedVector, ListVector, DensityAwareVector, and LargeListVector to specify the exact total number of records in the backing vector. This is an alternative to using the density argument in setInitialCapacity() that allows the caller to precisely specify the capacity. ### Are these changes tested? Yes. ### Are there any user-facing changes? No. * Closes: apache#37703 Authored-by: James Duong <duong.james@gmail.com> Signed-off-by: David Li <li.davidm96@gmail.com>
…ListVector (apache#37838) ### Rationale for this change There is currently a setInitialCapacity() function that can be used to set a number of records and density factor when setting the capacity on a ListVector. A developer may want to specify the exact total number of records instead and can use the new methods introduced here. ### What changes are included in this PR? Add setInitialTotalCapacity() to BaseRepeatedVector, ListVector, DensityAwareVector, and LargeListVector to specify the exact total number of records in the backing vector. This is an alternative to using the density argument in setInitialCapacity() that allows the caller to precisely specify the capacity. ### Are these changes tested? Yes. ### Are there any user-facing changes? No. * Closes: apache#37703 Authored-by: James Duong <duong.james@gmail.com> Signed-off-by: David Li <li.davidm96@gmail.com>
Describe the enhancement requested
ListVector (or really, its abstract base class) adds an overload of
setInitialCapacity
that also preallocates the inner vector based on the "density" of the list items. However sometimes you know the number of inner elements up front, so it would be clearer (and less error-prone) to just tell the vector this fact.You could do this by manipulating the inner vector directly but given we have the other overload, this one also makes sense.
Component(s)
Java
The text was updated successfully, but these errors were encountered: