Search in sources :

Example 1 with RaptorSplit

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);
}
Also used : ConnectorTableLayoutResult(com.facebook.presto.spi.ConnectorTableLayoutResult) RaptorSplit(com.facebook.presto.raptor.RaptorSplit) ConnectorSplitSource(com.facebook.presto.spi.ConnectorSplitSource) ConnectorSplit(com.facebook.presto.spi.ConnectorSplit) Constraint(com.facebook.presto.spi.Constraint) Test(org.testng.annotations.Test)

Example 2 with RaptorSplit

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());
}
Also used : ConnectorTableLayoutResult(com.facebook.presto.spi.ConnectorTableLayoutResult) RaptorSplit(com.facebook.presto.raptor.RaptorSplit) TestingNodeManager(com.facebook.presto.testing.TestingNodeManager) InternalNode(com.facebook.presto.metadata.InternalNode) ConnectorSplitSource(com.facebook.presto.spi.ConnectorSplitSource) RaptorConnectorId(com.facebook.presto.raptor.RaptorConnectorId) URI(java.net.URI) ConnectorSplit(com.facebook.presto.spi.ConnectorSplit) NodeSupplier(com.facebook.presto.raptor.NodeSupplier) RaptorSplitManager(com.facebook.presto.raptor.RaptorSplitManager) Test(org.testng.annotations.Test)

Aggregations

RaptorSplit (com.facebook.presto.raptor.RaptorSplit)2 ConnectorSplit (com.facebook.presto.spi.ConnectorSplit)2 ConnectorSplitSource (com.facebook.presto.spi.ConnectorSplitSource)2 ConnectorTableLayoutResult (com.facebook.presto.spi.ConnectorTableLayoutResult)2 Test (org.testng.annotations.Test)2 InternalNode (com.facebook.presto.metadata.InternalNode)1 NodeSupplier (com.facebook.presto.raptor.NodeSupplier)1 RaptorConnectorId (com.facebook.presto.raptor.RaptorConnectorId)1 RaptorSplitManager (com.facebook.presto.raptor.RaptorSplitManager)1 Constraint (com.facebook.presto.spi.Constraint)1 TestingNodeManager (com.facebook.presto.testing.TestingNodeManager)1 URI (java.net.URI)1