Uploaded image for project: 'Kite SDK'
  1. Kite SDK
  2. KITE-292

NPE when writing an entity to HBase with an incompatible schema

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 0.10.1
    • Fix Version/s: 0.13.0
    • Component/s: HBase Module
    • Labels:
      None

      Description

      Ben Roling reported this on the cdk-dev list.

      First, I tried to write the data without doing a DatasetRepository.update() to give the dataset the new schema. I didn't know if I would be allowed to write data with a newer schema that is still compatible to be read by the dataset's defined schema.

      I added favoriteFood in user.avsc:

          {
            "name": "age",
            "type": "int",
            "default": 0,
            "mapping": { "type": "column", "value": "meta:age" }
          },
          {
            "name": "favoriteFood",
            "type": ["string", "null"],
            "default": "null",
            "mapping": { "type": "column", "value": "meta:favoriteFood" }
          }
      

      When I attempted to put an instance of this new User model, it failed with a NullPointerException:

      Exception in thread "main" java.lang.NullPointerException
      	at org.kitesdk.data.hbase.avro.VersionedAvroEntityMapper.mapFromEntity(VersionedAvroEntityMapper.java:239)
      	at org.kitesdk.data.hbase.avro.VersionedAvroEntityMapper.mapFromEntity(VersionedAvroEntityMapper.java:58)
      	at org.kitesdk.data.hbase.impl.HBaseClientTemplate.put(HBaseClientTemplate.java:447)
      	at org.kitesdk.data.hbase.impl.HBaseClientTemplate.put(HBaseClientTemplate.java:421)
      	at org.kitesdk.data.hbase.impl.BaseDao.put(BaseDao.java:75)
      	at org.kitesdk.data.hbase.DaoDataset.put(DaoDataset.java:140)
      	at org.kitesdk.examples.data.WriteUserDataset.run(WriteUserDataset.java:58)
      	at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)
      	at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:84)
      	at org.kitesdk.examples.data.WriteUserDataset.main(WriteUserDataset.java:70)
      

      I'm not sure whether you would expect writing data that doesn't exactly match the schema of the dataset to be allowed, but even if not it seems an NPE is a bug?

        Attachments

          Activity

            People

            • Assignee:
              blue Ryan Blue
              Reporter:
              tom Tom White
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: