Expression functions should fail when given parameters are not what they expect
- Dominant language
- Java
- Stars
- 14.1k
- Forks
- 3.8k
- Avg merge
- 2d 58m
- Merged PRs (30d)
- 233
Description
### Affected Version
All versions since Druid expression was introduced.
### Description
Each expression function can take different parameters depending on their implementation. For now, they just assume that the passed parameters are something what they want but never validate them. For example, `strlen()` function expects a single-valued parameter, but you can still do `strlen(['a', 'b', 'c'])` in your query which returns a string length of a hex string of an array currently. Instead, they should validate the given parameters before evaluating the expression, probably in `validateArguments()`.
Contributor guide
Research direction
Start by inspecting the expression-function implementations and their validateArguments() methods, using strlen(['a', 'b', 'c']) as the concrete case from the issue. Trace how arguments are validated before evaluation and identify the existing expression validation tests, if present. Done means invalid parameter shapes are rejected before evaluation instead of being coerced into a result.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100