influxdata / influxdata/kapacitor
[feature request] Support type checks
- Dominant language
- Go
- Stars
- 2.4k
- Forks
- 479
- Avg merge
- 4d 16h
- Merged PRs (30d)
- 4
Description
It would be great if there was a way to check the type of a field at runtime. Similar to Python's `isinstance()` function, something similar to:
```
stream
|from()
.measurement('mymeasurement')
.groupBy(*)
|eval(lambda: if(isinstance("myfield", string), TRUE, FALSE)
.as('is_string').keep()
// do something
```
Or restrict the fields let through the DAG by type using `where`:
```
...
|where(lambda: isinstance("myfield", string)
...
```
It would also be great if you could check for multiple types at once, for example:
```
...
|eval(lambda: if(isinstance("myfield", (float, int)), TRUE, FALSE)
.as('is_numeric').keep()
```
Contributor guide
Research direction
Start with the issue's eval and where examples, then inspect the repository to find the lambda evaluation and field-type handling entry points. Done means the design supports checking one type and multiple types in both requested usage patterns, with tests covering the behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend, data
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100