Package com.foundationdb.server.explain

Examples of com.foundationdb.server.explain.Explainable


            if (transaction == null) {
                transaction = new ServerTransaction(this, true, ServerTransaction.PeriodicallyCommit.OFF);
                localTransaction = true;
            }
            ExplainPlanContext context = new ExplainPlanContext(compiler, new EmbeddedQueryContext(this));
            Explainable explainable;
            if ((sqlStmt instanceof DMLStatementNode) &&
                !(sqlStmt instanceof CallStatementNode))
                explainable = compiler.compile((DMLStatementNode)sqlStmt, parser.getParameterList(), context).getPlannable();
            else
                throw new UnsupportedSQLException("Statement not supported for EXPLAIN", sqlStmt);
            return explainable.getExplainer(context.getExplainContext());
        }
        finally {
            sessionMonitor.leaveStage();
            if (localTransaction)
                rollbackTransaction();
View Full Code Here


    public static Explainable explainable(PostgresServerSession server,
                                          final ServerCallInvocation invocation) {
        final LoadablePlan<?> loadablePlan =
            server.getRoutineLoader().loadLoadablePlan(server.getSession(),
                                                       invocation.getRoutineName());
        return new Explainable() {
                @Override
                public CompoundExplainer getExplainer(ExplainContext context) {
                    Attributes atts = new Attributes();
                    atts.put(Label.PROCEDURE_IMPLEMENTATION,
                             PrimitiveExplainer.getInstance(loadablePlan.getClass().getName()));
View Full Code Here

        ExplainPlanContext context = new ExplainPlanContext(compiler, new PostgresQueryContext(server, this.schema));
        ExplainStatementNode explainStmt = (ExplainStatementNode)stmt;
        StatementNode innerStmt = explainStmt.getStatement();
        if (params == null)
            params = new ParameterFinder().find(innerStmt);
        Explainable explainable;
        if (innerStmt instanceof CallStatementNode) {
            explainable = PostgresCallStatementGenerator.explainable(server, (CallStatementNode)innerStmt, params, paramTypes);
        }
        else {
            BasePlannable result = compiler.compile((DMLStatementNode)innerStmt, params, context);
            explainable = result.getPlannable();
        }
        List<String> explain;
        if (compiler instanceof PostgresJsonCompiler) {
            JsonFormatter f = new JsonFormatter();
            explain = Collections.singletonList(f.format(explainable.getExplainer(context.getExplainContext())));
        }
        else {
            DefaultFormatter.LevelOfDetail detail;
            switch (explainStmt.getDetail()) {
            case BRIEF:
                detail = DefaultFormatter.LevelOfDetail.BRIEF;
                break;
            default:
            case NORMAL:
                detail = DefaultFormatter.LevelOfDetail.NORMAL;
                break;
            case VERBOSE:
                detail = DefaultFormatter.LevelOfDetail.VERBOSE;
                break;
            }
            DefaultFormatter f = new DefaultFormatter(server.getDefaultSchemaName(), detail);
            explain = f.format(explainable.getExplainer(context.getExplainContext()));
        }
        init(explain);
        compiler = null;
        return this;
    }
View Full Code Here

TOP

Related Classes of com.foundationdb.server.explain.Explainable

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.