Martin Dearnley created CALCITE-3337:
----------------------------------------
Summary: Support query arrays of Embedded Documents in MongoDB
adapter
Key: CALCITE-3337
URL: https://issues.apache.org/jira/browse/CALCITE-3337
Project: Calcite
Issue Type: Improvement
Components: mongodb-adapter
Reporter: Martin Dearnley
With CALCITE-194 it will be possible to SELECT elements of arrays.
Would be great to support WHERE clauses for arrays especially for arrays of
embedded documents.
I tried it with the fix from CALCITE-194
{code:java}
{
"name": "ZIPS",
"type": "view",
"sql": "select cast(_MAP['city'] AS varchar(20)) AS city,\n
cast(_MAP['loc'][0] AS float) AS longitude, cast(_MAP['loc'][1] AS float) AS
latitude, cast(_MAP['pop'] AS integer) AS pop, cast(_MAP['state'] AS
varchar(2)) AS state, cast(_MAP['_id'] AS varchar(5)) AS id from
\"mongo_raw\".\"zips\""
}
Select longitude from zips where longitude = -71.425486
{code}
Mongo Adapter Exception
{code:java}
java.lang.AssertionError: cannot translate op null call
=(CAST(CAST(ITEM(ITEM($0, 'loc'), 0)):FLOAT):DOUBLE, -71.425486)
{code}
--
This message was sent by Atlassian Jira
(v8.3.2#803003)