Skip to content

Conversation

@cambyzju
Copy link
Contributor

@cambyzju cambyzju commented Jun 10, 2022

Proposed changes

Issue Number: close #7570

Problem Summary:

Now column Array<T> contains column offsets and data, and type of column offsets is 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 Type release.

Checklist(Required)

  1. Does it affect the original behavior: (Yes/No/I Don't know)
  2. Has unit tests been added: (Yes/No/No Need)
  3. Has document been added or modified: (Yes/No/No Need)
  4. Does it need to update dependencies: (Yes/No)
  5. Are there any changes that cannot be rolled back: (Yes/No)

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...

// child column data
void* _data;
uint32_t _length;
int64_t _length;
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

return false;
}
bool seek(uint32_t n) const {
bool seek(int64_t n) const {
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

u64

@HappenLee
Copy link
Contributor

why int64 not uint64?

@cambyzju
Copy link
Contributor Author

int64 is already enough, and JAVA do not have uint64.

@cambyzju cambyzju changed the title [enhancement] Change array offset type from UInt32 to Int64 [enhancement] Change array offset type from UInt32 to UInt64 Jun 15, 2022
@github-actions github-actions bot added the area/sql/function Issues or PRs related to the SQL functions label Jun 15, 2022
// 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) {
Copy link
Contributor

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

Copy link
Contributor Author

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.

Copy link
Contributor

@HappenLee HappenLee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@github-actions github-actions bot added the approved Indicates a PR has been approved by one committer. label Jun 16, 2022
@github-actions
Copy link
Contributor

PR approved by at least one committer and no changes requested.

@github-actions
Copy link
Contributor

PR approved by anyone and no changes requested.

@morningman morningman merged commit 0e404ed into apache:master Jun 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by one committer. area/sql/function Issues or PRs related to the SQL functions area/vectorization reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Roadmap] Support Array Type(Q1)

4 participants