public static QueryRunner createLocalQueryRunner() throws Exception { Session defaultSession = testSessionBuilder() .setCatalog("slack") .setSchema("default") .build(); QueryRunner queryRunner = new DistributedQueryRunner(defaultSession, 1); queryRunner.installPlugin(new SlackPlugin()); queryRunner.createCatalog( "slack", "slack", ImmutableMap.of("token", System.getenv("SLACK_TOKEN"))); return queryRunner; }
public static QueryRunner createLocalQueryRunner() throws Exception { Session defaultSession = testSessionBuilder() .setCatalog("github") .setSchema("default") .build(); QueryRunner queryRunner = new DistributedQueryRunner(defaultSession, 1); queryRunner.installPlugin(new GithubPlugin()); queryRunner.createCatalog( "github", "github", ImmutableMap.of("token", System.getenv("GITHUB_TOKEN"))); return queryRunner; }
private static QueryRunner createLocalQueryRunner() throws Exception { Session defaultSession = TestingSession.testSessionBuilder() .setCatalog("twitter") .setSchema("default") .build(); QueryRunner queryRunner = new DistributedQueryRunner(defaultSession, 1); queryRunner.installPlugin(new TwitterPlugin()); queryRunner.createCatalog( "twitter", "twitter", ImmutableMap.of( "customer_key", System.getenv("TWITTER_CUSTOMER_KEY"), "customer_secret", System.getenv("TWITTER_CUSTOMER_SECRET"), "token", System.getenv("TWITTER_TOKEN"), "secret", System.getenv("TWITTER_SECRET"))); return queryRunner; }
private static LocalQueryRunner createLocalQueryRunner() { Session defaultSession = testSessionBuilder() .setCatalog("tpch") .setSchema(TINY_SCHEMA_NAME) .build(); LocalQueryRunner localQueryRunner = new LocalQueryRunner(defaultSession); InMemoryNodeManager nodeManager = localQueryRunner.getNodeManager(); localQueryRunner.createCatalog("tpch", new TpchConnectorFactory(nodeManager, 1), ImmutableMap.<String, String>of()); HyperLogLogPlugin plugin = new HyperLogLogPlugin(); for (Type type : plugin.getTypes()) { localQueryRunner.getTypeManager().addType(type); } for (ParametricType parametricType : plugin.getParametricTypes()) { localQueryRunner.getTypeManager().addParametricType(parametricType); } localQueryRunner.getMetadata().addFunctions(extractFunctions(plugin.getFunctions())); return localQueryRunner; }
@Override public List<QualifiedObjectName> listTables(Session session, QualifiedTablePrefix prefix) { requireNonNull(prefix, "prefix is null"); String schemaNameOrNull = prefix.getSchemaName().orElse(null); Set<QualifiedObjectName> tables = new LinkedHashSet<>(); for (ConnectorEntry entry : allConnectorsFor(prefix.getCatalogName())) { ConnectorMetadata metadata = entry.getMetadata(session); ConnectorSession connectorSession = session.toConnectorSession(entry.getCatalog()); for (QualifiedObjectName tableName : transform(metadata.listTables(connectorSession, schemaNameOrNull), convertFromSchemaTableName(prefix.getCatalogName()))) { tables.add(tableName); } } return ImmutableList.copyOf(tables); }
public StatementAnalyzer( Analysis analysis, Metadata metadata, SqlParser sqlParser, AccessControl accessControl, Session session, boolean experimentalSyntaxEnabled, Optional<QueryExplainer> queryExplainer) { this.analysis = requireNonNull(analysis, "analysis is null"); this.metadata = requireNonNull(metadata, "metadata is null"); this.sqlParser = requireNonNull(sqlParser, "sqlParser is null"); this.accessControl = requireNonNull(accessControl, "accessControl is null"); this.session = requireNonNull(session, "session is null"); this.experimentalSyntaxEnabled = experimentalSyntaxEnabled; this.queryExplainer = requireNonNull(queryExplainer, "queryExplainer is null"); }
public static LocalQueryRunner createLocalQueryRunner() { Session session = testSessionBuilder() .setCatalog("raptor") .setSchema("benchmark") .build(); LocalQueryRunner localQueryRunner = new LocalQueryRunner(session); // add tpch InMemoryNodeManager nodeManager = localQueryRunner.getNodeManager(); localQueryRunner.createCatalog("tpch", new TpchConnectorFactory(nodeManager, 1), ImmutableMap.<String, String>of()); // add raptor ConnectorFactory raptorConnectorFactory = createRaptorConnectorFactory(TPCH_CACHE_DIR, nodeManager); localQueryRunner.createCatalog("raptor", raptorConnectorFactory, ImmutableMap.of()); if (!localQueryRunner.tableExists(session, "orders")) { localQueryRunner.execute("CREATE TABLE orders AS SELECT * FROM tpch.sf1.orders"); } if (!localQueryRunner.tableExists(session, "lineitem")) { localQueryRunner.execute("CREATE TABLE lineitem AS SELECT * FROM tpch.sf1.lineitem"); } return localQueryRunner; }
public String getGraphvizPlan(Session session, Statement statement, Type planType) { DataDefinitionTask<?> task = dataDefinitionTask.get(statement.getClass()); if (task != null) { // todo format as graphviz return explainTask(statement, task); } switch (planType) { case LOGICAL: Plan plan = getLogicalPlan(session, statement); return PlanPrinter.graphvizLogicalPlan(plan.getRoot(), plan.getTypes()); case DISTRIBUTED: SubPlan subPlan = getDistributedPlan(session, statement); return PlanPrinter.graphvizDistributedPlan(subPlan); } throw new IllegalArgumentException("Unhandled plan type: " + planType); }
@Override public List<QualifiedObjectName> listViews(Session session, QualifiedTablePrefix prefix) { requireNonNull(prefix, "prefix is null"); String schemaNameOrNull = prefix.getSchemaName().orElse(null); Set<QualifiedObjectName> views = new LinkedHashSet<>(); for (ConnectorEntry entry : allConnectorsFor(prefix.getCatalogName())) { ConnectorMetadata metadata = entry.getMetadata(session); ConnectorSession connectorSession = session.toConnectorSession(entry.getCatalog()); for (QualifiedObjectName tableName : transform(metadata.listViews(connectorSession, schemaNameOrNull), convertFromSchemaTableName(prefix.getCatalogName()))) { views.add(tableName); } } return ImmutableList.copyOf(views); }
public static ExpressionAnalysis analyzeExpressionsWithSymbols( Session session, Metadata metadata, SqlParser sqlParser, Map<Symbol, Type> types, Iterable<? extends Expression> expressions) { List<Field> fields = DependencyExtractor.extractUnique(expressions).stream() .map(symbol -> { Type type = types.get(symbol); checkArgument(type != null, "No type for symbol %s", symbol); return Field.newUnqualified(symbol.getName(), type); }) .collect(toImmutableList()); return analyzeExpressions(session, metadata, sqlParser, new RelationType(fields), expressions); }
public static RowExpression translate( Expression expression, FunctionKind functionKind, IdentityHashMap<Expression, Type> types, FunctionRegistry functionRegistry, TypeManager typeManager, Session session, boolean optimize) { RowExpression result = new Visitor(functionKind, types, typeManager, session.getTimeZoneKey()).process(expression, null); requireNonNull(result, "translated expression is null"); if (optimize) { ExpressionOptimizer optimizer = new ExpressionOptimizer(functionRegistry, typeManager, session); return optimizer.optimize(result); } return result; }
public Query(Session session, String query, QueryManager queryManager, ExchangeClient exchangeClient) { requireNonNull(session, "session is null"); requireNonNull(query, "query is null"); requireNonNull(queryManager, "queryManager is null"); requireNonNull(exchangeClient, "exchangeClient is null"); this.session = session; this.queryManager = queryManager; QueryInfo queryInfo = queryManager.createQuery(session, query); queryId = queryInfo.getQueryId(); this.exchangeClient = exchangeClient; }
@Override public CompletableFuture<?> execute(RenameTable statement, TransactionManager transactionManager, Metadata metadata, AccessControl accessControl, QueryStateMachine stateMachine) { Session session = stateMachine.getSession(); QualifiedObjectName tableName = createQualifiedObjectName(session, statement, statement.getSource()); Optional<TableHandle> tableHandle = metadata.getTableHandle(session, tableName); if (!tableHandle.isPresent()) { throw new SemanticException(MISSING_TABLE, statement, "Table '%s' does not exist", tableName); } QualifiedObjectName target = createQualifiedObjectName(session, statement, statement.getTarget()); if (!metadata.getCatalogNames().containsKey(target.getCatalogName())) { throw new SemanticException(MISSING_CATALOG, statement, "Target catalog '%s' does not exist", target.getCatalogName()); } if (metadata.getTableHandle(session, target).isPresent()) { throw new SemanticException(TABLE_ALREADY_EXISTS, statement, "Target table '%s' already exists", target); } if (!tableName.getCatalogName().equals(target.getCatalogName())) { throw new SemanticException(NOT_SUPPORTED, statement, "Table rename across catalogs is not supported"); } accessControl.checkCanRenameTable(session.getRequiredTransactionId(), session.getIdentity(), tableName, target); metadata.renameTable(session, tableHandle.get(), target); return completedFuture(null); }
@POST @Produces(MediaType.APPLICATION_JSON) public Response createQuery(String query, @Context HttpServletRequest servletRequest) { assertRequest(!isNullOrEmpty(query), "SQL query is empty"); Session session = createSessionForRequest(servletRequest, accessControl, sessionPropertyManager, queryIdGenerator.createNextQueryId()); ClientSession clientSession = session.toClientSession(serverUri(), false, new Duration(2, MINUTES)); StatementClient client = new StatementClient(httpClient, queryResultsCodec, clientSession, query); List<Column> columns = getColumns(client); Iterator<List<Object>> iterator = flatten(new ResultsPageIterator(client)); SimpleQueryResults results = new SimpleQueryResults(columns, iterator); return Response.ok(results, MediaType.APPLICATION_JSON_TYPE).build(); }
private Operator interpretedFilterProject(Expression filter, Expression projection, Session session) { FilterFunction filterFunction = new InterpretedFilterFunction( filter, SYMBOL_TYPES, INPUT_MAPPING, metadata, SQL_PARSER, session ); ProjectionFunction projectionFunction = new InterpretedProjectionFunction( projection, SYMBOL_TYPES, INPUT_MAPPING, metadata, SQL_PARSER, session ); OperatorFactory operatorFactory = new FilterAndProjectOperator.FilterAndProjectOperatorFactory(0, new PlanNodeId("test"), new GenericPageProcessor(filterFunction, ImmutableList.of(projectionFunction)), toTypes( ImmutableList.of(projectionFunction))); return operatorFactory.createOperator(createDriverContext(session)); }
public String getPlan(Session session, Statement statement, Type planType) { DataDefinitionTask<?> task = dataDefinitionTask.get(statement.getClass()); if (task != null) { return explainTask(statement, task); } switch (planType) { case LOGICAL: Plan plan = getLogicalPlan(session, statement); return PlanPrinter.textLogicalPlan(plan.getRoot(), plan.getTypes(), metadata, session); case DISTRIBUTED: SubPlan subPlan = getDistributedPlan(session, statement); return PlanPrinter.textDistributedPlan(subPlan, metadata, session); } throw new IllegalArgumentException("Unhandled plan type: " + planType); }
public StandaloneQueryRunner(Session defaultSession) throws Exception { requireNonNull(defaultSession, "defaultSession is null"); try { server = createTestingPrestoServer(); } catch (Exception e) { close(); throw e; } this.prestoClient = new TestingPrestoClient(server, defaultSession); refreshNodes(); server.getMetadata().addFunctions(AbstractTestQueries.CUSTOM_FUNCTIONS); SessionPropertyManager sessionPropertyManager = server.getMetadata().getSessionPropertyManager(); sessionPropertyManager.addSystemSessionProperties(AbstractTestQueries.TEST_SYSTEM_PROPERTIES); sessionPropertyManager.addConnectorSessionProperties("catalog", AbstractTestQueries.TEST_CATALOG_PROPERTIES); }
public SqlTaskExecution create(Session session, QueryContext queryContext, TaskStateMachine taskStateMachine, SharedBuffer sharedBuffer, PlanFragment fragment, List<TaskSource> sources) { boolean verboseStats = getVerboseStats(session); TaskContext taskContext = queryContext.addTaskContext( taskStateMachine, session, requireNonNull(operatorPreAllocatedMemory, "operatorPreAllocatedMemory is null"), verboseStats, cpuTimerEnabled); return createSqlTaskExecution( taskStateMachine, taskContext, sharedBuffer, fragment, sources, planner, taskExecutor, taskNotificationExecutor, queryMonitor); }
private static DistributedQueryRunner createQueryRunner() throws Exception { Session session = testSessionBuilder() .setSource("test") .setCatalog("tpch") .setSchema("tiny") .build(); DistributedQueryRunner queryRunner = new DistributedQueryRunner(session, 4, ImmutableMap.of("optimizer.optimize-hash-generation", "false")); try { queryRunner.installPlugin(new TpchPlugin()); queryRunner.createCatalog("tpch", "tpch"); queryRunner.installPlugin(new SampledTpchPlugin()); queryRunner.createCatalog("tpch_sampled", "tpch_sampled"); return queryRunner; } catch (Exception e) { queryRunner.close(); throw e; } }
/** * Returns list of queues to enter, or null if query does not match rule */ public List<QueryQueueDefinition> match(Session session) { if (userRegex != null && !userRegex.matcher(session.getUser()).matches()) { return null; } if (sourceRegex != null) { String source = session.getSource().orElse(""); if (!sourceRegex.matcher(source).matches()) { return null; } } for (Map.Entry<String, Pattern> entry : sessionPropertyRegexes.entrySet()) { String value = session.getSystemProperties().getOrDefault(entry.getKey(), ""); if (!entry.getValue().matcher(value).matches()) { return null; } } return queues; }
@Override public DataDefinitionExecution<?> createQueryExecution( QueryId queryId, String query, Session session, Statement statement) { URI self = locationFactory.createQueryLocation(queryId); DataDefinitionTask<Statement> task = getTask(statement); checkArgument(task != null, "no task for statement: %s", statement.getClass().getSimpleName()); QueryStateMachine stateMachine = QueryStateMachine.begin(queryId, query, session, self, task.isTransactionControl(), transactionManager, executor); stateMachine.setUpdateType(task.getName()); return new DataDefinitionExecution<>(task, statement, transactionManager, metadata, accessControl, stateMachine); }
@Test public void testNameExpansion() { Session session = TestingSession.testSessionBuilder() .setIdentity(new Identity("bob", Optional.empty())) .setSource("the-internet") .build(); QueryQueueDefinition definition = new QueryQueueDefinition("user.${USER}", 1, 1); assertEquals(definition.getExpandedTemplate(session), "user.bob"); definition = new QueryQueueDefinition("source.${SOURCE}", 1, 1); assertEquals(definition.getExpandedTemplate(session), "source.the-internet"); definition = new QueryQueueDefinition("${USER}.${SOURCE}", 1, 1); assertEquals(definition.getExpandedTemplate(session), "bob.the-internet"); definition = new QueryQueueDefinition("global", 1, 1); assertEquals(definition.getExpandedTemplate(session), "global"); }
private InternalTable buildTables(Session session, String catalogName, Map<String, NullableValue> filters) { Set<QualifiedObjectName> tables = ImmutableSet.copyOf(getTablesList(session, catalogName, filters)); Set<QualifiedObjectName> views = ImmutableSet.copyOf(getViewsList(session, catalogName, filters)); InternalTable.Builder table = InternalTable.builder(informationSchemaTableColumns(TABLE_TABLES)); for (QualifiedObjectName name : union(tables, views)) { // if table and view names overlap, the view wins String type = views.contains(name) ? "VIEW" : "BASE TABLE"; table.add( name.getCatalogName(), name.getSchemaName(), name.getObjectName(), type); } return table.build(); }
@Test public void testStartTransactionExplicitModes() throws Exception { Session session = sessionBuilder() .setClientTransactionSupport() .build(); TransactionManager transactionManager = createTestTransactionManager(); QueryStateMachine stateMachine = QueryStateMachine.begin(new QueryId("query"), "START TRANSACTION", session, URI.create("fake://uri"), true, transactionManager, executor); Assert.assertFalse(stateMachine.getSession().getTransactionId().isPresent()); new StartTransactionTask().execute(new StartTransaction(ImmutableList.of(new Isolation(Isolation.Level.SERIALIZABLE), new TransactionAccessMode(true))), transactionManager, metadata, new AllowAllAccessControl(), stateMachine).join(); Assert.assertFalse(stateMachine.getQueryInfoWithoutDetails().isClearTransactionId()); Assert.assertTrue(stateMachine.getQueryInfoWithoutDetails().getStartedTransactionId().isPresent()); Assert.assertEquals(transactionManager.getAllTransactionInfos().size(), 1); TransactionInfo transactionInfo = transactionManager.getTransactionInfo(stateMachine.getQueryInfoWithoutDetails().getStartedTransactionId().get()); Assert.assertEquals(transactionInfo.getIsolationLevel(), IsolationLevel.SERIALIZABLE); Assert.assertTrue(transactionInfo.isReadOnly()); Assert.assertFalse(transactionInfo.isAutoCommitContext()); }
@Test public void testCreateSession() throws Exception { 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_SESSION, QUERY_MAX_MEMORY + "=1GB") .put(PRESTO_SESSION, DISTRIBUTED_JOIN + "=true," + HASH_PARTITION_COUNT + " = 43") .build(), "testRemote"); Session session = createSessionForRequest(request, new AllowAllAccessControl(), new SessionPropertyManager(), new QueryId("test_query_id")); assertEquals(session.getQueryId(), new QueryId("test_query_id")); assertEquals(session.getUser(), "testUser"); assertEquals(session.getSource().get(), "testSource"); assertEquals(session.getCatalog().get(), "testCatalog"); assertEquals(session.getSchema().get(), "testSchema"); assertEquals(session.getLocale(), Locale.TAIWAN); assertEquals(session.getTimeZoneKey(), getTimeZoneKey("Asia/Taipei")); assertEquals(session.getRemoteUserAddress().get(), "testRemote"); assertEquals(session.getSystemProperties(), ImmutableMap.<String, String>builder() .put(QUERY_MAX_MEMORY, "1GB") .put(DISTRIBUTED_JOIN, "true") .put(HASH_PARTITION_COUNT, "43") .build()); }
public KafkaLoader(Producer<Long, Object> producer, String topicName, TestingPrestoServer prestoServer, Session defaultSession) { super(prestoServer, defaultSession); this.topicName = topicName; this.producer = producer; }
public Visitor(Metadata metadata, Session session, Map<Symbol, Type> types, SqlParser parser) { this.metadata = metadata; this.session = session; this.types = types; this.parser = parser; }
public static TaskContext createTaskContext(Executor executor, Session session) { return createTaskContext( checkNotSameThreadExecutor(executor, "executor is null"), session, new DataSize(256, MEGABYTE)); }
@Override public Optional<ColumnHandle> getSampleWeightColumnHandle(Session session, TableHandle tableHandle) { requireNonNull(tableHandle, "tableHandle is null"); ConnectorEntry entry = lookupConnectorFor(tableHandle); ConnectorMetadata metadata = entry.getMetadata(session); ColumnHandle handle = metadata.getSampleWeightColumnHandle(session.toConnectorSession(entry.getCatalog()), tableHandle.getConnectorHandle()); return Optional.ofNullable(handle); }
private static Session createSession(String schema) { return testSessionBuilder() .setCatalog("raptor") .setSchema(schema) .setSystemProperties(ImmutableMap.of("columnar_processing_dictionary", "true", "dictionary_aggregation", "true")) .build(); }
private boolean getVerboseStats(Session session) { String verboseStats = session.getSystemProperties().get(VERBOSE_STATS_PROPERTY); if (verboseStats == null) { return this.verboseStats; } try { return Boolean.valueOf(verboseStats.toUpperCase()); } catch (IllegalArgumentException e) { throw new PrestoException(NOT_SUPPORTED, "Invalid property '" + VERBOSE_STATS_PROPERTY + "=" + verboseStats + "'"); } }
@Override public Optional<ResolvedIndex> resolveIndex(Session session, TableHandle tableHandle, Set<ColumnHandle> indexableColumns, Set<ColumnHandle> outputColumns, TupleDomain<ColumnHandle> tupleDomain) { ConnectorEntry entry = lookupConnectorFor(tableHandle); ConnectorMetadata metadata = entry.getMetadata(session); ConnectorTransactionHandle transaction = entry.getTransactionHandle(session); ConnectorSession connectorSession = session.toConnectorSession(entry.getCatalog()); Optional<ConnectorResolvedIndex> resolvedIndex = metadata.resolveIndex(connectorSession, tableHandle.getConnectorHandle(), indexableColumns, outputColumns, tupleDomain); return resolvedIndex.map(resolved -> new ResolvedIndex(tableHandle.getConnectorId(), transaction, resolved)); }
private Rewriter(SymbolAllocator symbolAllocator, PlanNodeIdAllocator idAllocator, Metadata metadata, Session session) { this.symbolAllocator = requireNonNull(symbolAllocator, "symbolAllocator is null"); this.idAllocator = requireNonNull(idAllocator, "idAllocator is null"); this.metadata = requireNonNull(metadata, "metadata is null"); this.session = requireNonNull(session, "session is null"); }
@Test public void fieldLength() { Session session = testSessionBuilder() .setCatalog("blackhole") .setSchema("default") .build(); assertThatQueryReturnsValue( format("CREATE TABLE nation WITH ( %s = 8, %s = 1, %s = 1, %s = 1 ) as SELECT * FROM tpch.tiny.nation", FIELD_LENGTH_PROPERTY, ROWS_PER_PAGE_PROPERTY, PAGES_PER_SPLIT_PROPERTY, SPLIT_COUNT_PROPERTY), 25L, session); MaterializedResult rows = queryRunner.execute(session, "SELECT * FROM nation"); assertEquals(rows.getRowCount(), 1); MaterializedRow row = Iterables.getOnlyElement(rows); assertEquals(row.getFieldCount(), 4); assertEquals(row.getField(0), 0L); assertEquals(row.getField(1), "********"); assertEquals(row.getField(2), 0L); assertEquals(row.getField(3), "********"); assertThatQueryReturnsValue("DROP TABLE nation", true); }
public static void copyTpchTables( QueryRunner queryRunner, String sourceCatalog, String sourceSchema, Session session, Iterable<TpchTable<?>> tables) throws Exception { log.info("Loading data from %s.%s...", sourceCatalog, sourceSchema); long startTime = System.nanoTime(); for (TpchTable<?> table : tables) { copyTable(queryRunner, sourceCatalog, sourceSchema, table.getTableName().toLowerCase(ENGLISH), session); } log.info("Loading from %s.%s complete in %s", sourceCatalog, sourceSchema, nanosSince(startTime).toString(SECONDS)); }
public Analyzer(Session session, Metadata metadata, SqlParser sqlParser, AccessControl accessControl, Optional<QueryExplainer> queryExplainer, boolean experimentalSyntaxEnabled) { this.session = requireNonNull(session, "session is null"); this.metadata = requireNonNull(metadata, "metadata is null"); this.sqlParser = requireNonNull(sqlParser, "sqlParser is null"); this.accessControl = requireNonNull(accessControl, "accessControl is null"); this.queryExplainer = requireNonNull(queryExplainer, "query explainer is null"); this.experimentalSyntaxEnabled = experimentalSyntaxEnabled; }
public Rewriter(SymbolAllocator allocator, PlanNodeIdAllocator idAllocator, SymbolAllocator symbolAllocator, Session session, boolean distributedIndexJoins, boolean distributedJoins, boolean preferStreamingOperators, boolean redistributeWrites) { this.allocator = allocator; this.idAllocator = idAllocator; this.symbolAllocator = symbolAllocator; this.session = session; this.distributedIndexJoins = distributedIndexJoins; this.distributedJoins = distributedJoins; this.preferStreamingOperators = preferStreamingOperators; this.redistributeWrites = redistributeWrites; }
@Override public ConnectorPageSink createPageSink(Session session, InsertTableHandle tableHandle) { // assumes connectorId and catalog are the same ConnectorSession connectorSession = session.toConnectorSession(tableHandle.getConnectorId()); return providerFor(tableHandle.getConnectorId()).createPageSink(tableHandle.getTransactionHandle(), connectorSession, tableHandle.getConnectorHandle()); }
private QueryStateMachine(QueryId queryId, String query, Session session, URI self, boolean autoCommit, TransactionManager transactionManager, Executor executor) { this.queryId = requireNonNull(queryId, "queryId is null"); this.query = requireNonNull(query, "query is null"); this.session = requireNonNull(session, "session is null"); this.self = requireNonNull(self, "self is null"); this.autoCommit = autoCommit; this.transactionManager = requireNonNull(transactionManager, "transactionManager is null"); this.queryState = new StateMachine<>("query " + query, executor, QUEUED, TERMINAL_QUERY_STATES); }
public static Session createCassandraSession(String schema) { return testSessionBuilder() .setCatalog("cassandra") .setSchema(schema) .build(); }