zhang-jianq opened a new issue, #13467:
URL: https://github.com/apache/gluten/issues/13467
### Description
## Motivation
Flink's `JSON_VALUE` is a core SQL/JSON path expression — it extracts a
scalar from a JSON document and returns it as a typed value. Today gluten-flink
does not map it, so any Calc projecting `JSON_VALUE(...)` fails function
offload ("Function not supported") and stays on the native path.
## Proposal
Offload it to the velox flinksql function set:
- velox side (companion PR): a Flink-semantics `JSON_VALUE` under
`velox/functions/flinksql/` —
`json_value(json, path, onEmpty, onEmptyDefault, onError, onErrorDefault)
-> varchar`. It extracts the scalar referenced by the SQL/JSON path via
simdjson, routes every non-scalar case to **ON EMPTY** in `lax` mode (or **ON
ERROR** in `strict`/default mode), and applies the **NULL / ERROR / DEFAULT**
handler. velox's prestosql `json_extract_scalar(json, path)` is not reused
because it collapses both ON EMPTY and ON ERROR to NULL and has no RETURNING
conversion.
- planner side (this repo): `JSON_VALUE -> JsonValueRexCallConverter` — a
dedicated converter that parses the Flink operand layout (json expression, path
literal, then alternating `(behavior, [default], ON EMPTY|ON ERROR)` triplets)
into the 7-arg velox call, and wraps a non-VARCHAR `RETURNING` in a `CAST`.
Semantics to preserve: `lax`/`strict` routing, the three handlers, scalar
extraction of string/number/boolean, null propagation (NULL json in -> NULL
out), and `RETURNING` type conversion.
Gluten version: main branch (gluten-flink)
### Gluten version
main branch
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]