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

fqltool dump results NPE when null value inserted using prepared query

    XMLWordPrintableJSON

Details

    Description

      Enable fullquerylog, prepare insert statement and bind it with a null value and execute it. Executing fqltool dump after insert will result into NullPointerException.
       
      Stept to reproduce:
          * Create cluster using ccm
          * Create  a table something like:

          CREATE TABLE ks1.t2 (
              id int PRIMARY KEY,
              value text
          ) ;
       

          * Execute below code

          try (CqlSession cqlSession = CqlSession.builder().build()) {
              PreparedStatement preparedStatement = cqlSession.prepare("INSERT INTO ks1.t2 (id, value) VALUES (?, ?)");
              cqlSession.execute(preparedStatement.bind(6, null));
          }
      

          * Now running fqltool dump. It will run into NPE
       
       
      Stack trace:

      error: null
      -- StackTrace --
      java.lang.NullPointerException
          at net.openhft.chronicle.bytes.BytesStore.wrap(BytesStore.java:76)
          at net.openhft.chronicle.bytes.Bytes.wrapForRead(Bytes.java:179)
          at org.apache.cassandra.fqltool.commands.Dump.appendValuesToStringBuilder(Dump.java:222)
          at org.apache.cassandra.fqltool.commands.Dump.dumpQuery(Dump.java:179)
          at org.apache.cassandra.fqltool.commands.Dump.lambda$dump$0(Dump.java:123)
          at net.openhft.chronicle.queue.impl.single.StoreTailer.readDocument(StoreTailer.java:111)
          at org.apache.cassandra.fqltool.commands.Dump.dump(Dump.java:148)
          at org.apache.cassandra.fqltool.commands.Dump.run(Dump.java:68)
          at org.apache.cassandra.fqltool.FullQueryLogTool.main(FullQueryLogTool.java:65)
      

      Attachments

        Activity

          People

            n.v.harikrishna n.v.harikrishna
            n.v.harikrishna n.v.harikrishna
            n.v.harikrishna
            Stefan Miklosovic
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 1.5h
                1.5h