Package org.voltdb.compiler

Examples of org.voltdb.compiler.AdHocPlannedStatement


            }

            assert(1 == batch.plannedStatements.size());

            QueuedSQL queuedSQL = new QueuedSQL();
            AdHocPlannedStatement plannedStatement = batch.plannedStatements.get(0);

            long aggFragId = ActivePlanRepository.loadOrAddRefPlanFragment(
                    plannedStatement.core.aggregatorHash, plannedStatement.core.aggregatorFragment, sql);
            long collectorFragId = 0;
            if (plannedStatement.core.collectorFragment != null) {
                collectorFragId = ActivePlanRepository.loadOrAddRefPlanFragment(
                        plannedStatement.core.collectorHash, plannedStatement.core.collectorFragment, sql);
            }

            queuedSQL.stmt = SQLStmtAdHocHelper.createWithPlan(
                    plannedStatement.sql,
                    aggFragId,
                    plannedStatement.core.aggregatorHash,
                    true,
                    collectorFragId,
                    plannedStatement.core.collectorHash,
                    true,
                    plannedStatement.core.isReplicatedTableDML,
                    plannedStatement.core.readOnly,
                    plannedStatement.core.parameterTypes,
                    m_site);
            Object[] argumentParams = args;
            // case handles if there were parameters OR
            // if there were no constants to pull out
            // In the current scheme, which does not support combining user-provided parameters
            // with planner-extracted parameters in the same statement, an original sql statement
            // containing parameters to match its provided arguments should bypass the parameterizer,
            // so there should be no extracted params.
            // The presence of extracted paremeters AND user-provided arguments can only arise when
            // the arguments have no user-specified parameters in the sql statement
            // to put these arguments to use -- these are invalid, so flag an error.
            // Even the special "partitioning argument" provided to @AdHocSpForTest with no
            // corresponding parameter in the sql should have been noted and discarded by the
            // dispatcher before reaching this ProcedureRunner. This opens the possibility of
            // supporting @AdHocSpForTest with queries that contain '?' parameters.
            if (plannedStatement.hasExtractedParams()) {
                if (args.length > 0) {
                    throw new VoltAbortException(
                            "Number of arguments provided was " + args.length  +
                            " where 0 were expected for statement: " + sql);
                }
                argumentParams = plannedStatement.extractedParamArray();
                if (argumentParams.length != queuedSQL.stmt.statementParamJavaTypes.length) {
                    String msg = String.format(
                            "The wrong number of arguments (" + argumentParams.length +
                            " vs. the " + queuedSQL.stmt.statementParamJavaTypes.length +
                            " expected) were passed for the parameterized statement: %s", sql);
View Full Code Here


        catalog.execute(serializedCatalog);
        CatalogContext context = new CatalogContext(0, 0, catalog, bytes, null, 0, 0);

        m_pt = new PlannerTool(context.cluster, context.database, 0);

        AdHocPlannedStatement result = null;
        result = m_pt.planSqlForTest("select * from warehouse;");
        System.out.println(result);

        // try many tables joins
        try {
View Full Code Here

     */
    @Override
    public int runQueryTest(String query, int hash, int spPartialSoFar,
            int expected, int validatingSPresult) throws IOException,
            NoConnectionsException, ProcCallException {
        AdHocPlannedStatement result = m_pt.planSqlForTest(query);
        boolean spPlan = result.toString().contains("ALL: null");
        if ((validatingSPresult == VALIDATING_SP_RESULT) != spPlan) {
            System.out.println("Missed: "+ query);
            System.out.println(result);
            // This is a good place for a breakpoint,
            // to set this debugging flag and step into the planner,
View Full Code Here

TOP

Related Classes of org.voltdb.compiler.AdHocPlannedStatement

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.