0

Here's a strange one.

I've got a Cassandra table, call it, "test". It has several columns. These are queried via the Java driver, with a simple "select * from test where uuid=foo".

This works locally, all columns are returned.

In production environment, however, one column is dropped, despite it having data in it (which demonstrates the column can be written to).

I've looked at ColumnDefinitions for the Row object, and it indeed does not contain the column in question.

Why? Anyone even have a workable theory?

Community
  • 1
  • 1
mtyson
  • 8,196
  • 16
  • 66
  • 106
  • are you using a PreparedStatement for your 'select *' query? If the schema of the table changes after you define your prepared statement, it will need to be reprepared. See: http://stackoverflow.com/questions/28777840/cassandra-nodejs-datastax-driver-dont-return-newly-added-columns-via-prepared-s/28778097#28778097 – Andy Tolbert Mar 10 '15 at 18:16
  • Hey, uh, Mr. Tolbert? Ever been kissed by a guy? – mtyson Mar 10 '15 at 20:19
  • @AndyTolbert: Seriously, that was an amazing suggestion, and that was it. Thank you VERY much. Please suggest as an answer so I can mark it! – mtyson Mar 10 '15 at 20:20
  • mtyson, happy to help! Added an answer. – Andy Tolbert Mar 10 '15 at 20:24

1 Answers1

2

If you are using 'select *' as a PreparedStatement you will need to reprepare your statement if your schema changes (columns added or removed). Cassandra doesn't update it's prepared statement cache on schema change until 2.1.3, so this will not work on previous versions.

See: Cassandra nodejs DataStax driver don't return newly added columns via prepared statement execution

Community
  • 1
  • 1
Andy Tolbert
  • 11,418
  • 1
  • 30
  • 45