You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by Vladimir Dolzhenko <vl...@gmail.com> on 2017/12/20 10:09:14 UTC

JOINs in MonboDB adapter

Hi,

Have tried Calcite's MongoDB adapter

SELECT _MAP['id'] as id, _MAP['name'] as name, _MAP['someRef'] as someRef
FROM myCollection

definitely works fine, and the problem appeared when I added JOIN

SELECT col1._MAP['id'] as id, col1._MAP['name'] as name,
col1._MAP['someRef'] as someRef, col2._MAP['name'] as name2 FROM
myCollection as col1 LEFT JOIN col2 on col1._MAP['someRef'] =
col2._MAP['id']

it leads to mongo projections [{$project: {_MAP: 1, '$f1': '$someRef'}}]
and [{$project: {'$f1': '$id'}}] - that is illegal as fieldPath field names
may not start with '$'.

Is it an issue or wrong usage ?

-- 
Regards, Vladimir Dolzhenko.

Re: JOINs in MonboDB adapter

Posted by Julian Hyde <jh...@apache.org>.
As I said, please log a JIRA case.


> On Dec 21, 2017, at 2:18 AM, Vladimir Dolzhenko <vl...@gmail.com> wrote:
> 
> Well,
> 
> I found a workaround - using VIEWs - but - whenever I use VIEW - filtration
> (WHERE clauses) are performing in memory - it does not propagate filtration
> options to mongo as $match, while quering collection directly (w/o) VIEW
> performing with $match.
> 
> is it a known issue ? Maybe somebody can give me a clue if it is possible
> to fix it easily ?
> 
> 
> On 20 December 2017 at 17:15, Julian Hyde <jh...@apache.org> wrote:
> 
>> That sounds like an issue. Please log a JIRA case. (Also, contributions
>> are appreciated… we don’t seem to have many people volunteering to fix the
>> MongoDB adapter these days.)
>> 
>>> On Dec 20, 2017, at 2:09 AM, Vladimir Dolzhenko <
>> vladimir.dolzhenko@gmail.com> wrote:
>>> 
>>> Hi,
>>> 
>>> Have tried Calcite's MongoDB adapter
>>> 
>>> SELECT _MAP['id'] as id, _MAP['name'] as name, _MAP['someRef'] as someRef
>>> FROM myCollection
>>> 
>>> definitely works fine, and the problem appeared when I added JOIN
>>> 
>>> SELECT col1._MAP['id'] as id, col1._MAP['name'] as name,
>>> col1._MAP['someRef'] as someRef, col2._MAP['name'] as name2 FROM
>>> myCollection as col1 LEFT JOIN col2 on col1._MAP['someRef'] =
>>> col2._MAP['id']
>>> 
>>> it leads to mongo projections [{$project: {_MAP: 1, '$f1': '$someRef'}}]
>>> and [{$project: {'$f1': '$id'}}] - that is illegal as fieldPath field
>> names
>>> may not start with '$'.
>>> 
>>> Is it an issue or wrong usage ?
>>> 
>>> --
>>> Regards, Vladimir Dolzhenko.
>> 
>> 
> 
> 
> -- 
> Regards, Vladimir Dolzhenko.


Re: JOINs in MonboDB adapter

Posted by Vladimir Dolzhenko <vl...@gmail.com>.
Well,

I found a workaround - using VIEWs - but - whenever I use VIEW - filtration
(WHERE clauses) are performing in memory - it does not propagate filtration
options to mongo as $match, while quering collection directly (w/o) VIEW
performing with $match.

is it a known issue ? Maybe somebody can give me a clue if it is possible
to fix it easily ?


On 20 December 2017 at 17:15, Julian Hyde <jh...@apache.org> wrote:

> That sounds like an issue. Please log a JIRA case. (Also, contributions
> are appreciated… we don’t seem to have many people volunteering to fix the
> MongoDB adapter these days.)
>
> > On Dec 20, 2017, at 2:09 AM, Vladimir Dolzhenko <
> vladimir.dolzhenko@gmail.com> wrote:
> >
> > Hi,
> >
> > Have tried Calcite's MongoDB adapter
> >
> > SELECT _MAP['id'] as id, _MAP['name'] as name, _MAP['someRef'] as someRef
> > FROM myCollection
> >
> > definitely works fine, and the problem appeared when I added JOIN
> >
> > SELECT col1._MAP['id'] as id, col1._MAP['name'] as name,
> > col1._MAP['someRef'] as someRef, col2._MAP['name'] as name2 FROM
> > myCollection as col1 LEFT JOIN col2 on col1._MAP['someRef'] =
> > col2._MAP['id']
> >
> > it leads to mongo projections [{$project: {_MAP: 1, '$f1': '$someRef'}}]
> > and [{$project: {'$f1': '$id'}}] - that is illegal as fieldPath field
> names
> > may not start with '$'.
> >
> > Is it an issue or wrong usage ?
> >
> > --
> > Regards, Vladimir Dolzhenko.
>
>


-- 
Regards, Vladimir Dolzhenko.

Re: JOINs in MonboDB adapter

Posted by Julian Hyde <jh...@apache.org>.
That sounds like an issue. Please log a JIRA case. (Also, contributions are appreciated… we don’t seem to have many people volunteering to fix the MongoDB adapter these days.)

> On Dec 20, 2017, at 2:09 AM, Vladimir Dolzhenko <vl...@gmail.com> wrote:
> 
> Hi,
> 
> Have tried Calcite's MongoDB adapter
> 
> SELECT _MAP['id'] as id, _MAP['name'] as name, _MAP['someRef'] as someRef
> FROM myCollection
> 
> definitely works fine, and the problem appeared when I added JOIN
> 
> SELECT col1._MAP['id'] as id, col1._MAP['name'] as name,
> col1._MAP['someRef'] as someRef, col2._MAP['name'] as name2 FROM
> myCollection as col1 LEFT JOIN col2 on col1._MAP['someRef'] =
> col2._MAP['id']
> 
> it leads to mongo projections [{$project: {_MAP: 1, '$f1': '$someRef'}}]
> and [{$project: {'$f1': '$id'}}] - that is illegal as fieldPath field names
> may not start with '$'.
> 
> Is it an issue or wrong usage ?
> 
> -- 
> Regards, Vladimir Dolzhenko.