Search in sources :

Example 1 with RaptorTableIdentity

use of com.facebook.presto.raptor.RaptorTableIdentity 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)

Aggregations

RaptorTableIdentity (com.facebook.presto.raptor.RaptorTableIdentity)1 ConnectorTableHandle (com.facebook.presto.spi.ConnectorTableHandle)1 TableIdentity (com.facebook.presto.spi.TableIdentity)1 ByteArrayDataOutput (com.google.common.io.ByteArrayDataOutput)1 Test (org.testng.annotations.Test)1