Github user chunhui-shi commented on the issue:
https://github.com/apache/drill/pull/702
MongoGroupScan tries to read first record to guess record width. So this
toJson is called for only first record.
Notice that MongoClient.getDefaultCodecRegistry() contains
DBRefCodecProvider:
Shown in MongoClient.java(In MongoClient.java):
private static final CodecRegistry DEFAULT_CODEC_REGISTRY =
fromProviders(asList(new ValueCodecProvider(),
new DBRefCodecProvider(),
new DocumentCodecProvider(new
DocumentToDBRefTransformer()),
new DBObjectCodecProvider(),
new BsonValueCodecProvider(),
new GeoJsonCodecProvider()));
but a default DocumentCodec constructor does not. And it was this
constructor get called if we don't set a codec for toJson function to use. The
list of CodecProviders is shown in DocumentCodec.java in MongoDb's code:
public class DocumentCodec implements CollectibleCodec<Document> {
private static final String ID_FIELD_NAME = "_id";
private static final CodecRegistry DEFAULT_REGISTRY =
fromProviders(asList(new ValueCodecProvider(),
new BsonValueCodecProvider(),
new DocumentCodecProvider()));
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---