Package org.voltdb.VoltProcedure

Examples of org.voltdb.VoltProcedure.VoltAbortException


     * @throws VoltAbortException
     */
    public void loadTable(AbstractTransaction ts, String clusterName, String databaseName, String tableName, VoltTable data, int allowELT) throws VoltAbortException {
        Table table = this.catalogContext.database.getTables().getIgnoreCase(tableName);
        if (table == null) {
            throw new VoltAbortException("Table '" + tableName + "' does not exist in database " + clusterName + "." + databaseName);
        }
        if (data == null || data.getRowCount() == 0) {
            return;
        }
       
View Full Code Here


                VoltTable vt = res[0];
               
                // deal with the VoltTable and try to ...
                if (!vt.advanceRow() ) {
                    String msg = "No result for the GetPageAnonymous stored procedure";
                    throw new VoltAbortException(msg);
                }

                String vt_userText = vt.getString("USER_TEXT");
                long vt_pageId = vt.getLong("PAGE_ID");
                String vt_pageTitle = vt.getString("PAGE_TITLE");
View Full Code Here

        }

        try {
            AdHocPlannedStmtBatch batch = m_csp.plan(sql, args,m_isSinglePartition).get();
            if (batch.errorMsg != null) {
                throw new VoltAbortException("Failed to plan sql '" + sql + "' error: " + batch.errorMsg);
            }

            if (m_isReadOnly && !batch.isReadOnly()) {
                throw new VoltAbortException("Attempted to queue DML adhoc sql '" + sql + "' from read only procedure");
            }

            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);
                    throw new VoltAbortException(msg);
                }
            }
            queuedSQL.params = getCleanParams(queuedSQL.stmt, argumentParams);

            updateCRC(queuedSQL);
            m_batch.add(queuedSQL);
        }
        catch (Exception e) {
            if (e instanceof ExecutionException) {
                throw new VoltAbortException(e.getCause());
            }
            if (e instanceof VoltAbortException) {
                throw (VoltAbortException) e;
            }
            throw new VoltAbortException(e);
        }
    }
View Full Code Here

            return m_site.loadTable(m_txnState.txnId, m_txnState.m_spHandle,
                             clusterName, databaseName,
                             tableName, data, returnUniqueViolations, shouldDRStream, false);
        }
        catch (EEException e) {
            throw new VoltAbortException("Failed to load table: " + tableName);
        }
    }
View Full Code Here

    private final ParameterSet getCleanParams(SQLStmt stmt, Object... inArgs) {
        final int numParamTypes = stmt.statementParamJavaTypes.length;
        final byte stmtParamTypes[] = stmt.statementParamJavaTypes;
        final Object[] args = new Object[numParamTypes];
        if (inArgs.length != numParamTypes) {
            throw new VoltAbortException(
                    "Number of arguments provided was " + inArgs.length  +
                    " where " + numParamTypes + " was expected for statement " + stmt.getText());
        }
        for (int ii = 0; ii < numParamTypes; ii++) {
            // this handles non-null values
            if (inArgs[ii] != null) {
                args[ii] = inArgs[ii];
                continue;
            }
            // this handles null values
            VoltType type = VoltType.get(stmtParamTypes[ii]);
            if (type == VoltType.TINYINT) {
                args[ii] = Byte.MIN_VALUE;
            } else if (type == VoltType.SMALLINT) {
                args[ii] = Short.MIN_VALUE;
            } else if (type == VoltType.INTEGER) {
                args[ii] = Integer.MIN_VALUE;
            } else if (type == VoltType.BIGINT) {
                args[ii] = Long.MIN_VALUE;
            } else if (type == VoltType.FLOAT) {
                args[ii] = VoltType.NULL_FLOAT;
            } else if (type == VoltType.TIMESTAMP) {
                args[ii] = new TimestampType(Long.MIN_VALUE);
            } else if (type == VoltType.STRING) {
                args[ii] = VoltType.NULL_STRING_OR_VARBINARY;
            } else if (type == VoltType.VARBINARY) {
                args[ii] = VoltType.NULL_STRING_OR_VARBINARY;
            } else if (type == VoltType.DECIMAL) {
                args[ii] = VoltType.NULL_DECIMAL;
            } else {
                throw new VoltAbortException("Unknown type " + type +
                        " can not be converted to NULL representation for arg " + ii +
                        " for SQL stmt: " + stmt.getText());
            }
        }
View Full Code Here

        VoltTable[] results = voltExecuteSQL(true);
        VoltTable data = results[1];
        VoltTableRow row = data.fetchRow(0);
        long optCount = row.getLong(0);
        if (optCount != 0) {
            throw new VoltAbortException("after truncate (opt) count not zero");
        }
        data = results[2];
        row = data.fetchRow(0);
        long scanCount = row.getLong(0);
        if (scanCount != 0) {
            throw new VoltAbortException("after truncate (scan) count not zero");
        }
        if (shouldRollback != 0) {
            throw new VoltAbortException("EXPECTED ROLLBACK");
        }
        return results;
    }
View Full Code Here

        VoltTable[] results = voltExecuteSQL(true);
        VoltTable data = results[1];
        VoltTableRow row = data.fetchRow(0);
        long optCount = row.getLong(0);
        if (optCount != 0) {
            throw new VoltAbortException("after truncate (opt) count not zero");
        }
        data = results[2];
        row = data.fetchRow(0);
        long scanCount = row.getLong(0);
        if (scanCount != 0) {
            throw new VoltAbortException("after truncate (scan) count not zero");
        }
        if (shouldRollback != 0) {
            throw new VoltAbortException("EXPECTED ROLLBACK");
        }
        return results;
    }
View Full Code Here

    public VoltTable[] run(long p, byte shouldRollback) {
        voltQueueSQL(max);
        VoltTable[] results = voltExecuteSQL(true);
        if (results[0].getRowCount() != 1) {
            throw new VoltAbortException("rowcount for max is not one");
        }
        if (shouldRollback != 0) {
            throw new VoltAbortException("EXPECTED ROLLBACK");
        }
        return results;
    }
View Full Code Here

    public VoltTable[] run(long p, byte shouldRollback) {
        voltQueueSQL(max);
        VoltTable[] results = voltExecuteSQL(true);
        if (results[0].getRowCount() != 1) {
            throw new VoltAbortException("rowcount for max is not one");
        }
        if (shouldRollback != 0) {
            throw new VoltAbortException("EXPECTED ROLLBACK");
        }
        return results;
    }
View Full Code Here

        VoltTable[] results = voltExecuteSQL(true);
        VoltTable data = results[1];
        VoltTableRow row = data.fetchRow(0);
        long optCount = row.getLong(0);
        if (optCount != 0) {
            throw new VoltAbortException("after truncate (opt) count not zero");
        }
        data = results[2];
        row = data.fetchRow(0);
        long scanCount = row.getLong(0);
        if (scanCount != 0) {
            throw new VoltAbortException("after truncate (scan) count not zero");
        }
        if (shouldRollback != 0) {
            throw new VoltAbortException("EXPECTED ROLLBACK");
        }
        return results;
    }
View Full Code Here

TOP

Related Classes of org.voltdb.VoltProcedure.VoltAbortException

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.