influxdata / influxdata/kapacitor
Pass list to UDF
- Dominant language
- Go
- Stars
- 2.4k
- Forks
- 479
- Avg merge
- 4d 16h
- Merged PRs (30d)
- 4
Description
I'd like to have a UDF that works as a basic 'a is in array/list' function. Since I do not know the size of a list, I cannot put a "list" option in handler Info function, because it will add a number of arguments restriction. Is there a way to specify a property method on my handler? I've seen in source code that there is usage of reflection to search for property methods, but I don't understand how it works so far.
How I want UDF to be called:
```
var list = ['a', 'b', '42']
...
@inList()
.value('value')
.list(list)
...
```
Current blocker is here
```golang
func (*inListHandler) Info() (*agent.InfoResponse, error) {
info := &agent.InfoResponse{
Wants: agent.EdgeType_STREAM,
Provides: agent.EdgeType_STREAM,
Options: map[string]*agent.OptionInfo{
"value": {ValueTypes: []agent.ValueType{agent.ValueType_STRING}},
"list": {ValueTypes: []agent.ValueType{agent.ValueType_STRING, agent.ValueType_STRING....how many of these should I put?}},
},
}
return info, nil
}
```
Contributor guide
Research direction
Start by reading the inListHandler Info() method and the UDF handler documentation or entry points related to agent.OptionInfo. Trace the existing reflection-based property-method handling mentioned in the issue. Done should establish a supported way to pass a variable-length list to a UDF and document or test the resulting call form.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend-api-design
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100