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

json2sstable breaks on data exported from sstable2json.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Low
    • Resolution: Fixed
    • 1.2.10, 2.0.1
    • Legacy/Tools
    • None
    • Low

    Description

      Attached is a JSON formatted sstable generated by sstable2json.

      This file cannot be loaded back into Cassandra via json2sstable; it outputs this error:

      Counting keys to import, please wait... (NOTE: to skip this use -n <num_keys>)
      Importing 16 keys...
      java.lang.NumberFormatException: Non-hex characters in value6
      	at org.apache.cassandra.utils.Hex.hexToBytes(Hex.java:60)
      	at org.apache.cassandra.utils.ByteBufferUtil.hexToBytes(ByteBufferUtil.java:503)
      	at org.apache.cassandra.tools.SSTableImport.stringAsType(SSTableImport.java:578)
      	at org.apache.cassandra.tools.SSTableImport.access$000(SSTableImport.java:59)
      	at org.apache.cassandra.tools.SSTableImport$JsonColumn.<init>(SSTableImport.java:154)
      	at org.apache.cassandra.tools.SSTableImport.addColumnsToCF(SSTableImport.java:231)
      	at org.apache.cassandra.tools.SSTableImport.addToStandardCF(SSTableImport.java:214)
      	at org.apache.cassandra.tools.SSTableImport.importSorted(SSTableImport.java:432)
      	at org.apache.cassandra.tools.SSTableImport.importJson(SSTableImport.java:319)
      	at org.apache.cassandra.tools.SSTableImport.main(SSTableImport.java:543)
      ERROR: Non-hex characters in value6
      

      Steps to reproduce:

      $ ccm create -v git:trunk test-json-import
      Fetching Cassandra updates...
      Current cluster is now: test-json-import
      $ ccm populate -n 1
      $ ccm start
      $ ccm node1 cqlsh
      Connected to test-json-import at 127.0.0.1:9160.
      [cqlsh 4.0.0 | Cassandra 2.0.0-rc1-SNAPSHOT | CQL spec 3.1.0 | Thrift protocol 19.37.0]
      Use HELP for help.
      cqlsh> CREATE KEYSPACE test WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1};
      cqlsh> CREATE TABLE test.test (key varchar PRIMARY KEY, value varchar);
      cqlsh> INSERT INTO test.test (key, value) VALUES ('ryan', 'ryan');
      cqlsh> 
      $ ccm node1 flush
      $ ccm stop
      $ ~/.ccm/test-json-import/node1/bin/json2sstable -s -K test -c test ~/Downloads/import_error/r.json ~/.ccm/test-json-import/node1/data/test/test/test-test-ja-1-Data.db 
      

      Attachments

        1. 5852_cassandra-1.2_v2.patch
          3 kB
          Lyuben Todorov
        2. 5852_cassandra-1.2_v3.patch
          3 kB
          Lyuben Todorov
        3. 5852_cassandra-1.2.patch
          2 kB
          Lyuben Todorov
        4. 5852_cassandra-2.0_v2.patch
          3 kB
          Lyuben Todorov
        5. 5852_cassandra-2.0.patch
          2 kB
          Lyuben Todorov
        6. r.json
          2 kB
          Ryan McGuire

        Issue Links

          Activity

            People

              lyubent Lyuben Todorov
              enigmacurry Ryan McGuire
              Lyuben Todorov
              Sylvain Lebresne
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: