Skip to content

Starburst json type is erroneously mapped to :type/Text  #123

@atekin

Description

@atekin

In the following code
https://github.com/starburstdata/metabase-driver/blob/f4fe016552eed2567addb5c5f9af6edaa5322a59/drivers/starburst/src/metabase/driver/implementation/sync.clj#L45C40-L45C50
Starburst json type is being mapped to :type/Text. This make Metabase thinks some columns errernously as varchar and send queries like
... SUBSTRING("some_json_column", 1, 1234) "substring2494"...
which throws an exception like:
io.trino.spi.TrinoException: line 1:3439: Unexpected parameters (json, integer, integer) for function substring. Expected: substring(char(x), bigint), substring(char(x), bigint, bigint), substring(varchar(x), bigint), substring(varchar(x), bigint, bigint)

If one looks at postgres driver line 605 and 606 can see that https://github.com/metabase/metabase/blob/6fe41dd4379f4476b3eb78215b600393dd34474d/src/metabase/driver/postgres.clj#L605
and https://github.com/metabase/metabase/blob/6fe41dd4379f4476b3eb78215b600393dd34474d/src/metabase/driver/postgres.clj#L606

:json :type/JSON
:jsonb :type/JSON

Could you please correct json fields as :type/JSON

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions