PLANNED MAINTENANCE

Hello, DataStax Community!

We want to make you aware of a few operational updates which will be carried out on the site. We are working hard to streamline the login process to integrate with other DataStax resources. As such, you will soon be prompted to update your password. Please note that your username will remain the same.

As we work to improve your user experience, please be aware that login to the DataStax Community will be unavailable for a few hours on:

  • Wednesday, July 15 16:00 PDT | 19:00 EDT | 20:00 BRT
  • Thursday, July 16 00:00 BST | 01:00 CEST | 04:30 IST | 07:00 CST | 09:00 AEST

For more info, check out the FAQ page. Thank you for being a valued member of our community.


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.