drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chunhui-shi <...@git.apache.org>
Subject [GitHub] drill issue #702: DRILL-5088: set default codec for toJson
Date Thu, 12 Jan 2017 08:30:57 GMT
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message