Skip to content

Metadata types should be duckdb types #28

Open
@tarasglek

Description

@tarasglek

I noticed that metadata returned when POSTing to /?default_format=JSONCompact uses non-duckdb types and they are usually strings. Is this to be compatible with clickhouse?

I think it would make more sense to use duckdb types (eg VARCHAR > String), (INT > Int32)
eg

select 1

returns

{
  "meta": [
    {
      "name": "1",
      "type": "Int32"
    }
  ],
  "data": [
    [
      "1"
    ]
  ],
  "rows": 1
}
WITH l33t_uuid AS (
  SELECT 'deadbeef-1337-4b1d-8008-0123456789ab'::UUID AS uuid_value
)
SELECT
  uuid_value::VARCHAR AS uuid_string,
  uuid_value AS uuid_uuid,
  typeof(uuid_value::VARCHAR) AS uuid_string_type,
  typeof(uuid_value) AS uuid_uuid_type
FROM l33t_uuid;

Returns

{
  "meta": [
    {
      "name": "uuid_string",
      "type": "String"
    },
    {
      "name": "uuid_uuid",
      "type": "String"
    },
    {
      "name": "uuid_string_type",
      "type": "String"
    },
    {
      "name": "uuid_uuid_type",
      "type": "String"
    }
  ],
  "data": [
    [
      "deadbeef-1337-4b1d-8008-0123456789ab",
      "deadbeef-1337-4b1d-8008-0123456789ab",
      "VARCHAR",
      "UUID"
    ]
  ],
  "rows": 1
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions