[
https://issues.apache.org/jira/browse/CALCITE-1861?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16077211#comment-16077211
]
Julian Hyde commented on CALCITE-1861:
--------------------------------------
Ah, HilbertCurve2D looks perfect. I've been thinking about how to generate
ranges on the Hilbert curve from a shape (rectangle or circle) and I realized
it wasn't going to be trivial.
To answer your earlier questions about Calcite. It is the top half of a
database, the brains without the brawn. So, it doesn't have any data structures
(e.g. b-tree indexes) or algorithms (e.g. hash join) but it works in terms of
relational algebra. It translates a SQL query into logical relational algebra,
and then optimizes it to physical relational algebra of the target system.
Sometimes that means generating a query to send to a particular back-end system
such as Solr/Lucene, HBase, Druid.
Rewriting spatial queries to Hilbert curves is a good fit for Calcite because
it is a logical rewrite; it doesn't require any particular data structure to
make it work. But we do need the logic to transform (x, y) regions into Hilbert
curve ranges, because that happens at query planning time.
Spatial support would also mean adding a core set of spatial data types and
functions to our SQL dialect. Systems that use Calcite as their SQL front-end
would need to implement those functions.
Most of the functions are not interesting from a query optimization standpoint
- they process one row at a time - so we'd pass them straight through to the
back end. But the "WHERE distance(point(x, y), point(x2, y2)) < constant" case
is interesting, because to be handled efficiently the query needs to be
transformed to use an index.
> Spatial Indexes
> ---------------
>
> Key: CALCITE-1861
> URL: https://issues.apache.org/jira/browse/CALCITE-1861
> Project: Calcite
> Issue Type: Improvement
> Reporter: Atri Sharma
> Assignee: Julian Hyde
>
> 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
(v6.4.14#64029)