Skip to content
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

feat(execute): allocate memory for string content. #5482

Merged
merged 1 commit into from
May 21, 2024

Conversation

mhilton
Copy link
Contributor

@mhilton mhilton commented May 20, 2024

Update the string column builder to account for the memory for the string contents. This is part of an effort to reduce the prevelence of OOMs caused by unaccounted memory data See influxdata/idpe#18697.

Checklist

Dear Author 👋, the following checks should be completed (or explicitly dismissed) before merging.

  • ✏️ Write a PR description, regardless of triviality, to include the value of this PR
  • 🔗 Reference related issues
  • 🏃 Test cases are included to exercise the new code
  • 🧪 If new packages are being introduced to stdlib, link to Working Group discussion notes and ensure it lands under experimental/
  • 📖 If language features are changing, ensure docs/Spec.md has been updated

Dear Reviewer(s) 👋, you are responsible (among others) for ensuring the completeness and quality of the above before approval.

Update the string column builder to account for the memory for the
string contents.
@mhilton mhilton requested a review from a team as a code owner May 20, 2024 10:58
@@ -1180,7 +1202,9 @@ func (b *ColListTableBuilder) GetRow(row int) values.Object {
case flux.TFloat:
val = values.NewFloat(b.cols[j].(*floatColumnBuilder).data[row])
case flux.TString:
val = values.NewString(b.cols[j].(*stringColumnBuilder).data[row])
// TODO(mhilton): avoid a copy
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is intended this will be changed in a followup PR.

Copy link
Contributor

@appletreeisyellow appletreeisyellow left a comment

Choose a reason for hiding this comment

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

My understanding is that this PR prepares the way to determine if a column has particularly long strings. Looks good to me! ✅

Comment on lines +223 to +231
// String represents a string stored in some backing byte slice.
type String struct {
offset int
len int
}

func (s String) Bytes(buf *arrowmem.Buffer) []byte {
return buf.Bytes()[s.offset : s.offset+s.len]
}
Copy link
Contributor

Choose a reason for hiding this comment

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

👍 My understanding of this new struct is that it stores the column string size and if a string get too long, we can do something with it

@mhilton mhilton merged commit bea9586 into master May 21, 2024
8 checks passed
mhilton added a commit that referenced this pull request Aug 13, 2024
mhilton added a commit that referenced this pull request Aug 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants