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

NPE in CqlRecordWriter: Related to AbstractCassandraStorage handling null values

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Normal
    • Resolution: Fixed
    • 1.2.12, 2.0.3
    • None
    • None
    • Pig, CqlStorage

    • Normal

    Description

      I encountered an issue with the CqlStorage and it's handling of null values. The CqlRecordWriter throws an NPE when a value is null. I found a related ticket CASSANDRA-5885 and applied the there stated fix to the AbstractCassandraStorage.
      Instead of converting null values to ByteBuffer.wrap(new byte[0]) AbstractCassandraStorage returns (ByteBuffer)null

      This issue can be reproduced with the attached files: test_null.cql, test_null_data, null_test.pig

      A fix can be found in the attached patch.

      java.io.IOException: java.lang.NullPointerException
      	at org.apache.cassandra.hadoop.cql3.CqlRecordWriter$RangeClient.run(CqlRecordWriter.java:248)
      Caused by: java.lang.NullPointerException
      	at org.apache.thrift.protocol.TBinaryProtocol.writeBinary(TBinaryProtocol.java:194)
      	at org.apache.cassandra.thrift.Cassandra$execute_prepared_cql3_query_args.write(Cassandra.java:41253)
      	at org.apache.thrift.TServiceClient.sendBase(TServiceClient.java:63)
      	at org.apache.cassandra.thrift.Cassandra$Client.send_execute_prepared_cql3_query(Cassandra.java:1683)
      	at org.apache.cassandra.thrift.Cassandra$Client.execute_prepared_cql3_query(Cassandra.java:1673)
      	at org.apache.cassandra.hadoop.cql3.CqlRecordWriter$RangeClient.run(CqlRecordWriter.java:232)
      

      Attachments

        1. 6180-v2-1.2-branch.txt
          2 kB
          Alex Liu
        2. null_test.pig
          0.5 kB
          Henning Kropp
        3. patch.txt
          0.7 kB
          Henning Kropp
        4. test_null_data
          0.1 kB
          Henning Kropp
        5. test_null.cql
          0.3 kB
          Henning Kropp

        Activity

          People

            alexliu68 Alex Liu
            hkropp Henning Kropp
            Alex Liu
            Brandon Williams
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: