DataStax Academy FAQ

DataStax Academy migrated to a new learning management system (LMS) in July 2020. We are also moving to a new Cassandra Certification process so there are changes to exam bookings, voucher system and issuing of certificates.

Check out the Academy FAQ pages for answers to your questions:


question

mayurajoundal_194027 avatar image
mayurajoundal_194027 asked ·

Codec not found for requested operation map<-> java.util.map

Hi ,

I have cassandra table with one property as nested collection

e.g audit frozen<list<Map<text,text>>>

when I am trying to fire select query from java code , i am getting exception as codec not found.

In java side , I have used the @Frozen annotation. Still I am getting same exception

Can anyone please help me .

spring-data-cassandra
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

Cedrick Lunven avatar image
Cedrick Lunven answered ·

Sure. Can you share with us TABLE SHEMA and java CODE ? github to share?


Here you need to do getList() because you have a LIST of MAP. `@Frozen` won't help here this how to read the value as an object.

8 comments Share
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

cassndra_nested_collection_issue.zip


Hi Lunven ,

Please find attached zip file

1. RefDataMapping.java : Pojo

2. RefDataMappingRepository : Cassandra Repository

3. RefDataServiceImpl : service

4.table_schema

I am getting below exception in RefdataServiceImpl , while calling findById() method

codec not found for requested operation [map<varchar,varchar> <-> java.util.Map]

1 Like 1 · ·
Cedrick Lunven avatar image Cedrick Lunven ♦ mayurajoundal_194027 ·

got all the files, let me create a small test to reproduce and fix

0 Likes 0 · ·
Cedrick Lunven avatar image Cedrick Lunven ♦ mayurajoundal_194027 ·

ha... your are not using the datastax driver but spring-data-cassandra

0 Likes 0 · ·
Cedrick Lunven avatar image Cedrick Lunven ♦ mayurajoundal_194027 ·

I can fix that using our driver would it be OK ?

I also transmit the question to spring-data-cassandra peeps, this is too magic until it does not work and as far as I read that it is not support : https://stackoverflow.com/questions/62694080/codec-not-found-for-requested-operation-mapvarchar-int-java-util-map

0 Likes 0 · ·

where exactly we need to do getList()?

0 Likes 0 · ·

Hi Lunven ,

Please find attached zip file

1. RefDataMapping.java : Pojo

2. RefDataMappingRepository : Cassandra Repository

3. RefDataServiceImpl : service

4.table_schema

I am getting below exception in RefdataServiceImpl , while calling findById() method

codec not found for requested operation [map<varchar,varchar> <-> java.util.Map]cassndra_nested_collection_issue.zip

0 Likes 0 · ·
Cedrick Lunven avatar image Cedrick Lunven ♦ mayurajoundal_194027 ·

the row.getList() will be done using DataStax driver, here you are using Spring Data Cassandra so it is not a valid assertion.

As far as i know what you are trying in not supported by spring-data-cassandra (nested collection subtyping) and this is the reason why I proposed you to do the code with the official drivers like weeks 3/4 of the workshop.


0 Likes 0 · ·
Cedrick Lunven avatar image Cedrick Lunven ♦ mayurajoundal_194027 ·

[update] I do have confirmation from the Spring Data Team that this is a BUG. They asked me to open a KIRA ticket on https://jira.spring.io

1 Like 1 · ·