Forum Discussion
Patrick Naughton
Oct 10, 2018Brass Contributor
scalar variable support for matches regex
The following example shows how the binary operator == works with a scalar variable as the right hand side.
datatable(a: string, b: string) [ "foo", "blah*", "bar", "ba*", "same", "same" ] | where a == b
This works fine and returns the "same", "same" row...
Why doesn't the matches regex operator work the same way?
datatable(a: string, b: string) [ "foo", "blah*", "bar", "ba*", "same", "same" ] | where a matches regex b
I would have expected it to return the "bar", "ba*" row.
Instead it says:
SYNTAX ERROR matches regex: failed to cast argument 2 to scalar constant Support id: a11422a7-01b7-486b-84f1-e7473be0e164
- avner
Microsoft
Hi Patrick,
The argument to 'matches regex' is a constant as the error message says. This is in order to ensure that the predicate is not calculated for each row something that will result in a very poor performance.
Thanks,
Avner