Skip to content

Integrate GEOMETRY and GEOGRAPHY type names with SQL #99

@paleolimbot

Description

@paleolimbot

In the current SQL, the type names for GEOMETRY and GEOGRAPHY (or generally any extension type) are serialized to SQL as their storage type. For example, in the CLI:

> create or replace view test_view as SELECT ST_Point(1,2) as pt;
> select * from test_view;
┌─────────────────────────────┐
│ st_point(Int64(1),Int64(2)) │
│           geometry          │
╞═════════════════════════════╡
│ POINT(1 2)                  │
└─────────────────────────────┘
> \d test_view
┌───────────────┬──────────────┬────────────┬─────────────┬───────────┬─────────────┐
│ table_catalog ┆ table_schema ┆ table_name ┆ column_name ┆ data_type ┆ is_nullable │
│      utf8     ┆     utf8     ┆    utf8    ┆     utf8    ┆    utf8   ┆     utf8    │
╞═══════════════╪══════════════╪════════════╪═════════════╪═══════════╪═════════════╡
│ datafusion    ┆ public       ┆ test_view  ┆ pt          ┆ Binary    ┆ YES         │
└───────────────┴──────────────┴────────────┴─────────────┴───────────┴─────────────┘

Luckily this doesn't come up very often...possibly the other place it might come up is casting (e.g., 'POINT (1 2)'::GEOMETRY), which won't work in SQL either.

I haven't looked into exactly where in DataFusion we'd need to hook into the SQL parser to make this happen but I am guessing it will be somewhat involved.

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