You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Platon Bibik (Jira)" <ji...@apache.org> on 2020/01/23 16:16:00 UTC

[jira] [Commented] (CALCITE-2426) Calcite - mongodb - Returns row but no data displayed.

    [ https://issues.apache.org/jira/browse/CALCITE-2426?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17022235#comment-17022235 ] 

Platon Bibik commented on CALCITE-2426:
---------------------------------------

Hi [~citsathishcs@gmail.com], [~sereda] and all,

Was testing out Calcite recently for my project (particularly – the MongoDB adapter), as I was really impressed by the idea behind the tool and capabilities it provides. I have found this ticket while trying to use * projection in mongo requests. Unfortunately, as [~citsathishcs@gmail.com] already pointed out, there are't any comprehensive docs on MongoDB adapter, and I had to figure out things myself by reading the source code.

The problem I am having is that when a "star" projection is used in mongo queries, result set's rows contain one column {{_MAP}} with value {{null}}. After some debugging, I figured out that the {{MongoEnumerator}} is using a wrong getter in the calls to the {{MongoTable's}} methods (in my case it was aggregate). While it seems like it should choose {{mapGetter}}, it chooses {{singletonGetter}}, because the {{fields}} parameter passed to the +{{Function1<Document, Object> getter(List<Entry<String, Class>> fields)}}+ method is non-null (contains one {{_MAP}} element).

 

Is this behaviour intended? Or are there any plans/ideas on how to fix it?

 

Any comment/suggestion would be highly appreciated. I really hope that in the end this won't stop me from using the lib =)

> Calcite - mongodb - Returns row but no data displayed.
> ------------------------------------------------------
>
>                 Key: CALCITE-2426
>                 URL: https://issues.apache.org/jira/browse/CALCITE-2426
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: sathishkumar
>            Priority: Critical
>
> sqlline version 1.3.0
>  sqlline> !connect jdbc:calcite:schemaFactory=org.apache.calcite.adapter.mongodb.MongoSchemaFactory;schema.host=localhost;schema.database=*****; admin admin
>  0: jdbc:calcite:schemaFactory=org.apache.calc> !tables
>  
>  +------------+------------++------------------------++-------------------++-----------------------++--------------------
> |TABLE_CAT|TABLE_SCHEM|TABLE_NAME|TABLE_TYPE|REMARKS|TYPE_CAT|TYPE_SCHEM|TYPE_NAME|SELF_REFERENCING_C|
> +------------+------------++------------------------++-------------------++-----------------------++--------------------
> | |adhoc|company_preferences|TABLE| | | | | |
> | |adhoc|property|TABLE| | | | | |
> | |adhoc|templates|TABLE| | | | | |
> | |adhoc|user_preferences|TABLE| | | | | |
> *| | adhoc | users | TABLE | | | | | |*
> | |metadata|COLUMNS|SYSTEM TABLE| | | | | |
> | |metadata|TABLES|SYSTEM TABLE| | | | | |
> +------------+------------++------------------------++-------------------++-----------------------++--------------------
>  0: jdbc:calcite:schemaFactory=org.apache.calc> *select * from "users";*
>  +------+
> |_MAP|
> +------+
> | |
> +------+
>  *1 row selected (0.584 seconds)*
>  0: jdbc:calcite:schemaFactory=org.apache.calc>



--
This message was sent by Atlassian Jira
(v8.3.4#803005)