Search in sources :

Example 11 with ByteArrayDataOutput

use of com.google.common.io.ByteArrayDataOutput in project presto by prestodb.

the class TestRaptorMetadata method testColumnIdentity.

@Test
public void testColumnIdentity() throws Exception {
    // Test ColumnIdentity round trip.
    metadata.createTable(SESSION, getOrdersTable());
    ConnectorTableHandle connectorTableHandle = metadata.getTableHandle(SESSION, DEFAULT_TEST_ORDERS);
    Map<String, ColumnHandle> columnHandles = metadata.getColumnHandles(SESSION, connectorTableHandle);
    ColumnIdentity orderKeyColumnIdentity = metadata.getColumnIdentity(columnHandles.get("orderkey"));
    byte[] bytes = orderKeyColumnIdentity.serialize();
    assertEquals(orderKeyColumnIdentity, metadata.deserializeColumnIdentity(bytes));
    // Test one hard coded serialized data for each version.
    byte version = 1;
    long columnId = 123456789012L;
    ByteArrayDataOutput dataOutput = newDataOutput();
    dataOutput.writeByte(version);
    dataOutput.writeLong(columnId);
    byte[] testBytes = dataOutput.toByteArray();
    ColumnIdentity testColumnIdentity = metadata.deserializeColumnIdentity(testBytes);
    assertEquals(testColumnIdentity, new RaptorColumnIdentity(columnId));
}
Also used : RaptorColumnHandle(com.facebook.presto.raptor.RaptorColumnHandle) ColumnHandle(com.facebook.presto.spi.ColumnHandle) RaptorColumnIdentity(com.facebook.presto.raptor.RaptorColumnIdentity) RaptorColumnIdentity(com.facebook.presto.raptor.RaptorColumnIdentity) ColumnIdentity(com.facebook.presto.spi.ColumnIdentity) ByteArrayDataOutput(com.google.common.io.ByteArrayDataOutput) ConnectorTableHandle(com.facebook.presto.spi.ConnectorTableHandle) Test(org.testng.annotations.Test)

Example 12 with ByteArrayDataOutput

use of com.google.common.io.ByteArrayDataOutput in project presto by prestodb.

the class TestRaptorMetadata method testTableIdentity.

@Test
public void testTableIdentity() throws Exception {
    // Test TableIdentity round trip.
    metadata.createTable(SESSION, getOrdersTable());
    ConnectorTableHandle connectorTableHandle = metadata.getTableHandle(SESSION, DEFAULT_TEST_ORDERS);
    TableIdentity tableIdentity = metadata.getTableIdentity(connectorTableHandle);
    byte[] bytes = tableIdentity.serialize();
    assertEquals(tableIdentity, metadata.deserializeTableIdentity(bytes));
    // Test one hard coded serialized data for each version.
    byte version = 1;
    long tableId = 12345678L;
    ByteArrayDataOutput dataOutput = newDataOutput();
    dataOutput.writeByte(version);
    dataOutput.writeLong(tableId);
    byte[] testBytes = dataOutput.toByteArray();
    TableIdentity testTableIdentity = metadata.deserializeTableIdentity(testBytes);
    assertEquals(testTableIdentity, new RaptorTableIdentity(tableId));
}
Also used : RaptorTableIdentity(com.facebook.presto.raptor.RaptorTableIdentity) TableIdentity(com.facebook.presto.spi.TableIdentity) RaptorTableIdentity(com.facebook.presto.raptor.RaptorTableIdentity) ByteArrayDataOutput(com.google.common.io.ByteArrayDataOutput) ConnectorTableHandle(com.facebook.presto.spi.ConnectorTableHandle) Test(org.testng.annotations.Test)

Example 13 with ByteArrayDataOutput

use of com.google.common.io.ByteArrayDataOutput in project EventHub by Codecademy.

the class JournalUtil method locationToBytes.

public static byte[] locationToBytes(Location location) throws IOException {
    ByteArrayDataOutput dos = ByteStreams.newDataOutput();
    location.writeExternal(dos);
    return dos.toByteArray();
}
Also used : ByteArrayDataOutput(com.google.common.io.ByteArrayDataOutput)

Example 14 with ByteArrayDataOutput

use of com.google.common.io.ByteArrayDataOutput in project oxAuth by GluuFederation.

the class RawAuthenticationService method packBytesToSign.

private byte[] packBytesToSign(byte[] appIdHash, byte userPresence, long counter, byte[] challengeHash) {
    ByteArrayDataOutput encoded = ByteStreams.newDataOutput();
    encoded.write(appIdHash);
    encoded.write(userPresence);
    encoded.writeInt((int) counter);
    encoded.write(challengeHash);
    return encoded.toByteArray();
}
Also used : ByteArrayDataOutput(com.google.common.io.ByteArrayDataOutput)

Example 15 with ByteArrayDataOutput

use of com.google.common.io.ByteArrayDataOutput in project oxAuth by GluuFederation.

the class RawRegistrationService method packBytesToSign.

private byte[] packBytesToSign(byte[] appIdHash, byte[] clientDataHash, byte[] keyHandle, byte[] userPublicKey) {
    ByteArrayDataOutput encoded = ByteStreams.newDataOutput();
    encoded.write(REGISTRATION_SIGNED_RESERVED_BYTE_VALUE);
    encoded.write(appIdHash);
    encoded.write(clientDataHash);
    encoded.write(keyHandle);
    encoded.write(userPublicKey);
    return encoded.toByteArray();
}
Also used : ByteArrayDataOutput(com.google.common.io.ByteArrayDataOutput)

Aggregations

ByteArrayDataOutput (com.google.common.io.ByteArrayDataOutput)20 ConnectorTableHandle (com.facebook.presto.spi.ConnectorTableHandle)2 IOException (java.io.IOException)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