[
https://issues.apache.org/jira/browse/CALCITE-2755?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16729809#comment-16729809
]
Julian Hyde commented on CALCITE-2755:
--------------------------------------
I've not looked at your PR, but it seems to me that the most natural thing is
to treat _id as a system field. Such fields are available if you ask for them,
but do not appear in "*".
For example, ROWID is a system field in Oracle:
{code:java}
select * from dept; -- returns DEPTNO, DNAME
select rowid, deptno from dept; -- returns ROWID, DEPTNO
select d.rowid, d.deptno from dept as d; -- as previous, with table alias{code}
Therefore I think that Calcite's elastic adapter should do the following:
{code:java}
select _id, _MAP['foo'] as foo from elastic; -- returns _id, foo
select * from elastic; -- I'm not sure what columns are returned, but not _id
select _id, * from elastic; -- returns _id plus all non-system columns
select e._id, e.* from elastic as e; -- as previous, with table alias{code}
> expose document _id field when querying ElasticSearch
> -----------------------------------------------------
>
> Key: CALCITE-2755
> URL: https://issues.apache.org/jira/browse/CALCITE-2755
> Project: Calcite
> Issue Type: Improvement
> Components: elasticsearch-adapter
> Reporter: Andrei Sereda
> Assignee: Julian Hyde
> Priority: Major
> Labels: pull-request-available
>
> Elastic exposes
> [_id|https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-id-field.html]
> field for each document (think unique doc ID).
> Expose if it is explicitly listed in projection:
> {code:sql}
> select _MAP['_id'], _MAP['foo'] from elastic -- available
> select * from elastic -- not available
> {code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)