Search in sources :

Example 16 with ByteArrayDataOutput

use of com.google.common.io.ByteArrayDataOutput in project hive by apache.

the class LlapTaskSchedulerService method serializeToken.

private static String serializeToken(Token<JobTokenIdentifier> token) {
    byte[] bytes = null;
    try {
        ByteArrayDataOutput out = ByteStreams.newDataOutput();
        token.write(out);
        bytes = out.toByteArray();
    } catch (IOException e) {
        // This shouldn't really happen on a byte array.
        throw new RuntimeException(e);
    }
    return Base64.encodeBase64String(bytes);
}
Also used : ByteArrayDataOutput(com.google.common.io.ByteArrayDataOutput) IOException(java.io.IOException)

Example 17 with ByteArrayDataOutput

use of com.google.common.io.ByteArrayDataOutput in project cdap by caskdata.

the class StreamConsumerStateStore method encodeOffsets.

/**
   * Encodes list of {@link StreamFileOffset} into bytes.
   */
private byte[] encodeOffsets(Iterable<StreamFileOffset> offsets) throws IOException {
    // Assumption: Each offset encoded into ~40 bytes and there are 8 offsets (number of live files)
    ByteArrayDataOutput output = ByteStreams.newDataOutput(320);
    encodeOffsets(offsets, output);
    return output.toByteArray();
}
Also used : ByteArrayDataOutput(com.google.common.io.ByteArrayDataOutput)

Example 18 with ByteArrayDataOutput

use of com.google.common.io.ByteArrayDataOutput in project cdap by caskdata.

the class DequeueScanAttributes method toBytes.

private static byte[] toBytes(Transaction tx) throws IOException {
    ByteArrayDataOutput dataOutput = ByteStreams.newDataOutput();
    write(dataOutput, tx);
    return dataOutput.toByteArray();
}
Also used : ByteArrayDataOutput(com.google.common.io.ByteArrayDataOutput)

Example 19 with ByteArrayDataOutput

use of com.google.common.io.ByteArrayDataOutput in project cdap by caskdata.

the class DequeueScanAttributes method toBytes.

private static byte[] toBytes(ConsumerConfig consumerConfig) throws IOException {
    ByteArrayDataOutput dataOutput = ByteStreams.newDataOutput();
    write(dataOutput, consumerConfig);
    return dataOutput.toByteArray();
}
Also used : ByteArrayDataOutput(com.google.common.io.ByteArrayDataOutput)

Example 20 with ByteArrayDataOutput

use of com.google.common.io.ByteArrayDataOutput in project hbase by apache.

the class Mutation method setClusterIds.

/**
   * Marks that the clusters with the given clusterIds have consumed the mutation
   * @param clusterIds of the clusters that have consumed the mutation
   */
public Mutation setClusterIds(List<UUID> clusterIds) {
    ByteArrayDataOutput out = ByteStreams.newDataOutput();
    out.writeInt(clusterIds.size());
    for (UUID clusterId : clusterIds) {
        out.writeLong(clusterId.getMostSignificantBits());
        out.writeLong(clusterId.getLeastSignificantBits());
    }
    setAttribute(CONSUMED_CLUSTER_IDS, out.toByteArray());
    return this;
}
Also used : ByteArrayDataOutput(com.google.common.io.ByteArrayDataOutput) UUID(java.util.UUID)

Aggregations

ByteArrayDataOutput (com.google.common.io.ByteArrayDataOutput)39 IOException (java.io.IOException)3 ConnectorTableHandle (com.facebook.presto.spi.ConnectorTableHandle)2 Test (org.testng.annotations.Test)2 Split (co.cask.cdap.api.data.batch.Split)1 RaptorColumnHandle (com.facebook.presto.raptor.RaptorColumnHandle)1 RaptorColumnIdentity (com.facebook.presto.raptor.RaptorColumnIdentity)1 RaptorTableIdentity (com.facebook.presto.raptor.RaptorTableIdentity)1 ColumnHandle (com.facebook.presto.spi.ColumnHandle)1 ColumnIdentity (com.facebook.presto.spi.ColumnIdentity)1 TableIdentity (com.facebook.presto.spi.TableIdentity)1 JsonValue (com.fasterxml.jackson.annotation.JsonValue)1 Supplier (com.google.common.base.Supplier)1 ByteString (com.google.protobuf.ByteString)1 ServiceException (com.google.protobuf.ServiceException)1 InputRow (io.druid.data.input.InputRow)1 MapBasedInputRow (io.druid.data.input.MapBasedInputRow)1 ParseException (io.druid.java.util.common.parsers.ParseException)1 Aggregator (io.druid.query.aggregation.Aggregator)1 AggregatorFactory (io.druid.query.aggregation.AggregatorFactory)1