Package org.voltdb

Examples of org.voltdb.ParameterSet


    // We're going to use this fragment task to generate a null distributed
    // fragment to serialize Completion and Borrow messages.  Create an empty
    // fragment with the provided outputDepId
    public void setEmptyForRestart(int outputDepId) {
        m_emptyForRestart = true;
        ParameterSet blank = ParameterSet.emptyParameterSet();
        ByteBuffer mt = ByteBuffer.allocate(blank.getSerializedSize());
        try {
            blank.flattenToBuffer(mt);
        }
        catch (IOException ioe) {
            // Shouldn't ever happen, just bail out to not-obviously equivalent behavior
            mt = ByteBuffer.allocate(2);
            mt.putShort((short)0);
View Full Code Here


        assert(item != null);
        return item.m_parameterSet.asReadOnlyBuffer();
    }

    public ParameterSet getParameterSetForFragment(int index) {
        ParameterSet params = null;
        final ByteBuffer paramData = m_items.get(index).m_parameterSet.asReadOnlyBuffer();
        if (paramData != null) {
            try {
                params = ParameterSet.fromByteBuffer(paramData);
            }
View Full Code Here

        @Override
        public String toString() {
            StringBuilder sb = new StringBuilder();
            sb.append(String.format("FRAGMENT PLAN HASH: %s\n", Encoder.hexEncode(m_planHash)));
            if (m_parameterSet != null) {
                ParameterSet pset = null;
                try {
                    pset = ParameterSet.fromByteBuffer(m_parameterSet.asReadOnlyBuffer());
                } catch (IOException e) {
                    e.printStackTrace();
                }
                assert(pset != null);
                sb.append("\n  ").append(pset.toString());
            }
            if (m_outputDepId != null) {
                sb.append("\n");
                sb.append("  OUTPUT_DEPENDENCY_ID ");
                sb.append(m_outputDepId);
View Full Code Here

    public void testFragmentTaskWithTwoFrags() throws IOException {
        Object[] params1 = {10, 10.1};
        Object[] params2 = {20, 20.2};

        ParameterSet param_set1 = ParameterSet.fromArrayNoCopy(params1);
        ParameterSet param_set2 = ParameterSet.fromArrayNoCopy(params2);

        ByteBuffer param1_buf = ByteBuffer.allocate(param_set1.getSerializedSize());
        param_set1.flattenToBuffer(param1_buf);
        param1_buf.flip();

        ByteBuffer param2_buf = ByteBuffer.allocate(param_set2.getSerializedSize());
        param_set2.flattenToBuffer(param2_buf);
        param2_buf.flip();

        FragmentTaskMessage ft = new FragmentTaskMessage(9, 70654312, -75, 99, true, true, false);
        ft.addFragment(new byte[20], 12, param1_buf);
        ft.addFragment(new byte[20], 24, param2_buf);
        ft.setFragmentTaskType(FragmentTaskMessage.SYS_PROC_PER_PARTITION);

        FragmentTaskMessage ft2 = (FragmentTaskMessage) checkVoltMessage(ft);

        assertEquals(ft.getInitiatorHSId(), ft2.getInitiatorHSId());
        assertEquals(ft.getCoordinatorHSId(), ft2.getCoordinatorHSId());
        assertEquals(ft.getTxnId(), ft2.getTxnId());
        assertEquals(ft.getUniqueId(), ft2.getUniqueId());
        assertEquals(ft.isReadOnly(), ft2.isReadOnly());
        assertEquals(ft.isForReplay(), ft2.isForReplay());

        assertEquals(ft.getFragmentCount(), ft2.getFragmentCount());

        assertEquals(ft.isFinalTask(), ft2.isFinalTask());
        assertEquals(ft.isSysProcTask(), ft2.isSysProcTask());

        assertEquals(2, ft2.getFragmentCount());
        ParameterSet params = null;
        ByteBuffer paramData = ft2.getParameterDataForFragment(0);
        if (paramData != null) {
            params = ParameterSet.fromByteBuffer(paramData);
            assertEquals(10, params.toArray()[0]);
            assertEquals(10.1, params.toArray()[1]);
        }

        params = null;
        paramData = ft2.getParameterDataForFragment(1);
        if (paramData != null) {
            params = ParameterSet.fromByteBuffer(paramData);
            assertEquals(20, params.toArray()[0]);
            assertEquals(20.2, params.toArray()[1]);
        }
    }
View Full Code Here

                                             boolean singlePart, long destHSId)
    {
        // Mock an invocation for MockSPName.
        StoredProcedureInvocation spi = mock(StoredProcedureInvocation.class);
        when(spi.getProcName()).thenReturn(MockSPName);
        ParameterSet bleh = mock(ParameterSet.class);
        when(spi.getParams()).thenReturn(bleh);
        Iv2InitiateTaskMessage task =
            new Iv2InitiateTaskMessage(destHSId, // initHSID
                                       Long.MIN_VALUE, // coordHSID
                                       txnId - 1, // truncationHandle
View Full Code Here

                                break;
                            }
                        }
                        if (matched != null) {
                            CorePlan core = matched.m_core;
                            ParameterSet params = planner.extractedParamValues(core.parameterTypes);
                            AdHocPlannedStatement ahps = new AdHocPlannedStatement(sql.getBytes(Constants.UTF8ENCODING),
                                                                                   core,
                                                                                   params,
                                                                                   null);
                            ahps.setBoundConstants(matched.m_constants);
View Full Code Here

        short sqlLength = buf.getShort();
        byte[] sql = new byte[sqlLength];
        buf.get(sql);

        // params
        ParameterSet parameterSet = ParameterSet.fromByteBuffer(buf);

        return new AdHocPlannedStatement(sql, core, parameterSet, null);
    }
View Full Code Here

        List<Integer> depsToResume;
    }

    ByteBuffer createDummyParameterSet() throws IOException
    {
        ParameterSet blah = ParameterSet.fromArrayNoCopy(new Long(4321), new Long(5678));
        ByteBuffer params = ByteBuffer.allocate(blah.getSerializedSize());
        blah.flattenToBuffer(params);
        params.flip();
        return params;
    }
View Full Code Here

    }

    private Iv2InitiateTaskMessage makeIv2InitiateTaskMsg(boolean readOnly)
    {
        StoredProcedureInvocation spi = mock(StoredProcedureInvocation.class);
        ParameterSet ps = mock(ParameterSet.class);
        when(spi.getParams()).thenReturn(ps);
        Iv2InitiateTaskMessage msg =
            new Iv2InitiateTaskMessage(0l, 0l, 0l, Long.MIN_VALUE, 0l, readOnly, true, spi,
                    0l, 0l, false);
        return msg;
View Full Code Here

        System.out.println(HORIZONTAL_RULE);

        System.out.println("\nPopulating Static Tables\n");

        // initialize using JSON over HTTP call
        ParameterSet pset = ParameterSet.fromArrayNoCopy(config.contestants, CONTESTANT_NAMES_CSV);
        String res = callProcOverJSON("Initialize", pset, "myadmin", "voltdbadmin", false);
        System.out.println("JSON response INITIALIZE: " + res);

        System.out.print(HORIZONTAL_RULE);
        System.out.println(" Starting Benchmark");
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.