Package edu.brown.utils

Examples of edu.brown.utils.PredicatePairs


                    // Skip if not one of our target tables
                    if (targets.contains(other_tbl) == false || other_tbl.getPartitioncolumn() == null) continue;
                   
                    // Get the ColumnSet, which should only have one entry
                    PredicatePairs cset = e.getAttribute(EdgeAttributes.COLUMNSET);
                    assertNotNull(cset);
                    assertEquals(cset.toString(), 1, cset.size());
                    CatalogPair entry = cset.get(0);
                    assertNotNull(entry);
                   
                    // Get the element from the entry that is not our column
                    CatalogType other = entry.getOther(catalog_col);
                    assertNotNull(other);
View Full Code Here


                System.err.println(agraph.debug());
            }
            assertFalse(v0 + "<->" + v1, edges.isEmpty());
           
            for (DesignerEdge e : edges) {
                PredicatePairs cset = e.getAttribute(EdgeAttributes.COLUMNSET);
                assertNotNull(cset);
                assertEquals(cset.toString(), 1, cset.size());
            }
        } // FOR
       
//        agraph.setVerbose(true);
//        System.err.println("Dumping AccessGraph to " + FileUtil.writeStringToTempFile(GraphvizExport.export(agraph, "tpcc"), "dot"));
View Full Code Here

                } catch (IllegalArgumentException ex) {
                    continue;
                }
                if (catalog_tbl0.equals(catalog_tbl1)) continue;
           
                PredicatePairs global_cset = new PredicatePairs();
                try {
                    edges = agraph.findEdgeSet(v0, v1);
                } catch (IllegalArgumentException ex) {
                    continue;
                }
                found = true;
                for (DesignerEdge e : edges) {
                    PredicatePairs e_cset = e.getAttribute(EdgeAttributes.COLUMNSET);
                    assertNotNull(e_cset);
                    global_cset.addAll(e_cset);
                } // FOR
//                System.err.println(String.format("%s <-> %s: %d", catalog_tbl0, catalog_tbl1, edges.size()));
               
                // Now check to make sure that there are no edges that have some funky ColumnSet entry that
                // wasn't in our original graph
                for (DesignerEdge e : single_agraph.findEdgeSet(v0, v1)) {
                    PredicatePairs e_cset = e.getAttribute(EdgeAttributes.COLUMNSET);
                    assertNotNull(e_cset);
                    assertEquals(e_cset.toString(), 1, e_cset.size());
                    CatalogPair entry = CollectionUtil.first(e_cset);
                    assertNotNull(entry);
                    assert(global_cset.contains(entry)) : "Missing " + entry;
                } // FOR
            } // FOR (V1)
