Aqua Data Studio 18.0.0-devi-97
Build #: 49166
Built on: 2016-Mar-27 08:28:48 PM
|
144 KB
|
73 KB
|
58 KB
Hi Jenny,
I'm getting this "Caused by: org.bson.codecs.configuration.CodecConfigurationException: Can't find a codec for interface java.util.List" exception.
Stacktrace is:
java.sql.SQLException: Can't find a codec for interface java.util.List. at com.aquafold.jdbc.mongodb.MongoStatement.getSQLExceptionFromRuntimeException(MongoStatement.java:531) at com.aquafold.jdbc.mongodb.MongoStatement.execute(MongoStatement.java:1588) at com.aquafold.jdbc.mongodb.test.QuickTour.main(QuickTour.java:118) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144) Caused by: org.bson.codecs.configuration.CodecConfigurationException: Can't find a codec for interface java.util.List. at org.bson.codecs.configuration.CodecCache.getOrThrow(CodecCache.java:46) at org.bson.codecs.configuration.ProvidersCodecRegistry.get(ProvidersCodecRegistry.java:63) at org.bson.codecs.configuration.ChildCodecRegistry.get(ChildCodecRegistry.java:51) at com.aquafold.jdbc.mongodb.codecs.DistinctObjectCodec.decode(DistinctObjectCodec.java:73) at com.mongodb.operation.CommandResultArrayCodec.decode(CommandResultArrayCodec.java:48) at com.mongodb.operation.CommandResultDocumentCodec.readValue(CommandResultDocumentCodec.java:53) at org.bson.codecs.BsonDocumentCodec.decode(BsonDocumentCodec.java:81) at org.bson.codecs.BsonDocumentCodec.decode(BsonDocumentCodec.java:40) at com.mongodb.connection.CommandProtocol.execute(CommandProtocol.java:123) at com.mongodb.connection.DefaultServer$DefaultServerProtocolExecutor.execute(DefaultServer.java:159) at com.mongodb.connection.DefaultServerConnection.executeProtocol(DefaultServerConnection.java:286) at com.mongodb.connection.DefaultServerConnection.command(DefaultServerConnection.java:173) at com.mongodb.operation.CommandOperationHelper.executeWrappedCommandProtocol(CommandOperationHelper.java:215) at com.mongodb.operation.CommandOperationHelper.executeWrappedCommandProtocol(CommandOperationHelper.java:206) at com.mongodb.operation.CommandOperationHelper.executeWrappedCommandProtocol(CommandOperationHelper.java:112) at com.mongodb.operation.DistinctOperation$1.call(DistinctOperation.java:159) at com.mongodb.operation.DistinctOperation$1.call(DistinctOperation.java:155) at com.mongodb.operation.OperationHelper.withConnectionSource(OperationHelper.java:239) at com.mongodb.operation.OperationHelper.withConnection(OperationHelper.java:212) at com.mongodb.operation.DistinctOperation.execute(DistinctOperation.java:155) at com.mongodb.operation.DistinctOperation.execute(DistinctOperation.java:61) at com.mongodb.Mongo.execute(Mongo.java:772) at com.mongodb.Mongo$2.execute(Mongo.java:759) at com.mongodb.OperationIterable.iterator(OperationIterable.java:47) at com.mongodb.DistinctIterableImpl.iterator(DistinctIterableImpl.java:82) at com.aquafold.jdbc.mongodb.MongoStatement.selectCore(MongoStatement.java:2207) at com.aquafold.jdbc.mongodb.MongoStatement.compoundSelect(MongoStatement.java:1624) at com.aquafold.jdbc.mongodb.MongoStatement.compoundSelect(MongoStatement.java:1615) at com.aquafold.jdbc.mongodb.MongoStatement.executeQueryCommand(MongoStatement.java:537) at com.aquafold.jdbc.mongodb.MongoStatement.execute(MongoStatement.java:1575) ... 6 more
Please guide me to solve this issue.
Thanks.
To QA: When opening an issue against MongoDB for v18, please include the original issue # or link the original issue that you are performing regression testing for.
To QA: When opening an issue against MongoDB for v18, please include the original issue # or link the original issue that you are performing regression testing for.
Vasudev, take a look at the MongoJdbcDocumentCodecProvider.get method. I think we need to create a Codec class to handle java.util.List.
Vasudev, take a look at the MongoJdbcDocumentCodecProvider.get method. I think we need to create a Codec class to handle java.util.List.
Hi Jenny,
I have checked in code to the branch with svn 7276. Added JavaUtilListCodec.java to handle the List. Please review.
Thanks.
Hi Jenny,
I have checked in code to the branch with svn 7276. Added JavaUtilListCodec.java to handle the List. Please review.
Thanks.
Code review comments for SVN r7276:
- The JavaUtilListCodec class should not return BsonArray. If you run the following query with your code changes, you'll see that the result set is returning BsonArray objects.
select distinct a from eqcoll
- Let's not extend from BsonArrayCodec, but define the class as follows:
public class JavaUtilListCodec implements Codec<MongoList>
The "decode" method should return MongoList.
public MongoList decode(final BsonReader reader, final DecoderContext decoderContext)
- You can take a look MD5Codec as an example. There is also code in MongoJdbcDocumentCodec that handles array values.
Code review comments for SVN r7276:
- The JavaUtilListCodec class should not return BsonArray. If you run the following query with your code changes, you'll see that the result set is returning BsonArray objects.
select distinct a from eqcoll
- Let's not extend from BsonArrayCodec, but define the class as follows:
public class JavaUtilListCodec implements Codec<MongoList>
The "decode" method should return MongoList.
public MongoList decode(final BsonReader reader, final DecoderContext decoderContext)
- You can take a look MD5Codec as an example. There is also code in MongoJdbcDocumentCodec that handles array values.
I have checked-in code to the branch with svn 7328. Please review.
I have checked-in code to the branch with svn 7328. Please review.
Code review comments for SVN r7328:
- The "decode" method doesn't work with String data. Try the following test case:
insert into eqcoll_string(a,b) values(['a','b'],1) go insert into eqcoll_string(a,b) values([['c','d']],2) go
select flatten_array distinct a from eqcoll_string
, the result set is:a --------------------- a b BsonString{value='c'} BsonString{value='d'}
public class JavaUtilListCodec implements Codec<MongoList> {
private final BsonTypeClassMap bsonTypeClassMap;
private final CodecRegistry registry;
private final Transformer valueTransformer;
public JavaUtilListCodec(final CodecRegistry registry,
final BsonTypeClassMap bsonTypeClassMap,
final Transformer valueTransformer) {
this.registry = registry;
this.bsonTypeClassMap = bsonTypeClassMap;
this.valueTransformer = valueTransformer;
}
@Override
public MongoList decode(final BsonReader reader, final DecoderContext decoderContext) {
MongoList list = new MongoList();
reader.readStartArray();
while (reader.readBsonType() != BsonType.END_OF_DOCUMENT) {
BsonType bsonType = reader.getCurrentBsonType();
list.add(valueTransformer.transform(registry.get(bsonTypeClassMap.get(bsonType)).decode(reader, decoderContext)));
}
reader.readEndArray();
return list;
}
Code review comments for SVN r7328:
- The "decode" method doesn't work with String data. Try the following test case:
insert into eqcoll_string(a,b) values(['a','b'],1) go insert into eqcoll_string(a,b) values([['c','d']],2) go
select flatten_array distinct a from eqcoll_string
, the result set is:a --------------------- a b BsonString{value='c'} BsonString{value='d'}
public class JavaUtilListCodec implements Codec<MongoList> {
private final BsonTypeClassMap bsonTypeClassMap;
private final CodecRegistry registry;
private final Transformer valueTransformer;
public JavaUtilListCodec(final CodecRegistry registry,
final BsonTypeClassMap bsonTypeClassMap,
final Transformer valueTransformer) {
this.registry = registry;
this.bsonTypeClassMap = bsonTypeClassMap;
this.valueTransformer = valueTransformer;
}
@Override
public MongoList decode(final BsonReader reader, final DecoderContext decoderContext) {
MongoList list = new MongoList();
reader.readStartArray();
while (reader.readBsonType() != BsonType.END_OF_DOCUMENT) {
BsonType bsonType = reader.getCurrentBsonType();
list.add(valueTransformer.transform(registry.get(bsonTypeClassMap.get(bsonType)).decode(reader, decoderContext)));
}
reader.readEndArray();
return list;
}
Hi Jenny,
I have changed implementation as you per the review comments. Code checked in to the branch with 7356.
Thanks.
Hi Jenny,
I have changed implementation as you per the review comments. Code checked in to the branch with 7356.
Thanks.
Verified in MongoDB 3.2.4, 3.0.9 and 2.6.11 in ADS-18-DEVI-103.
Please refer: verify14359.png
Verified in MongoDB 3.2.4, 3.0.9 and 2.6.11 in ADS-18-DEVI-103.
Please refer: verify14359.png
Verified in ADS-18.0.0.RC-15. Refer updated screenshot 'Updated_14359.png'
Verified in ADS-18.0.0.RC-15. Refer updated screenshot 'Updated_14359.png'
Issue #14359 |
Closed |
Fixed |
Resolved |
Completion |
No due date |
Fixed Build svn 7384 |
No time estimate |
1 issue link |
relates to #9676
Issue #9676Strange result of DISTINCT from FLATTEN_ARRAY |
Hi Jenny,
I'm getting this "Caused by: org.bson.codecs.configuration.CodecConfigurationException: Can't find a codec for interface java.util.List" exception.
Stacktrace is:
Please guide me to solve this issue.
Thanks.