[Bug] unexpected behavior from Canvas expression switch
function
#131657
Labels
bug
Fixes for quality problems that affect the customer experience
Feature:ExpressionLanguage
Interpreter expression language (aka canvas pipeline)
impact:medium
Addressing this issue will have a medium level of impact on the quality/strength of our product.
loe:small
Small Level of Effort
Kibana version:
As far back as 7.17.1
Describe the bug:
The Canvas
switch
expression function evaluates allcase
s before selecting its final result. This seems like unexpected behavior and prevents a previouscase
from being used as a guard for a followingcase
.Steps to reproduce:
kibana_sample_data_flights
Result: The second case (which invokes getCell) is evaluated even though the first case (which checks for an empty datatable) evaluates to true. This results in a runtime error from

getCell
being run on an empty table.The user can still guard their second case with an extra
if
function in a subexpression.Expected behavior:
The
switch
function checks thecase
s serially. As soon as acase
evaluates to true, theswitch
function resolves with that result.The text was updated successfully, but these errors were encountered: