Examples of PlanFragment


Examples of org.voltdb.catalog.PlanFragment

            graph.num_rounds = Math.max(num_fragments, graph.num_rounds);

            // Generate the synthetic DependencyIds for the query
            int last_output_id = HStoreConstants.NULL_DEPENDENCY_ID;
            for (int round = 0, cnt = num_fragments; round < cnt; round++) {
                PlanFragment catalog_frag = fragments.get(round);
                PartitionSet f_partitions = frag_partitions.get(catalog_frag);
                assert (f_partitions != null) :
                    String.format("No PartitionIds for [%02d] %s in Statement #%d", round,
                                  catalog_frag.fullName(), stmt_index);
                boolean f_local = (f_partitions.size() == 1 && f_partitions.contains(plan.base_partition));
                final Integer output_id = Integer.valueOf(this.enable_unique_ids ?
                            BatchPlanner.NEXT_DEPENDENCY_ID.getAndIncrement() : last_id++);

                PlanVertex v = new PlanVertex(catalog_frag,
View Full Code Here

Examples of org.voltdb.catalog.PlanFragment

                orig_catalog_id = target_frag.getName();
            } // FOR

            // Copy PlanFragments
            for (PlanFragment source_frag : source_stmt.getFragments()) {
                PlanFragment target_frag = target_stmt.getFragments().add(source_frag.getName());

                // Copy fields
                for (String field : source_frag.getFields()) {
                    Object value = source_frag.getField(field);
                    if (!(value instanceof CatalogMap)) {
                        CatalogProxy.set(target_frag, field, value);
                    }
                } // FOR

                if (new_catalog_id == null) {
                    new_catalog_id = target_frag.getName();
                    to_remove.add(target_frag.getName());
                    StringBuilder buffer = new StringBuilder();
                    CatalogProxy.writeCommands(target_frag, buffer);
                    fix.put(orig_catalog_id, buffer.toString().replaceAll(source_proc.getName(), target_proc.getName()));
                }
            } // FOR
View Full Code Here

Examples of org.voltdb.catalog.PlanFragment

            sb.append(StringUtil.SINGLE_LINE);
            sb.append(Encoder.hexDecodeToString(((Database)catalog_obj).getSchema()));
        }
        // PLANFRAGMENT
        else if (catalog_obj instanceof PlanFragment) {
            PlanFragment catalog_frgmt = (PlanFragment)catalog_obj;
            try {
                AbstractPlanNode node = PlanNodeUtil.getPlanNodeTreeForPlanFragment(catalog_frgmt);
                sb.append(StringUtil.SINGLE_LINE);
                sb.append(PlanNodeUtil.debug(node));
            } catch (Exception e) {
View Full Code Here

Examples of org.voltdb.catalog.PlanFragment

            assert (copy_src_fragments != null);
            assert (copy_dest_fragments != null);

            copy_dest_fragments.clear();
            for (PlanFragment copy_src_frag : copy_src_fragments) {
                PlanFragment copy_dest_frag = copy_dest_fragments.add(copy_src_frag.getName());
                if (trace.val)
                    LOG.trace(String.format("Copying %s to %s", copy_src_frag.fullName(), copy_dest_frag.fullName()));
                copyFields(copy_src_frag, copy_dest_frag, copy_src_frag.getFields().toArray(new String[0]));
            } // FOR
        }
    }
View Full Code Here

Examples of org.voltdb.catalog.PlanFragment

        Statement catalog_stmt = CollectionUtil.first(catalog_proc.getStatements());
        assert (catalog_stmt != null);

        for (PlanFragment expected : catalog_stmt.getFragments()) {
            int id = expected.getId();
            PlanFragment actual = CatalogUtil.getPlanFragment(expected, id);
            assertNotNull(actual);
            assertEquals(expected, actual);
        } // FOR
        for (PlanFragment expected : catalog_stmt.getMs_fragments()) {
            int id = expected.getId();
            PlanFragment actual = CatalogUtil.getPlanFragment(expected, id);
            assertNotNull(actual);
            assertEquals(expected, actual);
        } // FOR
    }
View Full Code Here

