Uploaded image for project: 'Cassandra'
  1. Cassandra
  2. CASSANDRA-17117

CQLSSTableWriter backwards compatibility fix for Date fields

    XMLWordPrintableJSON

Details

    • Code
    • Low
    • Normal
    • User Report
    • All
    • None
    • Hide

      Patches for 4.0 and trunk are attached - added an additional unit test to cover the backward-compatible and current cases to make sure both are still supported.

      Show
      Patches for 4.0 and trunk are attached - added an additional unit test to cover the backward-compatible and current cases to make sure both are still supported.

    Description

      cassandra-all library consumers of the CQLSSTableWriter class cannot easily create an appropriate instance of the LocalDate class in order to write SSTables including dates, and the current implementation no longer accepts a int value as a valid input as previous versions of the class would - we used to use ((AbstractType)columnSpecification.type).decompose(value); in order to serialize the value, but now we use the type codec's .serialize method. Unfortunately, this doesn't work when the consumer can't easily create the type needed (serialize, in the case of dates, takes a LocalDate instance which is not easy to construct outside of Cassandra internal code).

      This can be worked around by catching the resulting ClassCastException thrown from the serialize call and falling back to the older decompose implementation, which would maintain backwards-compatibility with other users of the CQLSSTableWriter in cases where they are passing integers for date fields, which used to work.

      Attachments

        1. CASSANDRA-17117-trunk.patch
          21 kB
          Doug Rohrer
        2. CASSANDRA-17117-4.0.patch
          21 kB
          Doug Rohrer

        Activity

          People

            drohrer Doug Rohrer
            drohrer Doug Rohrer
            Doug Rohrer
            Brandon Williams, Sam Tunnicliffe
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: