Open
Description
This works as expected:
.foo.bar = "baz"
del(.foo.bar)
string!(.foo.bar)
function call error for "string" at (0:17): expected "string", got "null"
This does not:
foo.bar = "baz"
del(foo.bar)
string!(foo.bar)
error[E620]: can't abort infallible function
┌─ :1:1
│
1 │ string!(foo.bar)
│ ^^^^^^- remove this abort-instruction
│ │
│ this function can't fail
│
= see documentation about error handling at https://errors.vrl.dev/#handling
= see language documentation at https://vrl.dev
The problem is that the del
function uses the update_state
call: https://github.com/vectordotdev/vector/blob/f049246db7e3025aa55eb1e160bd3669b485887d/lib/vrl/stdlib/src/del.rs#L172-L178
This then calls delete_type_def
: https://github.com/vectordotdev/vector/blob/ee6771146836c53cd13f8260b29bc678e61b6330/lib/vrl/compiler/src/expression/query.rs#L53-L62
Which is only implemented to work for external targets, whereas the second example above works on an internal target (variable foo
).