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

fromJson(null) throws java.lang.NullPointerException on Cassandra

    XMLWordPrintableJSON

Details

    • Low

    Description

      Basically, fromJson throws a java.lang.NullPointerException when NULL is passed, instead of just returning a NULL itself. Say I create a UDT and a table as follows:

      create type type1
      (
      id int,
      name text
      );
      
      create table table1
      (
      id int,
      t FROZEN<type1>,
      
      primary key (id)
      );

      And then try and insert a row as such:

      insert into table1 (id, t) VALUES (1, fromJson(null));

      I get the error: java.lang.NullPointerException

      This works as expected: insert into table1 (id, t) VALUES (1, null);

      Programmatically, one does not always know when a UDT will be null, hence me expecting fromJson to just return NULL.

      Attachments

        1. CASSANDRA-13891.patch
          2 kB
          Edward Ribeiro

        Activity

          People

            eribeiro Edward Ribeiro
            marcel@lisemarie.com Marcel Villet
            Edward Ribeiro
            Jason Brown
            Votes:
            0 Vote for this issue
            Watchers:
            5 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 - 10m
                10m