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

vector: Rudimentary function support #5222

Merged
merged 1 commit into from
Aug 20, 2024
Merged

vector: Rudimentary function support #5222

merged 1 commit into from
Aug 20, 2024

Conversation

mattnibs
Copy link
Collaborator

This commit adds rudimentary support for functions. There are a lot of shortcomings compared to sequence notably: only supports function lower(), does not variants/unions and wrapped errors are not handled, and it is not currently tested. Future work will brings things in feature parity.

@mattnibs mattnibs requested review from a team and removed request for a team August 15, 2024 20:50
@mattnibs mattnibs marked this pull request as draft August 15, 2024 20:51
This commit adds rudimentary support for functions. There are a lot of
shortcomings compared to sequence notably: only supports function lower(),
does not variants/unions and wrapped errors are not handled, and it is
not currently tested. Future work will brings things in feature parity.
@mattnibs mattnibs marked this pull request as ready for review August 15, 2024 20:59
@mattnibs mattnibs requested a review from a team August 15, 2024 20:59
@mattnibs mattnibs changed the title vector: Rudimentary support functions vector: Rudimentary function support Aug 16, 2024
return vector.NewStringError(t.zctx, "lower: string arg required", v.Len())
}
out := vector.NewStringEmpty(v.Len(), vector.NewBoolEmpty(v.Len(), nil))
for i := uint32(0); i < v.Len(); i++ {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we want a pattern where there is a string function applied to string/const/dict/view and you get back a vector.Any. So instead of looping over slots you apply a function to a vector and get a vector back. So you would pass the go func strings.ToLower to the apply function and get back the vector. We would have to make an applier for every possible type signature but that seems reasonable since it's linear in problem size.

Copy link
Collaborator

@mccanne mccanne left a comment

Choose a reason for hiding this comment

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

As we discussed, let's merge the slot-oriented pattern here and create an issue to optimize with an apply-to-vector(s) pattern.

@mattnibs mattnibs merged commit 316660a into main Aug 20, 2024
3 checks passed
@mattnibs mattnibs deleted the vam-func branch August 20, 2024 16:24
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.

2 participants