Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing static values #894

Open
woupiestek opened this issue Apr 5, 2019 · 3 comments
Open

Missing static values #894

woupiestek opened this issue Apr 5, 2019 · 3 comments

Comments

@woupiestek
Copy link

woupiestek commented Apr 5, 2019

We want to use Cassandra to cache Exchange calendars, so they are available when Exchange is not. The following cql defines a table for storing the results of an availability request. The static last_update column keeps track of the last time our application wrote to the partition, if any.

CREATE TABLE IF NOT EXISTS slots_by_account_and_day
(
    account     text,
    day         text,
    ews_id      text,
    start_time  timestamp,
    end_time    timestamp,
    status      text,
    last_update timestamp STATIC,
    PRIMARY KEY ((account, day), ews_id)
)

After filling the table with testdata, I noticed that PhantomDSL gives me None when I expected Some, using the following code:

table
  .select(_.last_update)
  .where(_.account eqs account)
  .and(_.day eqs day)
  .one

Meanwhile, the following Datastax based solution does give me what I expect using the following code:

session
  .execute(QueryBuilder.select("last_update")
    .from(table.tableName)
    .where(QueryBuilder.eq("account", account))
    .and(QueryBuilder.eq("day", day)))
  .one()
  .getTimestamp("last_update")

This looks like a bug. I assume it is related to the way PhantomDSL handles static columns, because this is the first time I have tried to use this feature of Cassandra.

@alexflav23
Copy link
Member

Hi @woupiestek We'll take a look as soon as possible, thank you for the bug report!

@alexflav23
Copy link
Member

alexflav23 commented Apr 10, 2019

Hi @woupiestek What does your phantom table look like? I don't think this is due to static handling, I think this might be a parse error in the datatype that decodes your timestamp. But I want to be sure, so if you could paste that here that would be helpful.

@woupiestek
Copy link
Author

@alexflav23 last_update is a DateTimeColumn, like the other timestamp columns start_time and end_time.

object account extends StringColumn with PartitionKey

  object day extends StringColumn with PartitionKey

  object ews_id extends StringColumn with PrimaryKey

  object start_time extends DateTimeColumn

  object end_time extends DateTimeColumn

  object status extends StringColumn

  /*
   * Added to track the last update for each partition
   */
  object last_update extends DateTimeColumn with StaticColumn

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants