I'm interested in implementing JSON_TABLE functionality for Calcite

This opens up some neat usecases, like adding HTTP request UDF's
then using JSON_TABLE to convert the result into a table:

SELECT JSON_TABLE(
HTTP_GET('http://localhost:8080/api/v1/users/1'))

Adding support for all of the functionality seems difficult,
but I'm wondering whether this could be done as a "SqlTableFunction" UDF?

I'm thinking it might be possible if the JSON_TABLE udf
expects Map<String, Object> and does inference based on that?

Something like:

WITH users AS (
    SELECT HTTP_GET('http://localhost:8080/api/v1/users')
) SELECT
    id,
    name
FROM
    JSON_TABLE(JSON_PATH(users, "$.0"))

Does anyone have ideas or see issues with this approach?
Thank you =)

Reply via email to