use of com.facebook.presto.sql.parser.SqlParserOptions in project presto by prestodb.
the class TestQueues method createQueryRunner.
private static DistributedQueryRunner createQueryRunner(Map<String, String> properties) throws Exception {
DistributedQueryRunner queryRunner = new DistributedQueryRunner(testSessionBuilder().build(), 2, ImmutableMap.of(), properties, new SqlParserOptions());
try {
queryRunner.installPlugin(new TpchPlugin());
queryRunner.createCatalog("tpch", "tpch");
return queryRunner;
} catch (Exception e) {
queryRunner.close();
throw e;
}
}
use of com.facebook.presto.sql.parser.SqlParserOptions in project presto by prestodb.
the class TestQueues method createQueryRunner.
private static DistributedQueryRunner createQueryRunner(String dbConfigUrl, H2ResourceGroupsDao dao) throws Exception {
ImmutableMap.Builder<String, String> builder = ImmutableMap.builder();
builder.put("experimental.resource-groups-enabled", "true");
Map<String, String> properties = builder.build();
DistributedQueryRunner queryRunner = new DistributedQueryRunner(testSessionBuilder().build(), 2, ImmutableMap.of(), properties, new SqlParserOptions());
try {
Plugin h2ResourceGroupManagerPlugin = new H2ResourceGroupManagerPlugin();
queryRunner.installPlugin(h2ResourceGroupManagerPlugin);
queryRunner.getCoordinator().getResourceGroupManager().get().setConfigurationManager(NAME, ImmutableMap.of("resource-groups.config-db-url", dbConfigUrl));
queryRunner.installPlugin(new TpchPlugin());
queryRunner.createCatalog("tpch", "tpch");
setup(queryRunner, dao);
return queryRunner;
} catch (Exception e) {
queryRunner.close();
throw e;
}
}
use of com.facebook.presto.sql.parser.SqlParserOptions in project presto by prestodb.
the class TestPrestoDriverAuth method setup.
@BeforeClass
public void setup() throws Exception {
Logging.initialize();
URL resource = getClass().getClassLoader().getResource("33.privateKey");
assertNotNull(resource, "key directory not found");
File keyDir = new File(resource.getFile()).getAbsoluteFile().getParentFile();
defaultKey = getMimeDecoder().decode(asCharSource(new File(keyDir, "default-key.key"), US_ASCII).read().getBytes(US_ASCII));
hmac222 = getMimeDecoder().decode(asCharSource(new File(keyDir, "222.key"), US_ASCII).read().getBytes(US_ASCII));
privateKey33 = PemReader.loadPrivateKey(new File(keyDir, "33.privateKey"), Optional.empty());
server = new TestingPrestoServer(true, ImmutableMap.<String, String>builder().put("http-server.authentication.type", "JWT").put("http.authentication.jwt.key-file", new File(keyDir, "${KID}.key").toString()).put("http-server.https.enabled", "true").put("http-server.https.keystore.path", getResource("localhost.keystore").getPath()).put("http-server.https.keystore.key", "changeit").build(), null, null, new SqlParserOptions(), ImmutableList.of());
server.installPlugin(new TpchPlugin());
server.createCatalog(TEST_CATALOG, "tpch");
waitForNodeRefresh(server);
}
use of com.facebook.presto.sql.parser.SqlParserOptions in project presto by prestodb.
the class TestHttpRequestSessionContext method testPreparedStatementsSpecialCharacters.
@Test
public void testPreparedStatementsSpecialCharacters() {
HttpServletRequest request = new MockHttpServletRequest(ImmutableListMultimap.<String, String>builder().put(PRESTO_USER, "testUser").put(PRESTO_SOURCE, "testSource").put(PRESTO_CATALOG, "testCatalog").put(PRESTO_SCHEMA, "testSchema").put(PRESTO_LANGUAGE, "zh-TW").put(PRESTO_TIME_ZONE, "Asia/Taipei").put(PRESTO_CLIENT_INFO, "null").put(PRESTO_PREPARED_STATEMENT, "query1=select * from \"tbl:ns\"").build(), "testRemote");
SqlParserOptions options = new SqlParserOptions();
options.allowIdentifierSymbol(EnumSet.allOf(IdentifierSymbol.class));
new HttpRequestSessionContext(request, options);
}
use of com.facebook.presto.sql.parser.SqlParserOptions in project presto by prestodb.
the class TestHttpRequestSessionContext method testPreparedStatementsHeaderDoesNotParse.
@Test(expectedExceptions = WebApplicationException.class)
public void testPreparedStatementsHeaderDoesNotParse() {
HttpServletRequest request = new MockHttpServletRequest(ImmutableListMultimap.<String, String>builder().put(PRESTO_USER, "testUser").put(PRESTO_SOURCE, "testSource").put(PRESTO_CATALOG, "testCatalog").put(PRESTO_SCHEMA, "testSchema").put(PRESTO_LANGUAGE, "zh-TW").put(PRESTO_TIME_ZONE, "Asia/Taipei").put(PRESTO_CLIENT_INFO, "null").put(PRESTO_PREPARED_STATEMENT, "query1=abcdefg").build(), "testRemote");
new HttpRequestSessionContext(request, new SqlParserOptions());
}
Aggregations