Hi Neha Saini, I'm afraid currently array access is not translated in mongo adapter.
There is a PR https://github.com/apache/calcite/pull/720 which needs to be corrected. Thanks, Andrei. On Mon, Oct 14, 2019 at 3:01 AM Danny Chan <yuzhao....@gmail.com> wrote: > Hi, Neha Saini > > What do you mean by MongoDB view, can you give more details, so we can > give as much help if we can. > > Best, > Danny Chan > 在 2019年10月14日 +0800 PM2:21,Neha Saini <sain...@hcl.com>,写道: > > Hi Team, > > > > Gentle reminder! > > > > Regards, > > Neha Saini > > > > From: Neha Saini > > Sent: Thursday, October 10, 2019 3:30 PM > > To: dev@calcite.apache.org > > Subject: Calcite - Model - MongoDB view > > > > Hi Team, > > > > Greetings for the day. > > > > I am working as a technical architect in HCL technologies. > > I am doing a PoC on Apache calcite. > > > > Using MongoDB adapter I want to use calcite sql parser on mongo db > database. > > I am stuck at a point and need your help in the same. > > > > My data in Mongo DB has following structure:- > > { > > "_id": "tt0772249", > > "title": "Palaces of a Queen", > > "type": "movie", > > "year": 1967, > > "crew": [{ > > "name": "Micael Calunga", > > "role": "actor" > > }, { > > "name": "Jordon Zonotti", > > "role": "actress" > > } > > ] > > } > > > > I want to create view with column title, year, crew.name > > But in modql.json , I am not able to MAP array of objects, like > crew.name 0th element, or nth element. > > > > "tables": [ > > { > > "name": "movie", > > "type": "view", > > "sql": "select cast(_MAP['title'] AS varchar(100)) AS title, > cast(_MAP['year'] AS varchar(4)) AS year, cast(_MAP['crew.name'][0] AS > varchar(20)) AS crewname from \"mongo_raw\".\"movie\"" > > }, > > > > > > In the GIThib code, we have zip example, but zip file is a flat json, > but json I am using is embedded , hence not able to use the example. > > > > I would really appreciate some help. > > > > Thanks! > > > > Regards, > > Neha Saini > > > > ::DISCLAIMER:: > > ________________________________ > > The contents of this e-mail and any attachment(s) are confidential and > intended for the named recipient(s) only. E-mail transmission is not > guaranteed to be secure or error-free as information could be intercepted, > corrupted, lost, destroyed, arrive late or incomplete, or may contain > viruses in transmission. The e mail and its contents (with or without > referred errors) shall therefore not attach any liability on the originator > or HCL or its affiliates. Views or opinions, if any, presented in this > email are solely those of the author and may not necessarily reflect the > views or opinions of HCL or its affiliates. Any form of reproduction, > dissemination, copying, disclosure, modification, distribution and / or > publication of this message without the prior written consent of authorized > representative of HCL is strictly prohibited. If you have received this > email in error please delete it and notify the sender immediately. Before > opening any email and/or attachments, please check them for viruses and > other defects. > > ________________________________ >