use of com.facebook.presto.raptor.RaptorSplit in project presto by prestodb.
the class TestRaptorSplitManager method testSanity.
@Test
public void testSanity() {
List<ConnectorTableLayoutResult> layouts = metadata.getTableLayouts(SESSION, tableHandle, Constraint.alwaysTrue(), Optional.empty());
assertEquals(layouts.size(), 1);
ConnectorTableLayoutResult layout = getOnlyElement(layouts);
assertInstanceOf(layout.getTableLayout().getHandle(), RaptorTableLayoutHandle.class);
ConnectorSplitSource splitSource = getSplits(raptorSplitManager, layout);
int splitCount = 0;
while (!splitSource.isFinished()) {
List<ConnectorSplit> splits = getSplits(splitSource, 1000);
splitCount += splits.size();
RaptorSplit split = (RaptorSplit) (splits.get(0));
assertFalse(split.isTableSupportsDeltaDelete());
assertEquals(split.getColumnTypes(), Optional.empty());
}
assertEquals(splitCount, 4);
}
use of com.facebook.presto.raptor.RaptorSplit in project presto by prestodb.
the class TestRaptorSplitManager method testAssignRandomNodeWhenBackupAvailable.
@Test
public void testAssignRandomNodeWhenBackupAvailable() throws URISyntaxException {
TestingNodeManager nodeManager = new TestingNodeManager();
RaptorConnectorId connectorId = new RaptorConnectorId("raptor");
NodeSupplier nodeSupplier = nodeManager::getWorkerNodes;
InternalNode node = new InternalNode(UUID.randomUUID().toString(), new URI("http://127.0.0.1/"), NodeVersion.UNKNOWN, false);
nodeManager.addNode(node);
RaptorSplitManager raptorSplitManagerWithBackup = new RaptorSplitManager(connectorId, nodeSupplier, shardManager, true);
deleteShardNodes();
ConnectorTableLayoutResult layout = getOnlyElement(metadata.getTableLayouts(SESSION, tableHandle, Constraint.alwaysTrue(), Optional.empty()));
ConnectorSplitSource partitionSplit = getSplits(raptorSplitManagerWithBackup, layout);
List<ConnectorSplit> batch = getSplits(partitionSplit, 1);
assertEquals(getOnlyElement(((RaptorSplit) getOnlyElement(batch)).getAddresses()), node.getHostAndPort());
}
Aggregations