Examples of org.voltdb.catalog.PlanFragment

            assert (copy_src_fragments != null);
            assert (copy_dest_fragments != null);

            for (PlanFragment copy_src_frag : copy_src_fragments) {
                assertNotNull(copy_src_frag);
                PlanFragment copy_dest_frag = copy_dest_fragments.get(copy_src_frag.getName());
                assertNotNull(copy_dest_frag);

                for (String f : copy_src_frag.getFields()) {
                    assertEquals(f, copy_src_frag.getField(f), copy_dest_frag.getField(f));
                } // FOR

                AbstractPlanNode src_root = PlanNodeUtil.getPlanNodeTreeForPlanFragment(copy_src_frag);
                assertNotNull(copy_src_frag.fullName(), src_root);
                AbstractPlanNode dest_root = PlanNodeUtil.getPlanNodeTreeForPlanFragment(copy_dest_frag);
View Full Code Here

Examples of org.voltdb.catalog.PlanFragment

            for (WorkFragment.Builder frag : allFragmentBuilders) {
                if (frag.getPartitionId() != this.partitionId) {
                    has_remote = true;
                }
                for (int frag_id : frag.getFragmentIdList()) {
                    PlanFragment catalog_frag = CatalogUtil.getPlanFragment(catalogContext.database, frag_id);
                    Statement catalog_stmt = catalog_frag.getParent();
                    assert(catalog_stmt != null);
                    Procedure catalog_proc = catalog_stmt.getParent();
                    if (catalog_proc.equals(ts.getProcedure()) == false) {
                        LOG.warn(ts.debug() + "\n" + allFragmentBuilders + "\n---- INVALID ----\n" + frag);
                        String msg = String.format("%s - Unexpected %s", ts, catalog_frag.fullName());
                        throw new ServerFaultException(msg, ts.getTransactionId());
                    }
                }
            } // FOR
            if (has_remote == false) {
View Full Code Here

Examples of org.voltdb.catalog.PlanFragment

            if (ts.isSysProc()) {
                catalog_obj = ts.getProcedure();
            } else {
                for (int i = 0; i < num_fragments; i++) {
                    int frag_id = fragment.getFragmentId(i);
                    PlanFragment catalog_frag = CatalogUtil.getPlanFragment(ts.getProcedure(), frag_id);
                    catalog_obj = catalog_frag.getParent();
                    if (catalog_obj != null) break;
                } // FOR
            }
            LOG.debug(String.format("%s - Queued up %s %s for partition %d and marked as %s [fragIds=%s]",
                      ts, catalog_obj, WorkFragment.class.getSimpleName(), partition,
View Full Code Here

Examples of org.voltdb.catalog.PlanFragment

                boolean fastCombine = false; // FIXME
               
                // Now update our catalog information
                int id = getNextFragmentId(db, readonly, fastAggregate, fastCombine);
                String planFragmentName = Integer.toString(id);
                PlanFragment planFragment = null;
                   
                if (_singleSited) {
                    planFragment = catalogStmt.getFragments().add(planFragmentName);
                    catalogStmt.setHas_singlesited(true);
                    if (trace.val)
                        LOG.trace(String.format("%s SP PLAN FRAGMENT: %s", catalogStmt.fullName(), planFragment));
                } else {
                    planFragment = catalogStmt.getMs_fragments().add(planFragmentName);
                    catalogStmt.setHas_multisited(true);
                    if (trace.val)
                        LOG.trace(String.format("%s DTXN PLAN FRAGMENT: %s", catalogStmt.fullName(), planFragment));
                }
   
                // mark a fragment as non-transactional if it never touches a persistent table
                planFragment.setNontransactional(!fragmentReferencesPersistentTable(fragment.planGraph));
                planFragment.setReadonly(readonly);
                planFragment.setHasdependencies(fragment.hasDependencies);
                planFragment.setMultipartition(fragment.multiPartition);
                planFragment.setId(id);

                String json = null;
                try {
                    JSONObject jobj = new JSONObject(node_list.toJSONString());
                    json = jobj.toString(4);
                } catch (JSONException e2) {
                    throw new RuntimeException(e2);
                }
   
                // TODO: can't re-enable this until the EE accepts PlanColumn GUIDs
                // instead of column names because the deserialization is done without
                // any connection to the child nodes - required to map the PlanColumn's
                // GUID to the child's column name.
   
                // verify the plan serializes and deserializes correctly.
                // assert(node_list.testJSONSerialization(db));
   
                // output the plan to disk for debugging
                PrintStream plansOut = BuildDirectoryUtils.getDebugOutputPrintStream(
                        "statement-winner-plans", name + "-" + String.valueOf(i++) + ".txt");
                plansOut.println(json);
                plansOut.close();
   
                //
                // We then stick a serialized version of PlanNodeTree into a PlanFragment
                //
                try {
                    FastSerializer fs = new FastSerializer(false, false); // C++ needs little-endian
                    fs.write(json.getBytes());
                    String hexString = fs.getHexEncodedBytes();
                    planFragment.setPlannodetree(hexString);
                } catch (Exception e) {
                    e.printStackTrace();
                    throw compiler.new VoltCompilerException(e.getMessage());
                }
            }
View Full Code Here

Examples of org.voltdb.catalog.PlanFragment

        return (this.stmts.get(name));
    }
   
    private final void initSQLStmt(SQLStmt stmt) {
        stmt.numFragGUIDs = stmt.catStmt.getFragments().size();
        PlanFragment fragments[] = stmt.catStmt.getFragments().values();
        stmt.fragGUIDs = new long[stmt.numFragGUIDs];
        for (int ii = 0; ii < stmt.numFragGUIDs; ii++) {
            stmt.fragGUIDs[ii] = Long.parseLong(fragments[ii].getName());
        } // FOR
   
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.