-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[enhancement] Change array offset type from UInt32 to UInt64 #10070
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
Conversation
be/src/runtime/collection_value.h
Outdated
| // child column data | ||
| void* _data; | ||
| uint32_t _length; | ||
| int64_t _length; |
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.
Using uint64_t is better. For some places which need signed value, we use signed value there.
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.
done
be/src/runtime/collection_value.h
Outdated
| return false; | ||
| } | ||
| bool seek(uint32_t n) const { | ||
| bool seek(int64_t n) const { |
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.
If using int64_t here, the function seek should check whether n is negative.
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.
u64
|
why int64 not uint64? |
|
int64 is already enough, and JAVA do not have uint64. |
| // vectorized this code to speed up | ||
| IColumn::Offset counts[size]; | ||
| for (size_t i = 0; i < size; ++i) { | ||
| for (ssize_t i = 0; i < size; ++i) { |
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.
size is size_t, not need change i to sszie_t
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.
We use offsets[i - 1] inside this for loop, so it is better to use ssize_t for index -1.
HappenLee
left a comment
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.
LGTM
|
PR approved by at least one committer and no changes requested. |
|
PR approved by anyone and no changes requested. |
Proposed changes
Issue Number: close #7570
Problem Summary:
Now column
Array<T>contains columnoffsetsanddata, and type of columnoffsetsis UInt32 now.If we call array_union to merge arrays repeatedly, the size of array may overflow.
So we need to extend it before
Array Data Typerelease.Checklist(Required)
Further comments
If this is a relatively large or complex change, kick off the discussion at dev@doris.apache.org by explaining why you chose the solution you did and what alternatives you considered, etc...