Package org.voltdb

Examples of org.voltdb.ParameterSet


                // Get the next phone call
                PhoneCallGenerator.PhoneCall call = switchboard.receive();

                // Use the JSON/HTTP API to synchronously call the "Vote" procedure
                try {
                    ParameterSet pset = ParameterSet.fromArrayNoCopy(call.phoneNumber,
                                                                    call.contestantNumber,
                                                                    config.maxvotes);
                    callProcOverJSON("Vote", pset, username, password, true);
                }
                catch (Exception e) {}
            }

            while (benchmarkComplete.get() == false) {
                // Get the next phone call
                PhoneCallGenerator.PhoneCall call = switchboard.receive();

                // Use the JSON/HTTP API to synchronously call the "Vote" procedure
                try {
                    ParameterSet pset = ParameterSet.fromArrayNoCopy(call.phoneNumber,
                                                                    call.contestantNumber,
                                                                    config.maxvotes);

                    String res = callProcOverJSON("Vote", pset, username, password, true);
                    Response response = responseFromJSON(res);
View Full Code Here


        ActivePlanRepository.clear();
        ActivePlanRepository.addFragmentForTest(
                CatalogUtil.getUniqueIdForFragment(selectBottomFrag),
                Encoder.decodeBase64AndDecompressToBytes(selectBottomFrag.getPlannodetree()),
                selectStmt.getSqltext());
        ParameterSet params = ParameterSet.emptyParameterSet();

        m_ee.executePlanFragments(
                1,
                new long[] { CatalogUtil.getUniqueIdForFragment(selectBottomFrag) },
                null,
View Full Code Here

        ActivePlanRepository.clear();
        ActivePlanRepository.addFragmentForTest(
                CatalogUtil.getUniqueIdForFragment(selectBottomFrag),
                Encoder.decodeBase64AndDecompressToBytes(selectBottomFrag.getPlannodetree()),
                selectStmt.getSqltext());
        ParameterSet params = ParameterSet.emptyParameterSet();

        m_ee.executePlanFragments(
                1,
                new long[] { CatalogUtil.getUniqueIdForFragment(selectBottomFrag) },
                null,
View Full Code Here

        ActivePlanRepository.clear();
        ActivePlanRepository.addFragmentForTest(
                CatalogUtil.getUniqueIdForFragment(selectBottomFrag),
                Encoder.decodeBase64AndDecompressToBytes(selectBottomFrag.getPlannodetree()),
                selectStmt.getSqltext());
        ParameterSet params = ParameterSet.emptyParameterSet();

        m_ee.executePlanFragments(
                1,
                new long[] { CatalogUtil.getUniqueIdForFragment(selectBottomFrag) },
                null,
View Full Code Here

        ActivePlanRepository.clear();
        ActivePlanRepository.addFragmentForTest(
                CatalogUtil.getUniqueIdForFragment(frag),
                Encoder.decodeBase64AndDecompressToBytes(frag.getPlannodetree()),
                sqlText);
        ParameterSet params = ParameterSet.emptyParameterSet();

        // Replace the normal logger with a mocked one, so we can verify the message
        VoltLogger mockedLogger = Mockito.mock(VoltLogger.class);
        ExecutionEngine.setVoltLoggerForTest(mockedLogger);
View Full Code Here

     * and planArrayFromBuffer wih no dummy "AdHocPlannedStmtBatch receiver" instance required.
     */
    public ByteBuffer flattenPlanArrayToBuffer() throws IOException {
        int size = 0; // sizeof batch

        ParameterSet userParamCache = null;
        if (work.userParamSet == null) {
            userParamCache = ParameterSet.emptyParameterSet();
        } else {
            Object[] typedUserParams = new Object[work.userParamSet.length];
            int ii = 0;
            for (AdHocPlannedStatement cs : plannedStatements) {
                for (VoltType paramType : cs.core.parameterTypes) {
                    if (ii >= typedUserParams.length) {
                        String errorMsg =
                            "Too few actual arguments were passed for the parameters in the sql statement(s): (" +
                            typedUserParams.length + " vs. " + ii + ")";
                        // Volt-TYPE-Exception is slightly cheating, here, should there be a more general VoltArgumentException?
                        throw new VoltTypeException(errorMsg);
                    }
                    typedUserParams[ii] =
                            ParameterConverter.tryToMakeCompatible(paramType.classFromType(),
                                                                   work.userParamSet[ii]);
                    // System.out.println("DEBUG typed parameter: " + work.userParamSet[ii] +
                    //         "using type: " + paramType + "as: " + typedUserParams[ii]);
                    ii++;
                }
            }
            // Each parameter referenced in each statements should be represented
            // exactly once in userParams.
            if (ii < typedUserParams.length) {
                // Volt-TYPE-Exception is slightly cheating, here, should there be a more general VoltArgumentException?
                String errorMsg =
                        "Too many actual arguments were passed for the parameters in the sql statement(s): (" +
                        typedUserParams.length + " vs. " + ii + ")";
                        throw new VoltTypeException(errorMsg);
            }
            userParamCache = ParameterSet.fromArrayNoCopy(typedUserParams);
        }
        size += userParamCache.getSerializedSize();

        size += 2; // sizeof batch
        for (AdHocPlannedStatement cs : plannedStatements) {
            size += cs.getSerializedSize();
        }

        ByteBuffer buf = ByteBuffer.allocate(size);
        userParamCache.flattenToBuffer(buf);
        buf.putShort((short) plannedStatements.size());
        for (AdHocPlannedStatement cs : plannedStatements) {
            cs.flattenToBuffer(buf);
        }
        return buf;
View Full Code Here

                // pset can be ByteBuffer or ParameterSet instance
                if (parameterSets[i] instanceof ByteBuffer) {
                    fser.write((ByteBuffer) parameterSets[i]);
                }
                else {
                    ParameterSet pset = (ParameterSet) parameterSets[i];
                    ByteBuffer buf = ByteBuffer.allocate(pset.getSerializedSize());
                    pset.flattenToBuffer(buf);
                    buf.flip();
                    fser.write(buf);
                }
            }
        } catch (final IOException exception) {
View Full Code Here

    }

    @Override
    public int hashinate(Object value, HashinatorConfig config)
    {
        ParameterSet parameterSet = ParameterSet.fromArrayNoCopy(value);
        parameterSet.getSerializedSize(); // in case this memoizes stuff

        m_data.clear();
        m_data.putInt(Commands.Hashinate.m_id);
        m_data.putInt(config.type.typeId());
        m_data.putInt(config.configBytes.length);
        m_data.put(config.configBytes);
        try {
            parameterSet.flattenToBuffer(m_data);

            m_data.flip();
            m_connection.write();

            m_connection.readStatusByte();
View Full Code Here

        {
            final long fragmentId = VoltSystemProcedure.hashToFragId(m_fragmentMsg.getPlanHash(frag));
            // equivalent to dep.depId:
            // final int outputDepId = m_fragmentMsg.getOutputDepId(frag);

            ParameterSet params = m_fragmentMsg.getParameterSetForFragment(frag);

            try {
                // run the overloaded sysproc planfragment. pass an empty dependency
                // set since remote (non-aggregator) fragments don't receive dependencies.
                final DependencyPair dep
View Full Code Here

            if (parameterSets[i] instanceof ByteBuffer) {
                ByteBuffer buf = (ByteBuffer) parameterSets[i];
                psetBuffer.put(buf);
            }
            else {
                ParameterSet pset = (ParameterSet) parameterSets[i];
                try {
                    pset.flattenToBuffer(psetBuffer);
                }
                catch (final IOException exception) {
                    throw new RuntimeException("Error serializing parameters for SQL batch element: " +
                                               i + " with plan fragment ID: " + planFragmentIds[i] +
                                               " and with params: " +
                                               pset.toJSONString(), exception);
                }
            }
        }
        // checkMaxFsSize();
View Full Code Here

TOP

Related Classes of org.voltdb.ParameterSet

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.