Hi all,

JSON_VALUE will happily take an array type in RETURNING and give you back the 
right column type. It just never gives you a value. These two are straight out 
of CALCITE-6208:

```
SELECT JSON_VALUE('{"foo":[100, null, 200]}', 'lax $.foo' RETURNING INTEGER 
ARRAY);
SELECT JSON_VALUE('{"foo":[[100, null, 200]]}', 'lax $.foo' RETURNING INTEGER 
ARRAY ARRAY);
```

Both come back NULL, lax or strict. ERROR ON ERROR shows what's actually 
happening:

```
Strict jsonpath mode requires scalar value, and the actual value is: '[100, 
null, 200]'  at 
org.apache.calcite.runtime.JsonFunctions$StatefulFunction.jsonValue(JsonFunctions.java:294)
```

CALCITE-6208 is closed as fixed, but it only ever added the return type 
inference: its tests check columnType and nothing else, so there was nothing 
there to catch the missing evaluation.

Should JSON_VALUE's implementation be updated to support this?


Reply via email to