Package com.facebook.presto.spi

Examples of com.facebook.presto.spi.TableHandle


    public void testDualDeserialize()
            throws Exception
    {
        String json = objectMapper.writeValueAsString(DUAL_AS_MAP);

        TableHandle tableHandle = objectMapper.readValue(json, TableHandle.class);
        assertEquals(tableHandle.getClass(), DualTableHandle.class);
        DualTableHandle dualHandle = (DualTableHandle) tableHandle;

        assertEquals(dualHandle.getSchemaName(), "dual_schema");
    }
View Full Code Here


    public void testInformationSchemaDeserialize()
            throws Exception
    {
        String json = objectMapper.writeValueAsString(INFORMATION_SCHEMA_AS_MAP);

        TableHandle tableHandle = objectMapper.readValue(json, TableHandle.class);
        assertEquals(tableHandle.getClass(), InformationSchemaTableHandle.class);
        InformationSchemaTableHandle informationSchemaHandle = (InformationSchemaTableHandle) tableHandle;

        assertEquals(informationSchemaHandle.getCatalogName(), "information_schema_catalog");
        assertEquals(informationSchemaHandle.getSchemaName(), "information_schema_schema");
        assertEquals(informationSchemaHandle.getTableName(), "information_schema_table");
View Full Code Here

    @Test
    public void testGetRecords()
            throws Exception
    {
        TableHandle tableHandle = getTableHandle(table);
        ConnectorTableMetadata tableMetadata = metadata.getTableMetadata(tableHandle);
        List<ColumnHandle> columnHandles = ImmutableList.copyOf(metadata.getColumnHandles(tableHandle).values());
        Map<String, Integer> columnIndex = indexColumns(columnHandles);

        PartitionResult partitionResult = splitManager.getPartitions(tableHandle, TupleDomain.all());
View Full Code Here

        }
    }

    private TableHandle getTableHandle(SchemaTableName tableName)
    {
        TableHandle handle = metadata.getTableHandle(tableName);
        checkArgument(handle != null, "table not found: %s", tableName);
        return handle;
    }
View Full Code Here

    {
        checkNotNull(table, "table is null");

        SchemaTableName tableName = table.asSchemaTableName();
        for (ConnectorMetadataEntry entry : allConnectorsFor(table.getCatalogName())) {
            TableHandle tableHandle = entry.getMetadata().getTableHandle(tableName);
            if (tableHandle != null) {
                return Optional.of(tableHandle);
            }
        }
        return Optional.absent();
View Full Code Here

                ImmutableMap.<PlanNodeId, OutputReceiver>of());
    }

    private StageExecutionPlan createTableScanPlan(String planId, MetadataManager metadata, int splitCount)
    {
        TableHandle tableHandle = metadata.getTableHandle(new QualifiedTableName("default", "default", DualMetadata.NAME)).get();
        ColumnHandle columnHandle = metadata.getColumnHandle(tableHandle, DualMetadata.COLUMN_NAME).get();
        Symbol symbol = new Symbol(DualMetadata.COLUMN_NAME);

        // table scan with 3 splits
        Split split = new DualSplit(HostAddress.fromString("127.0.0.1"));
View Full Code Here

    @Test
    public void testPartitionShardCommit()
            throws Exception
    {
        long tableId = 1;
        TableHandle tableHandle = new NativeTableHandle("demo", "test", tableId);
        long shardId1 = shardManager.allocateShard(tableHandle);
        long shardId2 = shardManager.allocateShard(tableHandle);

        assertNotEquals(shardId2, shardId1);
View Full Code Here

    @Test
    public void testCreateTable()
    {
        assertNull(metadata.getTableHandle(DEFAULT_TEST_ORDERS));

        TableHandle tableHandle = metadata.createTable(getOrdersTable());
        assertInstanceOf(tableHandle, NativeTableHandle.class);
        assertEquals(((NativeTableHandle) tableHandle).getTableId(), 1);

        ConnectorTableMetadata table = metadata.getTableMetadata(tableHandle);
        assertTableEqual(table, getOrdersTable());
View Full Code Here

                ImmutableMap.<PlanNodeId, OutputReceiver>of());
    }

    private StageExecutionPlan createTableScanPlan(String planId, MetadataManager metadata, int splitCount)
    {
        TableHandle tableHandle = metadata.getTableHandle(new QualifiedTableName("default", "default", DualMetadata.NAME)).get();
        ColumnHandle columnHandle = metadata.getColumnHandle(tableHandle, DualMetadata.COLUMN_NAME).get();
        Symbol symbol = new Symbol(DualMetadata.COLUMN_NAME);

        // table scan with 3 splits
        Split split = new DualSplit(HostAddress.fromString("127.0.0.1"));
View Full Code Here

    @Test
    public void testGetPartitions()
            throws Exception
    {
        TableHandle tableHandle = getTableHandle(table);
        PartitionResult partitionResult = splitManager.getPartitions(tableHandle, TupleDomain.all());
        assertExpectedPartitions(partitionResult.getPartitions());
    }
View Full Code Here

TOP

Related Classes of com.facebook.presto.spi.TableHandle

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.