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

bb.addagada_90355 avatar image
bb.addagada_90355 asked ·

Unexpected error during query org.apache.cassandra.serializers.MarshalException: Expected 8 or 0 byte long for date (4)

While Executing Prepared statements form application, we are observing the above-mentioned error from the driver.


DSE Version:- 5.1.5

DSE Java Driver :- 1.6.7

cassandrajava
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

Erick Ramirez avatar image
Erick Ramirez answered ·

@bb.addagada_90355 Based on the minimal information you provided, my guess is that your queries don't list the columns (use of wildcards) in this manner:

SELECT * FROM ... WHERE ...

If at some point the schema for the table changes, it no longer matches the schema of the cached prepared statement so the values being returned is not what the driver expected.

The best practice is to explicitly enumerate the columns you want to retrieve from the table so the application gets exactly the columns it expects. For example:

SELECT col1, col2, col3 FROM ... WHERE ...

This should prevent the prepared statements from getting out-of-sync with the schema. Cheers!

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.