Skip to content

Deletion of SegString's values and offsets + more - #4773

Merged
ajpotts merged 2 commits into
Bears-R-Us:mainfrom
vasslitvinov:segstrings
Aug 8, 2025
Merged

ajpotts merged 2 commits into
Bears-R-Us:mainfrom
vasslitvinov:segstrings

Conversation

@vasslitvinov

Copy link
Copy Markdown
Contributor

Enable deletion of the "values" and "offsets" arrays of a SegStringSymEntry in the server when it is deleted itself.

Implementation Notes

A SegStringSymEntry is deleted after it is removed from the SymTab, which happens (I assume) when the corresponding Strings object is deleted in the client. Prior to this PR, "values" and "offsets" were thought to be handled / deleted by the client:

// NOTE: Clean-up, the client side pieces go out of scope and issue deletions on their own
// so it is not necessary to manually remove these pieces from the SymTab
// st.deleteEntry(offsetsName);
// st.deleteEntry(valuesName);

however I did not observe that happening. So I added the removal of "values" and "offsets" from the SymTab, which should cause them to be deleted if nothing else references them.

While there, I added an early throw to arraySegString() on non-uint8 invocations, since it did not work for those anyway. This means that the rest of the body will be ignored / dropped in such cases, reducing the generated code size. I also simplified arraySegString() significantly and made it return a SegStringSymEntry, avoiding the need for the client to combine "values" and "offsets" in a separate message to the server in pdarraycreation.py.

While there also changed the "values" and "offsets" fields of SegStringSymEntry from var to const, to clarify their nature.

Rationale: I realized that having them in SymTab will significantly
simplify the implementation of checkpointing for SegStringSymEntry.

I came across Registry.chpl and observed that ObjType.STRINGS things
are handled like ObjType.PDARRAY. On the surface STRINGS need to be
treated like ObjType.SEGARRAY instead because they have two components,
one of which is probably forgotten about when handling a STRINGS
as a PDARRAY. Thankfully this did not affect me.

---
Signed-off-by: Vassily Litvinov <[email protected]>

@ajpotts ajpotts left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for fixing this!

@1RyanK 1RyanK left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good!

@jaketrookman jaketrookman left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good

@ajpotts
ajpotts added this pull request to the merge queue Aug 8, 2025
Merged via the queue into Bears-R-Us:main with commit 7345fc5 Aug 8, 2025
@vasslitvinov
vasslitvinov deleted the segstrings branch August 8, 2025 23:41
drculhane pushed a commit to drculhane/arkouda that referenced this pull request Aug 20, 2025
Enable deletion of the "values" and "offsets" arrays of a
`SegStringSymEntry` in the server when it is deleted itself.

Implementation Notes

A `SegStringSymEntry` is deleted after it is removed from the SymTab,
which happens (I assume) when the corresponding Strings object is
deleted in the client. Prior to this PR, "values" and "offsets" were
thought to be handled / deleted by the client:

```
// NOTE: Clean-up, the client side pieces go out of scope and issue deletions on their own
// so it is not necessary to manually remove these pieces from the SymTab
// st.deleteEntry(offsetsName);
// st.deleteEntry(valuesName);
```

however I did not observe that happening. So I added the removal of
"values" and "offsets" from the SymTab, which should cause them to be
deleted if nothing else references them.

While there, I added an early `throw` to `arraySegString()` on non-uint8
invocations, since it did not work for those anyway. This means that the
rest of the body will be ignored / dropped in such cases, reducing the
generated code size. I also simplified `arraySegString()` significantly
and made it return a `SegStringSymEntry`, avoiding the need for the
client to combine "values" and "offsets" in a separate message to the
server in `pdarraycreation.py`.

While there also changed the "values" and "offsets" fields of
`SegStringSymEntry` from `var` to `const`, to clarify their nature.

---------

Signed-off-by: Vassily Litvinov <[email protected]>
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.

4 participants