dolt icon indicating copy to clipboard operation
dolt copied to clipboard

json_value parser support for options

Open max-hoffman opened this issue 2 years ago • 0 comments

The mysql syntax for json_value is:

JSON_VALUE(json_doc, path [RETURNING type] [on_empty] [on_error])

on_empty:
    {NULL | ERROR | DEFAULT value} ON EMPTY

on_error:
    {NULL | ERROR | DEFAULT value} ON ERROR

The arguments consider of 1) the input json string or document, 2) the path that we want to search into the document, and 3 post-processing options depending on the value or error returned by the path lookup.

Reference here

We currently support type as a third comma-separated argument as a shortcut, and do not support on_empty and on_error. It would be nice to add parser support to be mysql compatible here. Some of the function evaluation code would change for on_empty and on_error, but the lift is mostly at the parser/AST layer.

max-hoffman avatar Oct 19 '23 19:10 max-hoffman