• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Session类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.facebook.presto.Session的典型用法代码示例。如果您正苦于以下问题:Java Session类的具体用法?Java Session怎么用?Java Session使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Session类属于com.facebook.presto包,在下文中一共展示了Session类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: createLocalQueryRunner

import com.facebook.presto.Session; //导入依赖的package包/类
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;
}
 
开发者ID:prestodb-rocks,项目名称:presto-rest,代码行数:19,代码来源:TestSlackQueries.java


示例2: createLocalQueryRunner

import com.facebook.presto.Session; //导入依赖的package包/类
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;
}
 
开发者ID:prestodb-rocks,项目名称:presto-rest,代码行数:19,代码来源:TestGithubQueries.java


示例3: createLocalQueryRunner

import com.facebook.presto.Session; //导入依赖的package包/类
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;
}
 
开发者ID:prestodb-rocks,项目名称:presto-rest,代码行数:23,代码来源:TestTwitterQueries.java


示例4: createLocalQueryRunner

import com.facebook.presto.Session; //导入依赖的package包/类
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;
}
 
开发者ID:vitillo,项目名称:presto-hyperloglog,代码行数:24,代码来源:TestHyperLogLogQueries.java


示例5: listTables

import com.facebook.presto.Session; //导入依赖的package包/类
@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);
}
 
开发者ID:y-lan,项目名称:presto,代码行数:17,代码来源:MetadataManager.java


示例6: StatementAnalyzer

import com.facebook.presto.Session; //导入依赖的package包/类
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");
}
 
开发者ID:y-lan,项目名称:presto,代码行数:17,代码来源:StatementAnalyzer.java


示例7: createLocalQueryRunner

import com.facebook.presto.Session; //导入依赖的package包/类
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;
}
 
开发者ID:y-lan,项目名称:presto,代码行数:25,代码来源:RaptorBenchmarkQueryRunner.java


示例8: getGraphvizPlan

import com.facebook.presto.Session; //导入依赖的package包/类
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);
}
 
开发者ID:y-lan,项目名称:presto,代码行数:19,代码来源:QueryExplainer.java


示例9: listViews

import com.facebook.presto.Session; //导入依赖的package包/类
@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);
}
 
开发者ID:y-lan,项目名称:presto,代码行数:17,代码来源:MetadataManager.java


示例10: analyzeExpressionsWithSymbols

import com.facebook.presto.Session; //导入依赖的package包/类
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);
}
 
开发者ID:y-lan,项目名称:presto,代码行数:18,代码来源:ExpressionAnalyzer.java


示例11: translate

import com.facebook.presto.Session; //导入依赖的package包/类
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;
}
 
开发者ID:y-lan,项目名称:presto,代码行数:21,代码来源:SqlToRowExpressionTranslator.java


示例12: Query

import com.facebook.presto.Session; //导入依赖的package包/类
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;
}
 
开发者ID:y-lan,项目名称:presto,代码行数:18,代码来源:StatementResource.java


示例13: execute

import com.facebook.presto.Session; //导入依赖的package包/类
@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);
}
 
开发者ID:y-lan,项目名称:presto,代码行数:27,代码来源:RenameTableTask.java


示例14: createQuery

import com.facebook.presto.Session; //导入依赖的package包/类
@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();
}
 
开发者ID:y-lan,项目名称:presto,代码行数:18,代码来源:ExecuteResource.java


示例15: interpretedFilterProject

import com.facebook.presto.Session; //导入依赖的package包/类
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));
}
 
开发者ID:y-lan,项目名称:presto,代码行数:25,代码来源:FunctionAssertions.java


示例16: getPlan

import com.facebook.presto.Session; //导入依赖的package包/类
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);
}
 
开发者ID:y-lan,项目名称:presto,代码行数:18,代码来源:QueryExplainer.java


示例17: StandaloneQueryRunner

import com.facebook.presto.Session; //导入依赖的package包/类
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);
}
 
开发者ID:y-lan,项目名称:presto,代码行数:24,代码来源:StandaloneQueryRunner.java


示例18: create

import com.facebook.presto.Session; //导入依赖的package包/类
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);
}
 
开发者ID:y-lan,项目名称:presto,代码行数:22,代码来源:SqlTaskExecutionFactory.java


示例19: createQueryRunner

import com.facebook.presto.Session; //导入依赖的package包/类
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;
    }
}
 
开发者ID:y-lan,项目名称:presto,代码行数:26,代码来源:TestDistributedQueriesNoHashGeneration.java


示例20: match

import com.facebook.presto.Session; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:y-lan,项目名称:presto,代码行数:25,代码来源:QueryQueueRule.java



注:本文中的com.facebook.presto.Session类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DynamicAcceptThread类代码示例发布时间:2022-05-22
下一篇:
Java RichInputFormat类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap