Hi Jiang

Thanks for bringing this to our attention.

However, we're not actively developing the Mongo storage plugin at the
moment, so it might be a while before this is updated.

Do you think you could help with submitting a pull-request against a JIRA
filed for this? You already appear to have become familiar with the Drill
codebase, and we're looking to contributions from the community.


~ Kunal

On Tue, Mar 13, 2018 at 3:23 PM, Jiang Wu <jiang...@mulesoft.com> wrote:

> Setup:
>
>
>   1.  Mongodb with this sample data inside:
>
> db.test.findOne();
> {
>      "_id" : ObjectId("5aa8487d470dd39a635a12f5"),
>      "name" : "orange",
>      "context" : {
>            "time" : ISODate("2018-03-13T21:52:54.940Z"),
>            "user" : "jack"
>      }
> }
>
>
>   1.  Connect with Drill 1.12 and run the query:
>
>
> select t.context.`time` as `time`, t.context from mongo.test.test t;
>
> The result is:
>
> +------------+---------+
> | time       | context |
> +------------+---------+
> | 2018-03-13 | 
> {"time":{"dayOfYear":72,"year":2018,"dayOfMonth":13,"dayOfWeek":2,
> ... },"user":"jack"} |
> +------------+---------+
>
> Note how the output formatting of the same field “time” is different
> depending on whether the time is shown as a first level column or as a
> nested JSON field.  Has anyone seen this behavior?
>
> Looking at the source code, it appears that the JSON output is produced
> from JsonStringHashMap.java:79 (org.apache.drill.exec:vector:1.12.0).
> This class uses its own ObjectMapper instance to serialize the map.
>
> Would it better to add some Mixin’s to the various complex types that may
> appear inside this JsonStringHashMap?  For example, DateTime object can be
> serialized using the logical representation, rather than the getters of the
> DataTime class used by Drill.
>
> Thanks.
>
> -- Jiang
>
>

Reply via email to