Java Code Examples for org.apache.hadoop.io.WritableUtils#writeCompressedByteArray()

The following examples show how to use org.apache.hadoop.io.WritableUtils#writeCompressedByteArray() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Warp10InputSplit.java    From warp10-platform with Apache License 2.0 6 votes vote down vote up
@Override
public void write(DataOutput out) throws IOException {
  
  if (!this.complete) {
    throw new IOException("InputSplit is not completed.");      
  }

  WritableUtils.writeVInt(out,this.fetchers.length);
  
  for (int i = 0; i < this.fetchers.length; i++) {
    WritableUtils.writeString(out, this.fetchers[i]);
  }

  WritableUtils.writeVInt(out, this.splits.length);
  WritableUtils.writeCompressedByteArray(out, this.splits);
}
 
Example 2
Source File: ColumnProjectionFilter.java    From phoenix with Apache License 2.0 6 votes vote down vote up
@Override
public void write(DataOutput output) throws IOException {
    WritableUtils.writeCompressedByteArray(output, this.emptyCFName);
    WritableUtils.writeVInt(output, this.columnsTracker.size());
    for (Entry<ImmutableBytesPtr, NavigableSet<ImmutableBytesPtr>> entry : this.columnsTracker.entrySet()) {
        // write family name
        WritableUtils.writeCompressedByteArray(output, entry.getKey().copyBytes());
        int qaulsSize = entry.getValue() == null ? 0 : entry.getValue().size();
        WritableUtils.writeVInt(output, qaulsSize);
        if (qaulsSize > 0) {
            for (ImmutableBytesPtr cq : entry.getValue()) {
                // write qualifier name
                WritableUtils.writeCompressedByteArray(output, cq.copyBytes());
            }
        }
    }
    // Write conditionOnlyCfs
    WritableUtils.writeVInt(output, this.conditionOnlyCfs.size());
    for (byte[] f : this.conditionOnlyCfs) {
        WritableUtils.writeCompressedByteArray(output, f);
    }
}
 
Example 3
Source File: ColumnProjectionFilter.java    From phoenix with Apache License 2.0 6 votes vote down vote up
@Override
    public void write(DataOutput output) throws IOException {
        WritableUtils.writeCompressedByteArray(output, this.emptyCFName);
        WritableUtils.writeVInt(output, this.columnsTracker.size());
        for (Entry<ImmutableBytesPtr, NavigableSet<ImmutableBytesPtr>> entry : this.columnsTracker.entrySet()) {
            // write family name
            WritableUtils.writeCompressedByteArray(output, entry.getKey().copyBytes());
            int qaulsSize = entry.getValue() == null ? 0 : entry.getValue().size();
            WritableUtils.writeVInt(output, qaulsSize);
            if (qaulsSize > 0) {
                for (ImmutableBytesPtr cq : entry.getValue()) {
                    // write qualifier name
                    WritableUtils.writeCompressedByteArray(output, cq.copyBytes());
                }
            }
        }
        // Encode usesEncodedColumnNames in conditionOnlyCfs size.
        WritableUtils.writeVInt(output, (this.conditionOnlyCfs.size() + 1) * (usesEncodedColumnNames ? 1 : -1));
        for (byte[] f : this.conditionOnlyCfs) {
            WritableUtils.writeCompressedByteArray(output, f);
        }
    
}
 
Example 4
Source File: Cardinality.java    From datawave with Apache License 2.0 5 votes vote down vote up
@Override
public void write(DataOutput out, boolean reducedResponse) throws IOException {
    writeMetadata(out, reducedResponse);
    
    WritableUtils.writeString(out, content.lower);
    WritableUtils.writeString(out, content.upper);
    WritableUtils.writeCompressedByteArray(out, content.estimate.getBytes());
    
}
 
Example 5
Source File: EdgeValueWritable.java    From hgraphdb with Apache License 2.0 5 votes vote down vote up
@Override
public void write(final DataOutput output) throws IOException {
    Kryo kryo = new Kryo();
    kryo.register(HBaseEdge.class, new HBaseEdgeSerializer());
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    Output out = new Output(baos);
    kryo.writeObject(out, this.edge);
    out.close();
    final byte[] serialized = baos.toByteArray();
    WritableUtils.writeCompressedByteArray(output, serialized);
    Writable writable = value != null ? value : NullWritable.get();
    Text.writeString(output, writable.getClass().getName());
    writable.write(output);
}
 