View Full Code Here

        String param_key = CatalogKey.createKey(catalog_stmt_param);
        String col_key = PlanNodeUtil.CACHE_STMTPARAMETER_COLUMN.get(param_key);

        if (col_key == null) {
            Statement catalog_stmt = catalog_stmt_param.getParent();
            PredicatePairs cset = null;
            try {
                cset = CatalogUtil.extractStatementPredicates(catalog_stmt, false);
            } catch (Throwable ex) {
                throw new RuntimeException("Failed to extract ColumnSet for " + catalog_stmt_param.fullName(), ex);
            }
            assert (cset != null);
            // System.err.println(cset.debug());
            Collection<Column> matches = cset.findAllForOther(Column.class, catalog_stmt_param);
            // System.err.println("MATCHES: " + matches);
            if (matches.isEmpty()) {
                LOG.warn("Unable to find any column with param #" + catalog_stmt_param.getIndex() + " in " + catalog_stmt);
            } else {
                col_key = CatalogKey.createKey(CollectionUtil.first(matches));
View Full Code Here

     * @param catalog_stmt
     * @return
     */
    public static boolean isEqualityIndexScan(Statement catalog_stmt) {
        Collection<Table> tables = getReferencedTables(catalog_stmt);
        PredicatePairs cset = extractStatementPredicates(catalog_stmt, false, tables.toArray(new Table[0]));
       
        Collection<Index> indexes = getReferencedIndexes(catalog_stmt);
       
        for (CatalogPair cp : cset) {
            if (cp.getComparisonExp() != ExpressionType.COMPARE_EQUAL) {
View Full Code Here

            table_keys.add(CatalogKey.createKey(table));
        } // FOR

        final CatalogUtil.Cache cache = CatalogUtil.getCatalogCache(catalog_stmt);
        Pair<String, Collection<String>> key = Pair.of(CatalogKey.createKey(catalog_stmt), table_keys);
        PredicatePairs cset = cache.EXTRACTED_PREDICATES.get(key);
        if (cset == null) {
            cset = new PredicatePairs();
            AbstractPlanNode root_node = PlanNodeUtil.getRootPlanNodeForStatement(catalog_stmt, true);

            try {
                // WHERE Clause
                if (catalog_stmt.getExptree() != null && !catalog_stmt.getExptree().isEmpty()) {
View Full Code Here

            table_keys.add(CatalogKey.createKey(table));
        } // FOR

        final CatalogUtil.Cache cache = CatalogUtil.getCatalogCache(catalog_stmt);
        Pair<String, Collection<String>> key = Pair.of(CatalogKey.createKey(catalog_stmt), table_keys);
        PredicatePairs cset = cache.EXTRACTED_PREDICATES.get(key);
        if (cset == null) {
            cset = new PredicatePairs();
            AbstractPlanNode root_node = PlanNodeUtil.getRootPlanNodeForStatement(catalog_stmt, true);
            CatalogUtil.extractUpdatePredicates(catalog_stmt, catalog_db, cset, root_node, convert_params, tables);
            cache.EXTRACTED_PREDICATES.put(key, cset);
        }
        return (cset);
View Full Code Here

        if (debug.val)
            LOG.debug("Extracting column set for fragment #" + catalog_frag.getName() + ": " + catalog_tables);
        final CatalogUtil.Cache cache = CatalogUtil.getCatalogCache(catalog_stmt);
        Pair<String, Collection<String>> key = Pair.of(CatalogKey.createKey(catalog_frag), table_keys);
        PredicatePairs cset = cache.EXTRACTED_PREDICATES.get(key);
        if (cset == null) {
            AbstractPlanNode root_node = PlanNodeUtil.getPlanNodeTreeForPlanFragment(catalog_frag);
            // LOG.debug("PlanFragment Node:\n" +
            // PlanNodeUtil.debug(root_node));
            cset = new PredicatePairs();
            CatalogUtil.extractPlanNodePredicates(catalog_stmt, catalog_db, cset, root_node, convert_params, catalog_tables);
            cache.EXTRACTED_PREDICATES.put(key, cset);
        }

        return (cset);
View Full Code Here

        if (edges == null) {
            if (debug.val)
                LOG.warn("No edges were found for " + vertex + " in AccessGraph");
        } else {
            for (DesignerEdge edge : agraph.getIncidentEdges(vertex)) {
                PredicatePairs orig_cset = (PredicatePairs) edge.getAttribute(AccessGraph.EdgeAttributes.COLUMNSET.name());
                assert (orig_cset != null);

                // Skip any ColumnSets that were used only for INSERTs
                PredicatePairs cset = new PredicatePairs();
                for (CatalogPair entry : orig_cset) {
                    if (!(entry.containsQueryType(QueryType.INSERT) && entry.getQueryTypeCount() == 1)) {
                        cset.add(entry);
                    }
                } // FOR

                double edge_weight = edge.getTotalWeight();
                for (Column catalog_col : cset.findAllForParent(Column.class, catalog_tbl)) {
                    Double column_weight = column_weights.get(catalog_col);
                    if (column_weight == null)
                        column_weight = 0.0d;
                    column_weights.put(catalog_col, column_weight + edge_weight);
                } // FOR
View Full Code Here

                    if (v0.equals(v) && v1.equals(v))
                        continue;
                }

                double edge_weight = e.getTotalWeight();
                PredicatePairs predicates = e.getAttribute(AccessGraph.EdgeAttributes.COLUMNSET.name());
                Histogram<Column> cset_histogram = predicates.buildHistogramForType(Column.class);
                for (Column catalog_col : cset_histogram.values()) {
                    if (!catalog_col.getParent().equals(catalog_tbl))
                        continue;
                    long cnt = cset_histogram.get(catalog_col);
                    column_histogram.put(catalog_col, Math.round(cnt * edge_weight));
 
View Full Code Here

TOP

Related Classes of edu.brown.utils.PredicatePairs

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.