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

Can't dump a compact table with 'null' in a clustering column using sstabledump

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Normal
    • Resolution: Unresolved
    • Fix Version/s: None
    • Component/s: Legacy/Tools
    • Labels:
      None
    • Severity:
      Normal

      Description

      The following compact table is perfectly valid because of backward compatibility:

       cqlsh:test> CREATE TABLE cf (pk int, ck1 int, ck2 int, rc int, primary key (pk, ck1, ck2)) WITH COMPACT STORAGE;
      cqlsh:test> INSERT INTO cf (pk, ck1, rc) VALUES (1, 1, 1);
      cqlsh:test> SELECT * FROM cf;

      pk | ck1 | ck2 | rc
      ----------+---
      1 | 1 | null | 1

      (1 rows)

      But sstabledump fails to output it:

      osboxes@osboxes:/tmp$ sstabledump -t /var/lib/cassandra/data/test/cf-f12ca9e0650811e8bd2e599ed57bc695/mc-1-big-Data.db
      [
      {
      "partition" :

      { "key" : [ "1" ], "position" : 0 }

      ,
      "rows" : [

      { "type" : "row", "position" : 32, "clustering" : [ 1 ] }

      ] } ]Exception in thread "main" java.lang.NullPointerException
      at org.apache.cassandra.serializers.Int32Serializer.deserialize(Int32Serializer.java:31)
      at org.apache.cassandra.serializers.Int32Serializer.deserialize(Int32Serializer.java:25)
      at org.apache.cassandra.db.marshal.Int32Type.toJSONString(Int32Type.java:101)
      at org.apache.cassandra.tools.JsonTransformer.serializeClustering(JsonTransformer.java:347)
      at org.apache.cassandra.tools.JsonTransformer.serializeRow(JsonTransformer.java:244)
      at org.apache.cassandra.tools.JsonTransformer.serializePartition(JsonTransformer.java:211)
      at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184)
      at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
      at java.util.Iterator.forEachRemaining(Iterator.java:116)
      at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
      at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
      at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
      at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
      at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
      at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
      at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418)
      at org.apache.cassandra.tools.JsonTransformer.toJson(JsonTransformer.java:101)
      at org.apache.cassandra.tools.SSTableExport.main(SSTableExport.java:240)

      The problem seems to be that JsonTransformer doesn't expect 'null' values for a clustering key of a row.
       

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              argenet Vladimir Krivopalov
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: