Package com.facebook.presto.util

Examples of com.facebook.presto.util.LocalQueryRunner$MaterializedOutputFactory


public abstract class StatisticsBenchmark
{
    public static void main(String... args)
    {
        LocalQueryRunner localQueryRunner = createLocalQueryRunner(newCachedThreadPool(daemonThreadsNamed("test")));
        new LongVarianceBenchmark(localQueryRunner).runBenchmark(new AverageBenchmarkResults());
        new LongVariancePopBenchmark(localQueryRunner).runBenchmark(new AverageBenchmarkResults());
        new DoubleVarianceBenchmark(localQueryRunner).runBenchmark(new AverageBenchmarkResults());
        new DoubleVariancePopBenchmark(localQueryRunner).runBenchmark(new AverageBenchmarkResults());
        new LongStdDevBenchmark(localQueryRunner).runBenchmark(new AverageBenchmarkResults());
View Full Code Here


public abstract class StatisticsBenchmark
{
    public static void main(String... args)
    {
        LocalQueryRunner localQueryRunner = createLocalQueryRunner(newCachedThreadPool(daemonThreadsNamed("test")));
        new LongVarianceBenchmark(localQueryRunner).runBenchmark(new AverageBenchmarkResults());
        new LongVariancePopBenchmark(localQueryRunner).runBenchmark(new AverageBenchmarkResults());
        new DoubleVarianceBenchmark(localQueryRunner).runBenchmark(new AverageBenchmarkResults());
        new DoubleVariancePopBenchmark(localQueryRunner).runBenchmark(new AverageBenchmarkResults());
        new LongStdDevBenchmark(localQueryRunner).runBenchmark(new AverageBenchmarkResults());
View Full Code Here

        //
        // If the projection does not need bound values, execute query using full engine
        if (!needsBoundValue(projectionExpression)) {
            try {
                LocalQueryRunner runner = new LocalQueryRunner(session, EXECUTOR);
                MaterializedResult result = runner.execute("SELECT " + projection + " FROM dual");
                assertEquals(result.getTupleInfos().size(), 1);
                assertEquals(result.getMaterializedTuples().size(), 1);
                Object queryResult = Iterables.getOnlyElement(result.getMaterializedTuples()).getField(0);
                results.add(queryResult);
            }
View Full Code Here

        //
        // If the filter does not need bound values, execute query using full engine
        if (!needsBoundValue(filterExpression)) {
            try {
                LocalQueryRunner runner = new LocalQueryRunner(session, EXECUTOR);
                MaterializedResult result = runner.execute("SELECT TRUE FROM dual WHERE " + filter);
                assertEquals(result.getTupleInfos().size(), 1);

                Boolean queryResult;
                if (result.getMaterializedTuples().isEmpty()) {
                    queryResult = false;
View Full Code Here

    @Override
    protected Session setUpQueryFramework()
    {
        Session session = new Session("user", "test", "local", TpchMetadata.TINY_SCHEMA_NAME, null, null);
        localQueryRunner = new LocalQueryRunner(session, getExecutor());
        localSampledQueryRunner = new LocalQueryRunner(session, getExecutor());

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

    @Override
    protected Session setUpQueryFramework()
    {
        Session session = new Session("user", "test", "local", TpchMetadata.TINY_SCHEMA_NAME, 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

{
    private WindowAssertions() {}

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

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

    }

    public static LocalQueryRunner createLocalSampledQueryRunner(ExecutorService executor)
    {
        Session session = new Session("user", "test", "default", "default", null, null);
        LocalQueryRunner localQueryRunner = new LocalQueryRunner(session, executor);

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

        // add native
        MetadataManager metadata = localQueryRunner.getMetadata();
        NativeConnectorFactory nativeConnectorFactory = createNativeConnectorFactory(nodeManager, metadata, System.getProperty("tpchSampledCacheDir", "/tmp/tpch_sampled_data_cache"));
        localQueryRunner.createCatalog("default", nativeConnectorFactory, ImmutableMap.<String, String>of());

        if (!metadata.getTableHandle(new QualifiedTableName("default", "default", "orders")).isPresent()) {
            localQueryRunner.execute("CREATE TABLE orders AS SELECT * FROM tpch_sampled.sf1.orders");
        }
        if (!metadata.getTableHandle(new QualifiedTableName("default", "default", "lineitem")).isPresent()) {
            localQueryRunner.execute("CREATE TABLE lineitem AS SELECT * FROM tpch_sampled.sf1.lineitem");
        }
        return localQueryRunner;
    }
View Full Code Here

    }

    public static LocalQueryRunner createLocalQueryRunner(ExecutorService executor)
    {
        Session session = new Session("user", "test", "default", "default", null, null);
        LocalQueryRunner localQueryRunner = new LocalQueryRunner(session, executor);

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

        // add native
        MetadataManager metadata = localQueryRunner.getMetadata();
        NativeConnectorFactory nativeConnectorFactory = createNativeConnectorFactory(nodeManager, metadata, System.getProperty("tpchCacheDir", "/tmp/tpch_data_cache"));
        localQueryRunner.createCatalog("default", nativeConnectorFactory, ImmutableMap.<String, String>of());

        if (!metadata.getTableHandle(new QualifiedTableName("default", "default", "orders")).isPresent()) {
            localQueryRunner.execute("CREATE TABLE orders AS SELECT * FROM tpch.sf1.orders");
        }
        if (!metadata.getTableHandle(new QualifiedTableName("default", "default", "lineitem")).isPresent()) {
            localQueryRunner.execute("CREATE TABLE lineitem AS SELECT * FROM tpch.sf1.lineitem");
        }
        return localQueryRunner;
    }
View Full Code Here

        //
        // If the projection does not need bound values, execute query using full engine
        if (!needsBoundValue(projectionExpression)) {
            try {
                LocalQueryRunner runner = new LocalQueryRunner(session, EXECUTOR);
                MaterializedResult result = runner.execute("SELECT " + projection + " FROM dual");
                assertEquals(result.getTupleInfos().size(), 1);
                assertEquals(result.getMaterializedTuples().size(), 1);
                Object queryResult = Iterables.getOnlyElement(result.getMaterializedTuples()).getField(0);
                results.add(queryResult);
            }
View Full Code Here

TOP

Related Classes of com.facebook.presto.util.LocalQueryRunner$MaterializedOutputFactory

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.