* @param pfs an array of synthesized plan fragments
* @param aggregatorOutputDependencyId dependency id produced by the aggregation pf
* The id of the table returned as the result of this procedure.
*/
protected final VoltTable[] executeSysProcPlanFragmentsAsync(SynthesizedPlanFragment pfs[]) {
LocalTransaction ts = this.getTransactionState();
if (debug.val) LOG.debug(ts + " - Preparing to execute " + pfs.length + " sysproc fragments");
this.fragments.clear();
ParameterSet parameters[] = new ParameterSet[pfs.length];
for (int i = 0; i < pfs.length; i++) {
SynthesizedPlanFragment pf = pfs[i];
// check mutually exclusive flags
assert(!(pf.multipartition && pf.nonExecSites));
assert(pf.parameters != null);
// We'll let the PartitionExecutor decide how to serialize our ParameterSets
parameters[i] = pf.parameters;
// If the multipartition flag is set to true and we don't have a destPartitionId,
// then we'll just make it go to all partitions. This is so that we can support
// old-school VoltDB's sysprocs
int partitions[] = null;
if (pf.destPartitionId < 0) {
if (pf.multipartition) {
partitions = CollectionUtil.toIntArray(catalogContext.getAllPartitionIds());
}
// If it's not multipartitioned and they still don't have a destPartitionId,
// then we'll make it just go to this PartitionExecutor's local partition
else {
partitions = new int[]{ this.executor.getPartitionId() };
}
if (debug.val) LOG.debug(this.getClass() + " => " + Arrays.toString(partitions));
}
else {
partitions = new int[]{ pf.destPartitionId };
}
// Create a WorkFragment for each target partition
for (int destPartitionId : partitions) {
if (debug.val)
LOG.debug(String.format("%s - Creating %s for partition %s [fragmentId=%d]",
ts, WorkFragment.class.getSimpleName(),
destPartitionId, pf.fragmentId));
WorkFragment.Builder builder = WorkFragment.newBuilder()
.setPartitionId(destPartitionId)
.setReadOnly(false)
.setLastFragment(pf.last_task)
.addFragmentId(pf.fragmentId)
.addStmtCounter(0)
.addStmtIndex(0)
.addStmtIgnore(false)
.addParamIndex(i);
ts.getTouchedPartitions().put(destPartitionId);
boolean needs_input = false;
for (int ii = 0; ii < pf.outputDependencyIds.length; ii++) {
// Input Dependencies
if (pf.inputDependencyIds != null && ii < pf.inputDependencyIds.length) {