Package com.facebook.presto.testing

Examples of com.facebook.presto.testing.LocalQueryRunner


    @Override
    protected ConnectorSession setUpQueryFramework()
    {
        ConnectorSession session = new ConnectorSession("user", "test", "local", TpchMetadata.TINY_SCHEMA_NAME, UTC_KEY, Locale.ENGLISH, null, null);
        localSampledQueryRunner = new LocalQueryRunner(session, getExecutor());

        // add the tpch catalog
        // local queries run directly against the generator
        localSampledQueryRunner.createCatalog(session.getCatalog(), new SampledTpchConnectorFactory(localSampledQueryRunner.getNodeManager(), 1, 1), ImmutableMap.<String, String>of());
        localSampledQueryRunner.getMetadata().addFunctions(CUSTOM_FUNCTIONS);
View Full Code Here


    @Override
    protected ConnectorSession setUpQueryFramework()
    {
        ConnectorSession session = new ConnectorSession("user", "test", "local", TpchMetadata.TINY_SCHEMA_NAME, UTC_KEY, Locale.ENGLISH, null, null);
        localIndexedQueryRunner = new LocalQueryRunner(session, getExecutor());

        // add the tpch catalog
        // local queries run directly against the generator
        localIndexedQueryRunner.createCatalog(session.getCatalog(), new IndexedTpchConnectorFactory(localIndexedQueryRunner.getNodeManager(), getTpchIndexSpec(), 1), ImmutableMap.<String, String>of());
View Full Code Here

    }

    public FunctionAssertions(ConnectorSession session)
    {
        this.session = checkNotNull(session, "session is null");
        runner = new LocalQueryRunner(session, EXECUTOR);
        metadataManager = runner.getMetadata();
        compiler = new ExpressionCompiler(metadataManager);
    }
View Full Code Here

    private WindowAssertions() {}

    public static MaterializedResult computeActual(@Language("SQL") String sql, ExecutorService executor)
    {
        ConnectorSession session = new ConnectorSession("user", "test", "tpch", TpchMetadata.TINY_SCHEMA_NAME, UTC_KEY, Locale.ENGLISH, null, null);
        LocalQueryRunner localQueryRunner = new LocalQueryRunner(session, executor);
        localQueryRunner.createCatalog("tpch", new TpchConnectorFactory(localQueryRunner.getNodeManager(), 1), ImmutableMap.<String, String>of());

        return localQueryRunner.execute(sql);
    }
View Full Code Here

    }

    public FunctionAssertions(ConnectorSession session)
    {
        this.session = checkNotNull(session, "session is null");
        runner = new LocalQueryRunner(session);
        metadata = runner.getMetadata();
        oldCompiler = new ExpressionCompiler(metadata, new CompilerConfig().setUseNewByteCodeGenerator(false));
        newCompiler = new ExpressionCompiler(metadata, new CompilerConfig().setUseNewByteCodeGenerator(true));
    }
View Full Code Here

    }

    private static LocalQueryRunner createLocalQueryRunner()
    {
        ConnectorSession defaultSession = new ConnectorSession("user", "test", "local", TpchMetadata.TINY_SCHEMA_NAME, UTC_KEY, Locale.ENGLISH, null, null);
        LocalQueryRunner localQueryRunner = new LocalQueryRunner(defaultSession);

        // add the tpch catalog
        // local queries run directly against the generator
        localQueryRunner.createCatalog(
                defaultSession.getCatalog(),
                new TpchConnectorFactory(localQueryRunner.getNodeManager(), 1),
                ImmutableMap.<String, String>of());
        localQueryRunner.createCatalog(TPCH_SAMPLED_SCHEMA, new SampledTpchConnectorFactory(localQueryRunner.getNodeManager(), 1, 2), ImmutableMap.<String, String>of());

        localQueryRunner.getMetadata().addFunctions(CUSTOM_FUNCTIONS);

        return localQueryRunner;
    }
View Full Code Here

    }

    private static LocalQueryRunner createLocalQueryRunner()
    {
        ConnectorSession defaultSession = new ConnectorSession("user", "test", "local", TpchMetadata.TINY_SCHEMA_NAME, UTC_KEY, Locale.ENGLISH, null, null);
        LocalQueryRunner localQueryRunner = new LocalQueryRunner(defaultSession);

        // add the tpch catalog
        // local queries run directly against the generator
        localQueryRunner.createCatalog(defaultSession.getCatalog(),
                new IndexedTpchConnectorFactory(localQueryRunner.getNodeManager(), INDEX_SPEC, 1), ImmutableMap.<String, String>of());

        return localQueryRunner;
    }
View Full Code Here

                .setSchema("tpch")
                .setTimeZoneKey(UTC_KEY)
                .setLocale(ENGLISH)
                .build();

        LocalQueryRunner localQueryRunner = new LocalQueryRunner(session);

        // add tpch
        InMemoryNodeManager nodeManager = localQueryRunner.getNodeManager();
        localQueryRunner.createCatalog("tpch", new TpchConnectorFactory(nodeManager, 1), ImmutableMap.<String, String>of());

        // add hive
        InMemoryHiveMetastore metastore = new InMemoryHiveMetastore();
        File tpchDataDir = new File(tempDir, "tpch");
        tpchDataDir.mkdir();
        metastore.createDatabase(new Database("tpch", null, tpchDataDir.toURI().toString(), null));

        HiveConnectorFactory hiveConnectorFactory = new HiveConnectorFactory(
                "hive",
                ImmutableMap.of("node.environment", "test"),
                HiveBenchmarkQueryRunner.class.getClassLoader(),
                metastore,
                new TypeRegistry());

        Map<String, String> hiveCatalogConfig = ImmutableMap.<String, String>builder()
                .put("hive.metastore.uri", "thrift://none.invalid:0")
                .put("hive.max-split-size", "10GB")
                .build();

        localQueryRunner.createCatalog("hive", hiveConnectorFactory, hiveCatalogConfig);

        localQueryRunner.execute("CREATE TABLE orders AS SELECT * FROM tpch.sf1.orders");
        localQueryRunner.execute("CREATE TABLE lineitem AS SELECT * FROM tpch.sf1.lineitem");
        return localQueryRunner;
    }
View Full Code Here

TOP

Related Classes of com.facebook.presto.testing.LocalQueryRunner

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.