-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Fix all typed ArrayList elements() method usage #13354
Fix all typed ArrayList elements() method usage #13354
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #13354 +/- ##
=============================================
- Coverage 61.75% 0.00% -61.76%
=============================================
Files 2436 2473 +37
Lines 133233 136279 +3046
Branches 20636 21171 +535
=============================================
- Hits 82274 0 -82274
- Misses 44911 136279 +91368
+ Partials 6048 0 -6048
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest adding a util class to handle these checks and return array without copy if possible
pinot-query-runtime/src/main/java/org/apache/pinot/query/runtime/operator/utils/TypeUtils.java
Outdated
Show resolved
Hide resolved
pinot-common/src/main/java/org/apache/pinot/common/utils/DataSchema.java
Outdated
Show resolved
Hide resolved
6eb394a
to
a7f52f2
Compare
pinot-common/src/main/java/org/apache/pinot/common/utils/ArrayListUtils.java
Show resolved
Hide resolved
a7f52f2
to
1357dc8
Compare
Bug fixing for
{Int|Long|Float|Double|Object}ArrayList#elements()
call usage.The
ArrayList#elements()
returned an array may be longer than the actual size of theArrayList
, and the actual size of theArrayList
can be retrieved usingArrayList#size()
.Created a util class
ArrayListUtils
to best effort extract the givenArrayList
to the corresponding primitive array without copying the elements.E.g. this method
ArrayListUtils#toIntArray()
checks the length of the returned int array and returns the same if it is equal to the size of the inputIntArrayList
, otherwise, it copies the elements to a new int array and returns it.