Package edu.brown.catalog.special

Examples of edu.brown.catalog.special.MultiProcParameter


        Procedure catalog_proc = this.getProcedure(clone_db, paymentByCustomerId.class);
        ProcParameter catalog_params[] = new ProcParameter[] {
            this.getProcParameter(clone_db, catalog_proc, 1),   // D_ID
            this.getProcParameter(clone_db, catalog_proc, 0),   // W_ID
        };
        MultiProcParameter mpp = MultiProcParameter.get(catalog_params);
        assertNotNull(mpp);
        assert(mpp.getIndex() >= 0);
        catalog_proc.setPartitionparameter(mpp.getIndex());

        // Table
        Table catalog_tbl = this.getTable(clone_db, TPCCConstants.TABLENAME_DISTRICT);
        String table_key = CatalogKey.createKey(catalog_tbl);
        Column catalog_cols[] = new Column[] {
View Full Code Here


        ProcParameter catalog_params[] = new ProcParameter[] {
            this.getProcParameter(clone_db, catalog_proc, 0),   // W_ID
            this.getProcParameter(clone_db, catalog_proc, 1),   // D_ID
        };
        MultiProcParameter mpp = MultiProcParameter.get(catalog_params);
        assertNotNull(mpp);
        assert(mpp.getIndex() >= 0);
        catalog_proc.setPartitionparameter(mpp.getIndex());
        p_estimator.initCatalog(clone_catalogContext);
       
        // Case #1: Both parameters have values in the input
        Long params[] = new Long[catalog_proc.getParameters().size()];
        params[0] = new Long(NUM_PARTITIONS-1); // W_ID
View Full Code Here

        Procedure catalog_proc = this.getProcedure(clone_db, GetNewDestination.class);
        ProcParameter catalog_params[] = new ProcParameter[] {
            this.getProcParameter(clone_db, catalog_proc, 0),   // S_ID
            this.getProcParameter(clone_db, catalog_proc, 1),   // SF_TYPE
        };
        MultiProcParameter mpp = MultiProcParameter.get(catalog_params);
        assertNotNull(mpp);
        assert(mpp.getIndex() >= 0);
        catalog_proc.setPartitionparameter(mpp.getIndex());
       
        // First Test: Only partition one of the tables and make sure that
        // the MultiColumns don't map to the same partition
       
        Table catalog_tbl = this.getTable(clone_db, TM1Constants.TABLENAME_SPECIAL_FACILITY);
View Full Code Here

        Procedure catalog_proc = this.getProcedure(clone_db, GetAccessData.class);
        ProcParameter catalog_params[] = new ProcParameter[] {
            this.getProcParameter(clone_db, catalog_proc, 0),   // S_ID
            this.getProcParameter(clone_db, catalog_proc, 1),   // AI_TYPE
        };
        MultiProcParameter mpp = MultiProcParameter.get(catalog_params);
        assertNotNull(mpp);
        assert(mpp.getIndex() >= 0);
        catalog_proc.setPartitionparameter(mpp.getIndex());
        p_estimator.initCatalog(clone_catalogContext);
       
        Table catalog_tbl = this.getTable(clone_db, TM1Constants.TABLENAME_ACCESS_INFO);
        Column catalog_cols[] = new Column[] {
            this.getColumn(clone_db, catalog_tbl, "S_ID"),
View Full Code Here

                    param_correlations.put(catalog_proc_param, new ArrayList<Double>());
                }
                // Special Case: MultiProcParameter
                if (catalog_proc_param instanceof MultiProcParameter) {
                    if (hints.enable_multi_partitioning) {
                        MultiProcParameter mpp = (MultiProcParameter) catalog_proc_param;
                        for (ProcParameter inner : mpp) {
                            // Divide the values by the number of attributes in
                            // mpp so that we take the average
                            Collection<ParameterMapping> pms = mappings.get(inner, catalog_col);
                            if (pms != null) {
                                for (ParameterMapping c : pms) {
                                    param_correlations.get(catalog_proc_param).add(c.getCoefficient() / (double) mpp.size());
                                } // FOR (ParameterMapping)
                            }
                        } // FOR
                    }
                } else {
View Full Code Here

                    continue;

                // This will automatically update the Procedure, so there isn't
                // anything more
                // we need to do here...
                MultiProcParameter mpp = MultiProcParameter.get(param0, param1);
                assert (mpp != null);
                param_map.get(param0).add(mpp);
                param_map.get(param1).add(mpp);
            } // FOR
        } // FOR
