Bringing together the Apache Cassandra experts from the community and DataStax.

Want to learn? Have a question? Want to share your expertise? You are in the right place!

Not sure where to begin? Getting Started

 

question

kallmekunal_131749 avatar image
kallmekunal_131749 asked Gittx commented

Upgraded Java driver from 3.5 to 4.9, getting "InvalidQueryException: Invalid unset value for column"

I am facing issue with upgrade from DSE driver 3.5 to driver 4.9. There is a column family with a field hour as timestamp data. We upgraded from 3.5 to 4.9 dse driver.

There was a migration job which was using below query in 3.5:

private BuiltStatement buildGetByHoursStatement() {
  return QueryBuilder.select(fields)
    .from(keyspaceName, TABLE_NAME)
    .where(QueryBuilder.in(HOUR_COLUMN, QueryBuilder.bindMarker()));
}

**Now in 4.9 this query is remodeled like below:**

private SimpleStatement buildGetByHoursStatement() {
  return QueryBuilder.selectFrom(historyKeyspaceName, TABLE_NAME).columns(fields)
    .whereColumn(HOUR_COLUMN).in(QueryBuilder.bindMarker()).build();
}

but while execution its getting exception as below:

org.apache.openejb.core.transaction.EjbTransactionUtil.handleSystemException EjbTransactionUtil.handleSystemException: Invalid unset value for column hour
com.datastax.oss.driver.api.core.servererrors.InvalidQueryException: Invalid unset value for column hour
    at com.datastax.oss.driver.api.core.servererrors.InvalidQueryException.copy(InvalidQueryException.java:48)
    at com.datastax.oss.driver.internal.core.util.concurrent.CompletableFutures.getUninterruptibly(CompletableFutures.java:149)
    at com.datastax.oss.driver.internal.core.cql.CqlRequestSyncProcessor.process(CqlRequestSyncProcessor.java:53)
    at com.datastax.oss.driver.internal.core.cql.CqlRequestSyncProcessor.process(CqlRequestSyncProcessor.java:30)
    at com.datastax.oss.driver.internal.core.session.DefaultSession.execute(DefaultSession.java:230)
    at com.datastax.oss.driver.api.core.cql.SyncCqlSession.execute(SyncCqlSession.java:54)

above trace is using the remodeled query in 4.9 as shown above.

Please help and give us a clue.

java driver
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 Gittx commented

The InvalidQueryException stems from the query being invalid so this is thrown by the driver:

com.datastax.oss.driver.api.core.servererrors.InvalidQueryException: Invalid unset value for column hour

As the message clearly states, the hour column is not set. It isn't possible to filter on a null or empty column.

My suggestion is that you review your data and fix invalid entries. Cheers!

3 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.

errorcassa5.pngerrorcassa4.pngSame error - InvalidQueryException though the column is has no nulls!

[Post converted to comment since it's not an "answer"]

0 Likes 0 ·
errorcassa4.png (75.5 KiB)
errorcassa5.png (5.0 KiB)

The query is invalid since you can't have a filter with a NULL value. Cheers!

0 Likes 0 ·

I did. Used this filter and it worked. Hope it helps someone too.

df = df.filter(functions.col("NR_SBSC").isNotNull());

0 Likes 0 ·