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

Using IOUtils methods instead of duplicate code lines

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Trivial
    • Resolution: Fixed
    • 0.6.1
    • 0.7
    • gora-accumulo, gora-core
    • None

    Description

      You can use

       
      final SpecificDatumWriter<Object> writer = new SpecificDatumWriter<>(field.schema());
                final byte[] byteData = IOUtils.serialize(writer,o);
                m.put(col.getFirst(), col.getSecond(), new Value(byteData));
                count++;
                break;
      

      instead of

      AccumuloStore.java
      case RECORD:
                SpecificDatumWriter<Object> writer = new SpecificDatumWriter<>(field.schema());
                ByteArrayOutputStream os = new ByteArrayOutputStream();
                org.apache.avro.io.BinaryEncoder encoder = EncoderFactory.get().binaryEncoder(os, null);
                writer.write(o, encoder);
                encoder.flush();
                m.put(col.getFirst(), col.getSecond(), new Value(os.toByteArray()));
                count++;
                break;
      

      The code lines have already been in org.apache.gora.util.IOUtils

      Attachments

        Issue Links

          Activity

            People

              cguzel Cihad Guzel
              cguzel Cihad Guzel
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: