com.facebook.presto.Session Java Examples
The following examples show how to use
com.facebook.presto.Session.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: KuduQueryRunnerFactory.java From presto-kudu with Apache License 2.0 | 5 votes |
public static Session createSession(String schema) { return testSessionBuilder() .setCatalog("kudu") .setSchema(schema) .setTimeZoneKey(UTC_KEY) .setLocale(ENGLISH) .build(); }
Example #2
Source File: TestBloomFilterQueries.java From presto-bloomfilter with Apache License 2.0 | 5 votes |
private static LocalQueryRunnerSupplier createQueryRunner() { try { Session defaultSession = testSessionBuilder() .setCatalog("local") .setSchema(TINY_SCHEMA_NAME) .build(); LocalQueryRunner localQueryRunner = new LocalQueryRunner(defaultSession); // add the tpch catalog // local queries run directly against the generator localQueryRunner.createCatalog( defaultSession.getCatalog().get(), new TpchConnectorFactory(1), ImmutableMap.<String, String>of()); localQueryRunner.getTypeManager().addType(new BloomFilterType()); localQueryRunner.getTypeManager().addParametricType(new BloomFilterParametricType()); localQueryRunner.getMetadata().addFunctions(extractFunctions(new BloomFilterPlugin().getFunctions())); return new LocalQueryRunnerSupplier(localQueryRunner); } catch (Exception e) { throw new RuntimeException(e); } }
Example #3
Source File: TestSessionVariables.java From presto-kinesis with Apache License 2.0 | 5 votes |
protected ConnectorSession makeSessionWithTimeZone(String tzId) { return Session.builder(propManager) .setIdentity(new Identity("user", Optional.empty())) .setSource("source") .setCatalog("kinesis") .setSchema("default") .setTimeZoneKey(TimeZoneKey.getTimeZoneKey(tzId)) .setLocale(ENGLISH) .setQueryId(new QueryId("dummy")) .build().toConnectorSession(new ConnectorId("kinesis")); }
Example #4
Source File: TestSessionVariables.java From presto-kinesis with Apache License 2.0 | 5 votes |
@BeforeClass public void start() { // Create dependent objects, including the minimal config needed for this test Map<String, String> properties = new ImmutableMap.Builder<String, String>() .put("kinesis.table-description-dir", "etc/kinesis") .put("kinesis.default-schema", "kinesis") .put("kinesis.hide-internal-columns", "false") .build(); KinesisPlugin kinesisPlugin = TestUtils.createPluginInstance(); KinesisConnector connector = TestUtils.createConnector(kinesisPlugin, properties, true); injector = kinesisPlugin.getInjector(); assertNotNull(injector); protoSession = Session.builder(propManager) .setIdentity(new Identity("user", Optional.empty())) .setSource("source") .setCatalog("kinesis") .setSchema("default") .setTimeZoneKey(TimeZoneKey.getTimeZoneKey("America/Los_Angeles")) .setLocale(ENGLISH) .setQueryId(new QueryId("dummy")) .build(); session = protoSession.toConnectorSession(new ConnectorId("kinesis")); // Connector needs to tell Presto about the session properties it supports propManager.addConnectorSessionProperties(new ConnectorId("kinesis"), connector.getSessionProperties()); }