[ 
https://issues.apache.org/jira/browse/CALCITE-1861?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17039430#comment-17039430
 ] 

Julian Hyde commented on CALCITE-1861:
--------------------------------------

Thanks for digging up the changes I made to {{spatial.md}}; I had forgotten 
about that! [~txy2539], the table definition [~mmior] refers to is this:
{code:java}
CREATE TABLE Restaurants (
   VARCHAR(20) cuisine,
   INT x NOT NULL,
   INT y NOT NULL,
   INT h  NOT NULL DERIVED (ST_Hilbert(x, y)))
 SORT KEY (h);
{code}
The {{DERIVED}} keyword is crucial. It means that the column is always computed 
(and therefore the planner can rely on the value of the column always being the 
hilbert index).

The {{SORT KEY}} declaration is quite important. The rewrite will still work 
without it, but if the table is not known to be sorted, the system will have to 
do a full scan. The physical organization of the table depends on which system 
you are targeting. IIRC, Calcite tables don't support {{SORT KEY}} so this is 
basically pseudo-syntax.

> Spatial Indexes
> ---------------
>
>                 Key: CALCITE-1861
>                 URL: https://issues.apache.org/jira/browse/CALCITE-1861
>             Project: Calcite
>          Issue Type: Improvement
>          Components: spatial
>            Reporter: Atri Sharma
>            Priority: Major
>
> Many Calcite users, like Phoenix and Flink can benefit from support of 
> Spatial indexes.
> See:
> http://revenant.ca/www/postgis/workshop/indexing.html



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to