Uploaded image for project: 'Apache Gora'
  1. Apache Gora
  2. GORA-204

Don't store empty arrays in CassandraClient#addGenericArray(), addStatefulHashMap() and CassandraStore#addOrUpdateField()

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 0.2.1
    • 0.4
    • avro, gora-cassandra
    • None

    Description

      We have three TODO's in this issue.
      Namely

              // TODO: hack, do not store empty arrays
              if (itemValue instanceof GenericArray<?>) {
                if (((GenericArray)itemValue).size() == 0) {
                  continue;
                }
              } else if (itemValue instanceof StatefulHashMap<?,?>) {
                if (((StatefulHashMap)itemValue).size() == 0) {
                  continue;
                }
              }
      
              // TODO: hack, do not store empty arrays
              Object mapValue = map.get(mapKey);
              if (mapValue instanceof GenericArray<?>) {
                if (((GenericArray)mapValue).size() == 0) {
                  continue;
                }
              } else if (mapValue instanceof StatefulHashMap<?,?>) {
                if (((StatefulHashMap)mapValue).size() == 0) {
                  continue;
                }
              }
      

      and

            case RECORD:
              if (value != null) {
                if (value instanceof PersistentBase) {
                  PersistentBase persistentBase = (PersistentBase) value;
                  for (Field member: schema.getFields()) {
                    
                    // TODO: hack, do not store empty arrays
                    Object memberValue = persistentBase.get(member.pos());
                    if (memberValue instanceof GenericArray<?>) {
                      if (((GenericArray)memberValue).size() == 0) {
                        continue;
                      }
                    } else if (memberValue instanceof StatefulHashMap<?,?>) {
                      if (((StatefulHashMap)memberValue).size() == 0) {
                        continue;
                      }
                    }
      
                    this.cassandraClient.addSubColumn(key, field.name(), member.name(), memberValue);
                  }
                } else {
                  LOG.info("Record not supported: " + value.toString());
                  
                }
              }
              break;
      

      in addGenericArray and addStateulHashMap in CassandraClient and CassandraStore#addOrUpdateField respectively.

      Attachments

        Activity

          People

            renato2099 Renato Javier MarroquĂ­n Mogrovejo
            lewismc Lewis John McGibbney
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: