}
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);