Example 6
Source File: VertexValueWritable.java    From hgraphdb with Apache License 2.0 5 votes vote down vote up
@Override
public void write(final DataOutput output) throws IOException {
    Kryo kryo = new Kryo();
    kryo.register(HBaseVertex.class, new HBaseVertexSerializer());
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    Output out = new Output(baos);
    kryo.writeObject(out, this.vertex);
    out.close();
    final byte[] serialized = baos.toByteArray();
    WritableUtils.writeCompressedByteArray(output, serialized);
    Writable writable = value != null ? value : NullWritable.get();
    Text.writeString(output, writable.getClass().getName());
    writable.write(output);
}
 
Example 7
Source File: EncodedQualifiersColumnProjectionFilter.java    From phoenix with Apache License 2.0 5 votes vote down vote up
@Override
public void write(DataOutput output) throws IOException {
    WritableUtils.writeCompressedByteArray(output, this.emptyCFName);
    long[] longArrayOfBitSet = trackedColumns.toLongArray();
    WritableUtils.writeVInt(output, longArrayOfBitSet.length);
    for (Long l : longArrayOfBitSet) {
        WritableUtils.writeVLong(output, l);
    }
    WritableUtils.writeVInt(output, encodingScheme.ordinal());
    WritableUtils.writeVInt(output, this.conditionOnlyCfs.size());
    for (byte[] f : this.conditionOnlyCfs) {
        WritableUtils.writeCompressedByteArray(output, f);
    }
}
 
Example 8
Source File: TalosTopicMessageWritable.java    From galaxy-sdk-java with Apache License 2.0 5 votes vote down vote up
@Override
public void write(DataOutput dataOutput) throws IOException {
  if (!message.isSetSequenceNumber()) {
    message.setSequenceNumber("");
  }

  WritableUtils.writeCompressedString(dataOutput, message.getSequenceNumber());
  WritableUtils.writeCompressedByteArray(dataOutput, message.getMessage());
}
 
Example 9
Source File: Geometry.java    From datawave with Apache License 2.0 4 votes vote down vote up
@Override
public void write(DataOutput out, boolean reducedResponse) throws IOException {
    writeMetadata(out, reducedResponse);
    
    WritableUtils.writeCompressedByteArray(out, write());
}
 
Example 10
Source File: ObjectWritable.java    From hgraphdb with Apache License 2.0 4 votes vote down vote up
@Override
public void write(final DataOutput output) throws IOException {
    final byte[] serialized = ValueUtils.serialize(this.t);
    WritableUtils.writeCompressedByteArray(output, serialized);
}
 
Example 11
Source File: RowKeyComparisonFilter.java    From phoenix with Apache License 2.0 4 votes vote down vote up
@Override
public void write(DataOutput output) throws IOException {
    super.write(output);
    WritableUtils.writeCompressedByteArray(output, this.essentialCF);
}
 
Example 12
Source File: VertexWritable.java    From tinkerpop with Apache License 2.0 4 votes vote down vote up
@Override
public void write(final DataOutput output) throws IOException {
    final byte serialized[] = KryoShimServiceLoader.writeClassAndObjectToBytes(this.vertex.graph());
    WritableUtils.writeCompressedByteArray(output, serialized);
}
 
Example 13
Source File: ObjectWritable.java    From tinkerpop with Apache License 2.0 4 votes vote down vote up
@Override
public void write(final DataOutput output) throws IOException {
    final byte serialized[] = KryoShimServiceLoader.writeClassAndObjectToBytes(this.t);
    WritableUtils.writeCompressedByteArray(output, serialized);
}
 
Example 14
Source File: RowKeyComparisonFilter.java    From phoenix with Apache License 2.0 4 votes vote down vote up
@Override
public void write(DataOutput output) throws IOException {
    super.write(output);
    WritableUtils.writeCompressedByteArray(output, this.essentialCF);
}
 
Example 15
Source File: RowKeyComparisonFilter.java    From phoenix with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public void write(DataOutput output) throws IOException {
    super.write(output);
    WritableUtils.writeCompressedByteArray(output, this.essentialCF);
}