use of com.facebook.presto.spi.ColumnIdentity 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));
}
Aggregations