Examples of CatalogType


Examples of org.apache.axis.wsi.scm.retailer.catalog.CatalogType

        // Make a service
        RetailerService service = new RetailerServiceLocator();

        // Now use the service to get a stub which implements the SEI.
        RetailerPortType port = service.getRetailerPort();
        CatalogType catalog = port.getCatalog();
        CatalogItem[] items = catalog.getItem();
        for (int i = 0; i < items.length; i++) {
            System.out.println("------------------");
            CatalogItem item = items[i];
            System.out.println(item.getBrand());
        }
View Full Code Here

Examples of org.voltdb.catalog.CatalogType

                    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);
                    if ((other instanceof Column) == false) continue;
                    Column other_col = (Column)other;
                    System.err.println(String.format("catalog_col=%s, other_tbl=%s, other_col=%s",
                                                     catalog_col.fullName(), other_tbl.fullName(), other_col.fullName()));
View Full Code Here

Examples of org.voltdb.catalog.CatalogType

        } else {
            param_map = (CatalogMap<? extends CatalogType>)((Statement)catalog_item).getParameters();
        }
        stringer.key(Members.PARAMS.name()).array();
        for (int i = 0; i < this.params.length; i++) {
            CatalogType catalog_param = param_map.get(i);
            Object param_isarray = catalog_param.getField("isarray");
            if (param_isarray != null && (Boolean)param_isarray) {
                stringer.array();
                Class<?> type = params[i].getClass();
                assert(type.isArray());
                Class<?> dataType = type.getComponentType();
View Full Code Here

Examples of org.voltdb.catalog.CatalogType

     * @param frag Catalog fragment to identify
     * @return unique id for fragment
     */
    public static long getUniqueIdForFragment(PlanFragment frag) {
        long retval = 0;
        CatalogType parent = frag.getParent();
        retval = ((long) parent.getParent().getRelativeIndex()) << 32;
        retval += ((long) parent.getRelativeIndex()) << 16;
        retval += frag.getRelativeIndex();

        return retval;
    }
View Full Code Here

Examples of org.voltdb.catalog.CatalogType

            int ctr = 0;
            for (int idxs[] : lookup_idxs) {
                T cur = (T) pair.get(idxs[0]);
                Class<?> cur_class = pair.get(idxs[0]).getClass();
                List<Class<?>> all_classes = ClassUtil.getSuperClasses(cur_class);
                CatalogType cur_value = (CatalogType) pair.get(idxs[1]);
                if (use_parent)
                    cur_value = cur_value.getParent();

                if (trace.val) {
                    LOG.trace("[" + ctr + "] cur: " + cur);
                    LOG.trace("[" + ctr + "] class: " + cur_class.equals(match_class) + " " + cur_class);
                    LOG.trace("[" + (ctr++) + "] cur_value: " + cur_value);
                }
                if (cur_value != null && cur_value.equals(search_key) && all_classes.contains(match_class)) {
                    found.add(cur);
                    break;
                }
            } // FOR
        } // FOR
View Full Code Here

Examples of org.voltdb.catalog.CatalogType

        public Object getValueAt(int row, int col) {
            String ret = null;
            if (this.cset != null) {
                // FIXME
                //col = (col == 1 ? 0 : 1);
                CatalogType item = (CatalogType)this.cset.get(row).get(col);
                ret = CatalogUtil.getDisplayName(item, true);
            }
            return (ret);
        }
View Full Code Here

Examples of org.voltdb.catalog.CatalogType

                        }
                       
                        // Look for predicates with StmtParameters or ConstantValues
                        for (Table catalog_tbl : frag_tables) {
                            Column catalog_col = null;
                            CatalogType catalog_param = null;
                           
                            // *********************************** DEBUG ***********************************
                            if (trace.val) {
                                LOG.trace("Current Table: " + catalog_tbl.hashCode());
                                if (pair.getFirst() != null) {
                                    LOG.trace("entry.getFirst().getParent(): " + (pair.getFirst().getParent() != null ?
                                                    pair.getFirst().getParent().hashCode() :
                                                    pair.getFirst() + " parent is null?"));
                           
                                    if (pair.getFirst().getParent() instanceof Table) {
                                        Table parent = pair.getFirst().getParent();
                                        if (parent.getName().equals(catalog_tbl.getName())) {
                                            assert(parent.equals(catalog_tbl)) :
                                                "Mismatch on " + parent.getName() + "???";
                                        }
                                    }
                                } else {
                                    LOG.trace("entry.getFirst():             " + null);
                                }
                                if (pair.getSecond() != null) {
                                    LOG.trace("entry.getSecond().getParent(): " + (pair.getSecond().getParent() != null ?
                                                  pair.getSecond().getParent().hashCode() :
                                                  pair.getSecond() + " parent is null?"));
                                } else {
                                    LOG.trace("entry.getSecond():             " + null);
                                }
                            }
                            // *********************************** DEBUG ***********************************

                            // Column = (StmtParameter or ConstantValue)
                            if (pair.getFirst().getParent() != null && pair.getFirst().getParent().equals(catalog_tbl) &&
                                    (pair.getSecond() instanceof StmtParameter || pair.getSecond() instanceof ConstantValue) ) {
                                catalog_col = (Column) pair.getFirst();
                                catalog_param = pair.getSecond();
                           
                            }
                            // (StmtParameter or ConstantValue) = Column
                            else if (pair.getSecond().getParent() != null && pair.getSecond().getParent().equals(catalog_tbl) &&
                                    (pair.getFirst() instanceof StmtParameter || pair.getFirst() instanceof ConstantValue)) {
                                catalog_col = (Column) pair.getSecond();
                                catalog_param = pair.getFirst();
                            }
                            if (catalog_col != null && catalog_param != null) {
                                // If this table is a view, then we need to check whether
                                // we have to point the column down to the origin column
                                if (catalog_col.getMatviewsource() != null) {
                                    if (debug.val)
                                        LOG.debug("Found View Column: " + catalog_col.fullName() + " -> " + catalog_col.getMatviewsource().fullName());
                                    catalog_col = catalog_col.getMatviewsource();
                                }
                                if (trace.val)
                                    LOG.trace(String.format("[%s] Adding cache entry for %s: %s -> %s",
                                                            CatalogUtil.getDisplayName(catalog_tbl),
                                                            CatalogUtil.getDisplayName(catalog_frag),
                                                            CatalogUtil.getDisplayName(catalog_col),
                                                            CatalogUtil.getDisplayName(catalog_param)));
                                stmt_cache.put(catalog_col, catalog_param, pair.getComparisonExp(), catalog_tbl);
                                frag_cache.put(catalog_col, catalog_param, pair.getComparisonExp(), catalog_tbl);
                            }
                        } // FOR (tables)
                        if (trace.val)
                            LOG.trace("-------------------");
                    } // FOR (entry)

                    // We now have to take a second pass through the column mappings
                    // This will pick-up those columns that are joined together where one of them
                    // is also referenced with an input parameter. So we will map the input
                    // parameter to the second column as well
                    PartitionEstimator.populateColumnJoinSets(column_joins);

                    for (Column catalog_col : column_joins.keySet()) {
                        // Otherwise, we have to examine the the ColumnSet and
                        // look for any reference to this column
                        if (trace.val)
                            LOG.trace("Trying to find all references to " + CatalogUtil.getDisplayName(catalog_col));
                        for (Column other_col : column_joins.get(catalog_col)) {
                            // IMPORTANT: If the other entry is a column from another table and we don't
                            // have a reference in stmt_cache for ourselves, then we can look to see if
                            // this guy was used against a StmtParameter some where else in the Statement
                            // If this is the case, then we can substitute that mofo in it's place
                            if (stmt_cache.predicates.containsKey(catalog_col)) {
                                for (Pair<ExpressionType, CatalogType> pair : stmt_cache.predicates.get(catalog_col)) {
                                    if (trace.val)
                                        LOG.trace(String.format("Linking %s to predicate %s because of %s",
                                                  other_col.fullName(), pair, catalog_col.fullName()));
                                   
                                    ExpressionType expType = pair.getFirst();
                                    CatalogType param = pair.getSecond();
                                    stmt_cache.put(other_col, param, expType, (Table)other_col.getParent());
                                    frag_cache.put(other_col, param, expType, (Table)other_col.getParent());
                                } // FOR (StmtParameter.Index)
                            }
                        } // FOR (Column)
                    } // FOR (Column)
                }
                if (trace.val)
                    LOG.trace(frag_cache.toString());

                // Loop through all of our tables and make sure that there is an entry in the PlanFragment CacheEntrry
                // If there isn't, then that means there was no predicate on the table and therefore the PlanFragment
                // must be broadcast to all partitions (unless it is replicated)
                for (Table catalog_tbl : frag_tables) {
                    if (!frag_cache.hasTable(catalog_tbl)) {
                        if (trace.val)
                            LOG.trace(String.format("No column predicate for %s. Marking as broadcast for %s: %s",
                                      catalog_tbl.fullName(), catalog_frag.fullName(), frag_cache.getTables()));
                        frag_cache.markAsBroadcast(catalog_tbl);
                        stmt_cache.markAsBroadcast(catalog_tbl);
                    }
                } // FOR

                // Store the Fragment cache and update the Table xref mapping
                this.cache_fragmentEntries.put(frag_key, frag_cache);
                this.addTableCacheXref(frag_cache, frag_tables);
            } // FOR (fragment)

            // Then for updates we need to look to see whether they are updating an attribute
            // that they are partitioned on. If so, then it gets dicey because we need to
            // know the value...
            if (stmt_type == QueryType.UPDATE) {
                List<Table> tables = new ArrayList<Table>();
                PredicatePairs update_cset = new PredicatePairs();
                for (Table catalog_tbl : CatalogUtil.getReferencedTables(catalog_stmt)) {
                    update_cset.clear();
                    tables.clear();
                    tables.add(catalog_tbl);
                    AbstractPlanNode root_node = PlanNodeUtil.getRootPlanNodeForStatement(catalog_stmt, true);
                    CatalogUtil.extractUpdatePredicates(catalog_stmt, catalogContext.database, update_cset, root_node, true, tables);

                    boolean found = false;
                    for (CatalogPair pair : update_cset) {
                        Column catalog_col = null;
                        CatalogType catalog_param = null;

                        // For now we only care up look-ups using StmtParameters or ConstantValues
                        if (pair.getFirst() instanceof StmtParameter || pair.getFirst() instanceof ConstantValue) {
                            catalog_col = (Column) pair.getSecond();
                            catalog_param = pair.getFirst();
View Full Code Here

Examples of org.voltdb.catalog.CatalogType

        // Note that we have to go through all of the mappings from the partitioning column
        // to parameters. This can occur when the partitioning column is referenced multiple times
        // This allows us to handle complex WHERE clauses and what not.
        for (Pair<ExpressionType, CatalogType> pair : predicates) {
            ExpressionType expType = pair.getFirst();
            CatalogType param = pair.getSecond();
           
            // HACK HACK HACK
            // If this is not an equality comparison, then it has to go to all partitions.
            // If we ever want to support smarter range partitioning, then
            // we will need to move the logic that examines the expression type into
            // the hasher code.
            if (expType != ExpressionType.COMPARE_EQUAL) {
                partitions.addAll(this.all_partitions);
                break;
            }
           
            // STATEMENT PARAMETER
            // This is the common case
            if (param instanceof StmtParameter) {
                int param_idx = ((StmtParameter)param).getIndex();
               
                // IMPORTANT: Check if the parameter is an array. If it is, then we
                // have to loop through and get the hash of all of the values
                if (is_array[param_idx]) {
                    int num_elements = Array.getLength(params[param_idx]);
                    if (trace.val)
                        LOG.trace(String.format("%s is an array. Calculating multiple partitions", param));
                    for (int i = 0; i < num_elements; i++) {
                        Object value = Array.get(params[param_idx], i);
                        int partition_id = this.hasher.hash(value, catalog_col);
                        if (trace.val)
                            LOG.trace(String.format("%s HASHING PARAM ARRAY[%d][%d]: %s -> %d",
                                  catalog_col.fullName(), param_idx, i, value, partition_id));
                        partitions.add(partition_id);
                    } // FOR
                   
                }
                // Primitive Value
                else {
                    int partition_id = this.hasher.hash(params[param_idx], catalog_col);
                    if (trace.val)
                        LOG.trace(String.format("%s HASHING PARAM [%d]: %s -> %d",
                                  catalog_col.fullName(), param_idx, params[param_idx], partition_id));
                    partitions.add(partition_id);
                }
            }
            // CONSTANT VALUE
            // This is more rare
            else if (param instanceof ConstantValue) {
                ConstantValue const_param = (ConstantValue)param;
                VoltType vtype = VoltType.get(const_param.getType());
                Object const_value = VoltTypeUtil.getObjectFromString(vtype, const_param.getValue());
                int partition_id = this.hasher.hash(const_value);
                partitions.add(partition_id);
            }
            // BUSTED!
            else {
                throw new RuntimeException("Unexpected parameter type: " + param.fullName());
            }
        } // FOR
        return;
    }
View Full Code Here

Examples of org.voltdb.catalog.CatalogType

        this.attributes.addAll(attributes);
        assert (this.attributes.isEmpty() == false);
        assert (new HashSet<T>(this.attributes).size() == this.attributes.size()) :
            "Duplicate Attributes: " + this.attributes;

        CatalogType last_parent = null;
        for (T c : this.attributes) {
            if (last_parent != null)
                assert (c.getParent().equals(last_parent)) :
                    "Catalog items do not have the same parent: " + CatalogUtil.debug(this.attributes);
            last_parent = c.getParent();
View Full Code Here

Examples of org.voltdb.catalog.CatalogType

        private Map<CatalogType, CatalogType> buildCatalogMap(Database catalog_db, Map<CatalogType, CatalogType> map) {
            if (this.parent != null)
                this.parent.buildCatalogMap(catalog_db, map);
            if (this.depth > 0) {
                CatalogType key = null;
                CatalogType val = null;

                if (this.is_table) {
                    key = CatalogKey.getFromKey(catalog_db, this.catalog_key, Table.class);
                    val = CatalogKey.getFromKey(catalog_db, this.partition_key, Column.class);
                } else {
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.