View Full Code Here

        // And don't forget MultiProcParameter!
        for (Procedure catalog_proc : catalog_db.getProcedures()) {
            Procedure clone_proc = clone_db.getProcedures().get(catalog_proc.getName());
            for (ProcParameter catalog_param : catalog_proc.getParameters()) {
                if (catalog_param instanceof MultiProcParameter) {
                    MultiProcParameter mpp = (MultiProcParameter) catalog_param;
                    ProcParameter clone_params[] = new ProcParameter[mpp.size()];
                    for (int i = 0; i < clone_params.length; i++) {
                        clone_params[i] = clone_proc.getParameters().get(mpp.get(i).getIndex());
                    } // FOR

                    // This will automatically add our guy into clone_tbl
                    MultiProcParameter clone_mpp = MultiProcParameter.get(clone_params);
                    assert (clone_mpp != null);
                }
            }
            assert (catalog_proc.getParameters().size() == clone_proc.getParameters().size()) : catalog_proc.getParameters() + " != " + clone_proc.getParameters();
        } // FOR
View Full Code Here

        if (catalog_param instanceof RandomProcParameter) {
            partition = RandomProcParameter.rand.nextInt(this.num_partitions);
        }
        // Special Case: MultiProcParameter
        else if (catalog_param instanceof MultiProcParameter) {
            MultiProcParameter mpp = (MultiProcParameter) catalog_param;
            if (debug.val)
                LOG.debug(catalog_proc.getName() + " MultiProcParameter: " + mpp);
            int hashes[] = new int[mpp.size()];
            for (int i = 0; i < hashes.length; i++) {
                int mpp_param_idx = mpp.get(i).getIndex();
                assert (mpp_param_idx >= 0) : "Invalid Partitioning MultiProcParameter #" + mpp_param_idx;
                assert (mpp_param_idx < params.length) : CatalogUtil.getDisplayName(mpp) + " < " + params.length;
                int hash = this.calculatePartition(catalog_proc, params[mpp_param_idx], is_array);
                hashes[i] = (hash == HStoreConstants.NULL_PARTITION_ID ? 0 : hash);
                if (debug.val)
                    LOG.debug(mpp.get(i) + " value[" + params[mpp_param_idx] + "] => hash[" + hashes[i] + "]");
            } // FOR
            partition = this.hasher.multiValueHash(hashes);
            if (debug.val)
                LOG.debug(Arrays.toString(hashes) + " => " + partition);
        }
View Full Code Here

        int cnt = 3;
        for (int i = 0; i < cnt; i++) {
            ProcParameter col0 = target_proc.getParameters().get(i);
            for (int ii = i + 1; ii < cnt; ii++) {
                ProcParameter col1 = target_proc.getParameters().get(ii);
                MultiProcParameter mpp = MultiProcParameter.get(col0, col1);
                assertNotNull(mpp);
                expected.add(mpp);
            } // FOR
        } // FOR
        assertFalse(expected.isEmpty());
View Full Code Here

     * testMultiProcParameter
     */
    public void testMultiProcParameter() throws Exception {
        Procedure catalog_proc = this.getProcedure(UpdateSubscriberData.class);
        ProcParameter params[] = { catalog_proc.getParameters().get(0), catalog_proc.getParameters().get(1), };
        MultiProcParameter item0 = MultiProcParameter.get(params);
        assertNotNull(item0);

        String key = CatalogKey.createKey(item0);
        assertNotNull(key);
        assertFalse(key.isEmpty());
        // System.err.println("----------------------------------");
        // System.err.println(mpp + " ==> " + key);

        MultiProcParameter clone = (MultiProcParameter) CatalogKey.getFromKey(catalog_db, key, ProcParameter.class);
        assertNotNull(clone);
        for (int i = 0; i < item0.size(); i++) {
            assertEquals(item0.get(i), item0.get(i));
        } // FOR
    }
View Full Code Here

TOP

Related Classes of edu.brown.catalog.special.MultiProcParameter

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.