drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tugdual Grall <tgr...@maprtech.com>
Subject Re: [MongoDB] - Why not returning the _id when using *
Date Mon, 19 Oct 2015 12:46:24 GMT
>
>
> >> I do not understand why the '_id' is not returned when I do:
>
> >> select * from mongo.db.collection
>
> >> Any reason?
> In most of the scenarios _id is system generated and not used for
> analytics. That's why, we thought of ignoring this field as of  "select *",
> but user can explicitly mention _id in queries and get the results.
>
> Other than this, there is no particular reason.
>
>
I still would like to have the _id in the *, since it is not always
generated and still used to drill down in some apps/queries.

If you look at the way way mongo is working, it is the opposite of what
Drill is doing:
 - when you put a projection in a find the _id is return by default, and
not returned only when you mendion "_id":0

--
db.infos.find({}, { a:1} )
{ "_id" : ObjectId("5624e5b732244e74867ffda7"), "a" : 0 }

db.infos.find({}, { a:1, _id:0} )
{ "a" : 0 }
--

Projecting the _id works only when you do not mention * as you can see in
this bug:
https://issues.apache.org/jira/browse/DRILL-3505

Since for me it does not cost a lot to return the _id in the * projection,
I would prefer to have it by default.

I have tried to fix the bug, but as mentioned, it would make sense to
return it by default when using *.

Tug


>
>
> Thanks & Regards,
> B Anil Kumar.
>
> On Mon, Oct 19, 2015 at 10:54 AM, Tugdual Grall <tugdual@gmail.com> wrote:
>
> > Hello,
> >
> > I do not understand why the '_id' is not returned when I do:
> >
> > select * from mongo.db.collection
> >
> > Any reason?
> >
> > I would like to remove this line:
> >
> >
> https://github.com/apache/drill/blob/master/contrib/storage-mongo/src/main/java/org/apache/drill/exec/store/mongo/MongoRecordReader.java#L82
> >
> >
> > (This would solve this issue in the same time:
> > https://issues.apache.org/jira/browse/DRILL-3505 )
> >
> > Regards
> > Tug
> > @tgrall
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message