}
public static LocalQueryRunner createLocalSampledQueryRunner(ExecutorService executor)
{
ConnectorSession session = new ConnectorSession("user", "test", "default", "default", UTC_KEY, Locale.ENGLISH, 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
NativeConnectorFactory nativeConnectorFactory = createNativeConnectorFactory(
nodeManager,
localQueryRunner.getTypeManager(),
System.getProperty("tpchSampledCacheDir", "/tmp/presto_tpch/sampled_data_cache"));
localQueryRunner.createCatalog("default", nativeConnectorFactory, ImmutableMap.<String, String>of());
MetadataManager metadata = localQueryRunner.getMetadata();
if (!metadata.getTableHandle(session, new QualifiedTableName("default", "default", "orders")).isPresent()) {
localQueryRunner.execute("CREATE TABLE orders AS SELECT * FROM tpch_sampled.sf1.orders");
}
if (!metadata.getTableHandle(session, new QualifiedTableName("default", "default", "lineitem")).isPresent()) {
localQueryRunner.execute("CREATE TABLE lineitem AS SELECT * FROM tpch_sampled.sf1.lineitem");
}
return localQueryRunner;
}