本文整理匯總了Java中org.voltdb.ParameterSet.toArray方法的典型用法代碼示例。如果您正苦於以下問題:Java ParameterSet.toArray方法的具體用法?Java ParameterSet.toArray怎麽用?Java ParameterSet.toArray使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.voltdb.ParameterSet
的用法示例。
在下文中一共展示了ParameterSet.toArray方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: executePlanFragment
import org.voltdb.ParameterSet; //導入方法依賴的package包/類
@Override
public DependencySet executePlanFragment(Long txn_id,
Map<Integer, List<VoltTable>> dependencies,
int fragmentId,
ParameterSet params,
PartitionExecutor.SystemProcedureExecutionContext context) {
// Nothing to do
System.out.println("executePlanFragment!!! in get configuration");
assert(fragmentId == SysProcFragmentId.PF_getConfiguration);
HStoreConf hstore_conf = executor.getHStoreConf();
String confNames[] = (String[])params.toArray();
for (int i = 0; i < confNames.length; i++) {
if (hstore_conf.hasParameter((String)params.toArray()[i]) == false) {
String msg = String.format("Invalid configuration parameter '%s'", confNames[i]);
throw new VoltAbortException(msg);
}
} // FOR
VoltTable vt = new VoltTable(nodeResultsColumns);
TimestampType timestamp = new TimestampType();
for (int i = 0; i < confNames.length; i++) {
Object val = hstore_conf.get(confNames[i]);
vt.addRow(executor.getSiteId(),
confNames[i],
val.toString(),
timestamp);
} // FOR
DependencySet result = new DependencySet(SysProcFragmentId.PF_getConfiguration, vt);
return (result);
}
示例2: testStringsAsByteArray
import org.voltdb.ParameterSet; //導入方法依賴的package包/類
public void testStringsAsByteArray() throws IOException {
params = new ParameterSet();
params.setParameters(new Object[]{new byte[]{'f', 'o', 'o'}});
ByteBuffer buf = ByteBuffer.wrap(FastSerializer.serialize(params));
buf.rewind();
ParameterSet out = new ParameterSet();
out.readExternal(new FastDeserializer(buf));
assertEquals(1, out.toArray().length);
byte[] bin = (byte[]) out.toArray()[0];
assertEquals(bin[0], 'f'); assertEquals(bin[1], 'o'); assertEquals(bin[2], 'o');
}
示例3: getValue
import org.voltdb.ParameterSet; //導入方法依賴的package包/類
/**
* Return the corresponding StmtParameter value from the ProcParameter ParameterSet
* using the information provided in the given ParameterMapping.
* @param params
* @param pm
* @return
*/
public static Object getValue(ParameterSet params, ParameterMapping pm) {
Object val = null;
Object orig = params.toArray()[pm.procedure_parameter.getIndex()];
VoltType vtype = VoltType.get(pm.procedure_parameter.getType());
if (pm.procedure_parameter.getIsarray()) {
assert(pm.procedure_parameter_index != ParametersUtil.NULL_PROC_PARAMETER_OFFSET);
switch (vtype) {
case TINYINT: {
if (orig instanceof byte[])
val = ((byte[])orig)[pm.procedure_parameter_index];
else
val = ((Byte[])orig)[pm.procedure_parameter_index];
break;
}
case SMALLINT: {
if (orig instanceof short[])
val = ((short[])orig)[pm.procedure_parameter_index];
else
val = ((Short[])orig)[pm.procedure_parameter_index];
break;
}
case INTEGER: {
if (orig instanceof int[])
val = ((int[])orig)[pm.procedure_parameter_index];
else
val = ((Integer[])orig)[pm.procedure_parameter_index];
break;
}
case BIGINT: {
if (orig instanceof long[])
val = ((long[])orig)[pm.procedure_parameter_index];
else
val = ((Long[])orig)[pm.procedure_parameter_index];
break;
}
case FLOAT: {
if (orig instanceof float[])
val = ((float[])orig)[pm.procedure_parameter_index];
else if (orig instanceof double[])
val = ((double[])orig)[pm.procedure_parameter_index];
else if (orig instanceof Float[])
val = ((Float[])orig)[pm.procedure_parameter_index];
else
val = ((Double[])orig)[pm.procedure_parameter_index];
break;
}
case TIMESTAMP: {
val = ((TimestampType[])orig)[pm.procedure_parameter_index];
break;
}
default:
val = ((Object[])orig)[pm.procedure_parameter_index];
} // SWITCH
} else {
val = params.toArray()[pm.procedure_parameter.getIndex()];
}
return (val);
}
示例4: executePlanFragment
import org.voltdb.ParameterSet; //導入方法依賴的package包/類
@Override
public DependencySet executePlanFragment(Long txn_id, Map<Integer, List<VoltTable>> dependencies, int fragmentId, ParameterSet params, SystemProcedureExecutionContext context) {
// get the three params (depId, json plan, sql stmt)
int outputDepId = (Integer) params.toArray()[0];
String plan = (String) params.toArray()[1];
String sql = (String) params.toArray()[2];
int inputDepId = -1;
// make dependency ids available to the execution engine
if ((dependencies != null) && (dependencies.size() > 00)) {
assert(dependencies.size() <= 1);
for (int x : dependencies.keySet()) {
inputDepId = x; break;
}
context.getExecutionEngine().stashWorkUnitDependencies(dependencies);
}
VoltTable table = null;
if (executor.getBackendTarget() == BackendTarget.HSQLDB_BACKEND) {
// Call HSQLDB
assert(sql != null);
// table = m_hsql.runDML(sql);
}
else
{
assert(plan != null);
// Always mark this information for the txn so that we can
// rollback anything that it may do
AbstractTransaction ts = this.hstore_site.getTransaction(txn_id);
ts.markExecNotReadOnly(this.partitionId);
ts.markExecutedWork(this.partitionId);
table = context.getExecutionEngine().
executeCustomPlanFragment(plan, outputDepId, inputDepId, txn_id,
context.getLastCommittedTxnId(),
ts.getLastUndoToken(this.partitionId));
}
return new DependencySet(new int[]{ outputDepId }, new VoltTable[]{ table });
}