Package com.facebook.presto.metadata

Examples of com.facebook.presto.metadata.MetadataManager$ConnectorMetadataEntry


    @BeforeMethod(alwaysRun = true)
    public void setup()
            throws Exception
    {
        MetadataManager metadata = new MetadataManager();
        metadata.addConnectorMetadata("tpch", new InMemoryMetadata());

        SchemaTableName table1 = new SchemaTableName("default", "t1");
        metadata.createTable("tpch", new TableMetadata(table1,
                ImmutableList.<ColumnMetadata>of(
                        new ColumnMetadata("a", ColumnType.LONG, 0, false),
                        new ColumnMetadata("b", ColumnType.LONG, 1, false),
                        new ColumnMetadata("c", ColumnType.LONG, 2, false),
                        new ColumnMetadata("d", ColumnType.LONG, 3, false))));

        SchemaTableName table2 = new SchemaTableName("default", "t2");
        metadata.createTable("tpch", new TableMetadata(table2,
                ImmutableList.<ColumnMetadata>of(
                        new ColumnMetadata("a", ColumnType.LONG, 0, false),
                        new ColumnMetadata("b", ColumnType.LONG, 1, false))));

        SchemaTableName table3 = new SchemaTableName("default", "t3");
        metadata.createTable("tpch", new TableMetadata(table3,
                ImmutableList.<ColumnMetadata>of(
                        new ColumnMetadata("a", ColumnType.LONG, 0, false),
                        new ColumnMetadata("b", ColumnType.LONG, 1, false))));

        analyzer = new Analyzer(new Session("user", "test", "tpch", "default", null, null), metadata, Optional.<QueryExplainer>absent());
View Full Code Here


            throws Exception
    {
        ExecutorService executor = Executors.newCachedThreadPool(Threads.daemonThreadsNamed("test"));
        SqlStageExecution stageExecution = null;
        try {
            MetadataManager metadata = new MetadataManager();
            metadata.addInternalSchemaMetadata(new DualMetadata());

            StageExecutionPlan joinPlan = createJoinPlan("A", metadata);

            InMemoryNodeManager nodeManager = new InMemoryNodeManager();
            nodeManager.addNode("foo", new Node("other", URI.create("http://127.0.0.1:11"), NodeVersion.UNKNOWN));
View Full Code Here

        InMemoryNodeManager nodeManager = new InMemoryNodeManager();

        String nodeName = UUID.randomUUID().toString();
        nodeManager.addNode("native", new Node(nodeName, new URI("http://127.0.0.1/"), NodeVersion.UNKNOWN));

        MetadataManager metadataManager = new MetadataManager();
        metadataManager.addConnectorMetadata("local", new NativeMetadata("native", dbi));

        tableHandle = metadataManager.createTable("local", TEST_TABLE);
        dsColumnHandle = metadataManager.getColumnHandle(tableHandle, "ds").get();
        fooColumnHandle = metadataManager.getColumnHandle(tableHandle, "foo").get();
        symbols = ImmutableMap.<Symbol, ColumnHandle>of(new Symbol("foo"), fooColumnHandle, new Symbol("ds"), dsColumnHandle);

        long shardId1 = shardManager.allocateShard(tableHandle);
        long shardId2 = shardManager.allocateShard(tableHandle);
        long shardId3 = shardManager.allocateShard(tableHandle);
View Full Code Here

        ;
        columnHandle = dualMetadata.getColumnHandle(tableHandle, DualMetadata.COLUMN_NAME);
        assertNotNull(columnHandle, "columnHandle is null");
        symbol = new Symbol(DualMetadata.COLUMN_NAME);

        MetadataManager metadata = new MetadataManager();
        metadata.addInternalSchemaMetadata(dualMetadata);

        DualSplitManager dualSplitManager = new DualSplitManager(new InMemoryNodeManager());
        split = Iterables.getOnlyElement(dualSplitManager.getPartitionSplits(tableHandle, dualSplitManager.getPartitions(tableHandle, ImmutableMap.<ColumnHandle, Object>of())));

        planner = new LocalExecutionPlanner(
View Full Code Here

    public static LocalQueryRunner createDualLocalQueryRunner(Session session, ExecutorService executor)
    {
        InMemoryNodeManager nodeManager = new InMemoryNodeManager();

        MetadataManager metadataManager = new MetadataManager();
        SplitManager splitManager = new SplitManager(metadataManager, ImmutableSet.<ConnectorSplitManager>of());
        DataStreamManager dataStreamManager = new DataStreamManager();

        addDual(nodeManager, metadataManager, splitManager, dataStreamManager);
        addInformationSchema(nodeManager, metadataManager, splitManager, dataStreamManager);
View Full Code Here

    public static LocalQueryRunner createTpchLocalQueryRunner(Session session, TpchBlocksProvider tpchBlocksProvider, ExecutorService executor)
    {
        InMemoryNodeManager nodeManager = new InMemoryNodeManager();

        MetadataManager metadataManager = new MetadataManager();
        SplitManager splitManager = new SplitManager(metadataManager, ImmutableSet.<ConnectorSplitManager>of());
        DataStreamManager dataStreamManager = new DataStreamManager();

        addDual(nodeManager, metadataManager, splitManager, dataStreamManager);
        addSystem(nodeManager, metadataManager, splitManager, dataStreamManager);
View Full Code Here

            OutputPartitioning.NONE,
            ImmutableList.<Symbol>of());

    public static LocalExecutionPlanner createTestingPlanner()
    {
        MetadataManager metadata = new MetadataManager();

        PageSourceManager pageSourceManager = new PageSourceManager(new SystemRecordSetProvider());
        pageSourceManager.addConnectorPageSourceProvider("test", new TestingPageSourceProvider());
        return new LocalExecutionPlanner(
                metadata,
View Full Code Here

    {
        inputPage = createInputPage();

        handCodedProcessor = new Tpch1FilterAndProject();

        compiledProcessor = new ExpressionCompiler(new MetadataManager()).compilePageProcessor(FILTER, ImmutableList.of(PROJECT));
    }
View Full Code Here

    @Test
    public void testHashAggregation()
            throws Exception
    {
        MetadataManager metadata = new MetadataManager();
        InternalAggregationFunction countVarcharColumn = metadata.resolveFunction(QualifiedName.of("count"), ImmutableList.of(StandardTypes.VARCHAR), false).getAggregationFunction();
        InternalAggregationFunction countBooleanColumn = metadata.resolveFunction(QualifiedName.of("count"), ImmutableList.of(StandardTypes.BOOLEAN), false).getAggregationFunction();
        List<Page> input = rowPagesBuilder(VARCHAR, VARCHAR, VARCHAR, BIGINT, BOOLEAN)
                .addSequencePage(10, 100, 0, 100, 0, 500)
                .addSequencePage(10, 100, 0, 200, 0, 500)
                .addSequencePage(10, 100, 0, 300, 0, 500)
                .build();
View Full Code Here

    @BeforeMethod(alwaysRun = true)
    public void setup()
            throws Exception
    {
        MetadataManager metadata = new MetadataManager(new FeaturesConfig().setExperimentalSyntaxEnabled(true), new TypeRegistry(), new SystemTablesMetadata());
        metadata.addConnectorMetadata("tpch", "tpch", new TestingMetadata());
        metadata.addConnectorMetadata("c2", "c2", new TestingMetadata());
        metadata.addConnectorMetadata("c3", "c3", new TestingMetadata());

        SchemaTableName table1 = new SchemaTableName("default", "t1");
        metadata.createTable(SESSION, "tpch", new TableMetadata("tpch", new ConnectorTableMetadata(table1,
                ImmutableList.<ColumnMetadata>of(
                        new ColumnMetadata("a", BIGINT, 0, false),
                        new ColumnMetadata("b", BIGINT, 1, false),
                        new ColumnMetadata("c", BIGINT, 2, false),
                        new ColumnMetadata("d", BIGINT, 3, false)))));

        SchemaTableName table2 = new SchemaTableName("default", "t2");
        metadata.createTable(SESSION, "tpch", new TableMetadata("tpch", new ConnectorTableMetadata(table2,
                ImmutableList.<ColumnMetadata>of(
                        new ColumnMetadata("a", BIGINT, 0, false),
                        new ColumnMetadata("b", BIGINT, 1, false)))));

        SchemaTableName table3 = new SchemaTableName("default", "t3");
        metadata.createTable(SESSION, "tpch", new TableMetadata("tpch", new ConnectorTableMetadata(table3,
                ImmutableList.<ColumnMetadata>of(
                        new ColumnMetadata("a", BIGINT, 0, false),
                        new ColumnMetadata("b", BIGINT, 1, false)))));

        // table in different catalog
        SchemaTableName table4 = new SchemaTableName("s2", "t4");
        metadata.createTable(SESSION, "c2", new TableMetadata("tpch", new ConnectorTableMetadata(table4,
                ImmutableList.<ColumnMetadata>of(
                        new ColumnMetadata("a", BIGINT, 0, false)))));

        // valid view referencing table in same schema
        String viewData1 = JsonCodec.jsonCodec(ViewDefinition.class).toJson(
                new ViewDefinition("select a from t1", "tpch", "default", ImmutableList.of(
                        new ViewColumn("a", BIGINT))));
        metadata.createView(SESSION, new QualifiedTableName("tpch", "default", "v1"), viewData1, false);

        // stale view (different column type)
        String viewData2 = JsonCodec.jsonCodec(ViewDefinition.class).toJson(
                new ViewDefinition("select a from t1", "tpch", "default", ImmutableList.of(
                        new ViewColumn("a", VARCHAR))));
        metadata.createView(SESSION, new QualifiedTableName("tpch", "default", "v2"), viewData2, false);

        // view referencing table in different schema from itself and session
        String viewData3 = JsonCodec.jsonCodec(ViewDefinition.class).toJson(
                new ViewDefinition("select a from t4", "c2", "s2", ImmutableList.of(
                        new ViewColumn("a", BIGINT))));
        metadata.createView(SESSION, new QualifiedTableName("c3", "s3", "v3"), viewData3, false);

        analyzer = new Analyzer(
                Session.builder()
                        .setUser("user")
                        .setSource("test")
View Full Code Here

TOP

Related Classes of com.facebook.presto.metadata.MetadataManager$ConnectorMetadataEntry

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.