Package org.voltdb.catalog

Examples of org.voltdb.catalog.Statement


        final Table catalog_tbl = (Table) catalog_col.getParent();
        // For each query, check whether they are going to our table
        // If so, then we need to update our statistics
        int col_index = catalog_col.getIndex();
        for (QueryTrace query : xact.getQueries()) {
            Statement catalog_stmt = query.getCatalogItem(catalog_db);
            QueryType query_type = QueryType.get(catalog_stmt.getQuerytype());
            // For now we only examine the tuples as they are being inserted
            // into the table
            if (query_type == QueryType.INSERT && CatalogUtil.getReferencedTables(catalog_stmt).contains(catalog_tbl)) {
                try {
                    Object value = query.getParam(col_index);
View Full Code Here


            }
        } // FOR
       
        // Now run through all of the queries and calculate the correlation between StmtParameters and ProcParameters
        for (QueryTrace query_trace : xact_trace.getQueries()) {
            Statement catalog_stmt = query_trace.getCatalogItem(this.catalog_db);
            QueryInstance query_instance = correlation.getQueryInstance(catalog_stmt);
            Object query_params[] = query_trace.getParams();
           
            // For each of the StmtParameter, update the correlation information for each of the ProcParameters
            for (int i = 0; i < query_params.length; i++) {
                StmtParameter catalog_stmt_param = catalog_stmt.getParameters().get(i);
                assert(catalog_stmt_param != null);
                VoltType stmt_param_type = VoltType.get(catalog_stmt_param.getJavatype());
                assert(stmt_param_type != VoltType.INVALID);
                Number stmt_param_val = this.getParamAsNumber(stmt_param_type, query_params[i]);
View Full Code Here

            }
            if (debug.val) LOG.debug("Updating parameter mapping for Procedure '" + proc_name + "'");
           
            DefaultParameterMapping map = proc_mapping.get(proc_name);
            for (String stmt_name : map.keySet()) {
                Statement catalog_stmt = catalog_proc.getStatements().get(stmt_name);
                if (catalog_stmt == null) {
                    throw new RuntimeException("Unknown Statement name '" + stmt_name + "' in ParameterMapping");
                }

                for (Integer stmt_param : map.get(stmt_name).keySet()) {
                    StmtParameter catalog_stmt_param = catalog_stmt.getParameters().get(stmt_param);

                    Integer proc_param = map.get(stmt_name).get(stmt_param);
                    ProcParameter catalog_proc_param = catalog_proc.getParameters().get(proc_param);

                    // Skip if it already has the proper ProcParameter set
View Full Code Here

                String procName = this.rewritten_queries.get(catalog_stmt);
                assert (procName != null);

                Procedure new_catalog_proc = catalog_db.getProcedures().get(procName);
                assert (new_catalog_proc != null);
                Statement new_catalog_stmt = CollectionUtil.first(new_catalog_proc.getStatements());
                assert (new_catalog_stmt != null);
                ret.put(catalog_stmt, new_catalog_stmt);
            } // FOR

            // CatalogUtil.saveCatalog(catalog,
View Full Code Here

     * @param c
     */
    @Override
    public boolean add(ParameterMapping c) {
        assert(c != null);
        Statement catalog_stmt = c.getStatement();
        assert(catalog_stmt != null);
        StmtParameter catalog_stmt_param = c.getStmtParameter();
        assert(catalog_stmt_param != null);
        Procedure catalog_proc = catalog_stmt.getParent();
        assert(catalog_proc != null);
        ProcParameter catalog_proc_param = c.getProcParameter();
        Column catalog_col = c.getColumn();
       
        // Procedure Index
View Full Code Here

        for (Statement target_stmt : target_proc.getStatements()) {
            int idx = target_stmt.getName().indexOf("MultiSite");
            if (idx == -1)
                continue;
            String base_name = target_stmt.getName().substring(0, idx);
            Statement source_stmt = source_proc.getStatements().get(base_name);
            assert (target_stmt != null);

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

            // Lines we need to remove
            String orig_catalog_id = null;
            String new_catalog_id = null;
            for (PlanFragment target_frag : target_stmt.getFragments()) {
                assert (orig_catalog_id == null);
                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);
View Full Code Here

        this.preprocess((Database) catalog_stmt.getParent().getParent());
    }

    @Override
    public Statement getCatalogItem(Database catalog_db) {
        Statement ret = CatalogKey.getFromKey(catalog_db, this.catalog_key, Statement.class);
        return (ret);
    }
View Full Code Here

    @Override
    public void preprocess(Database catalog_db) {
        if (this.has_preprocessed)
            return;
        final Statement catalog_stmt = this.getCatalogItem(catalog_db);
        for (StmtParameter catalog_stmt_param : catalog_stmt.getParameters()) {
            int stmt_param_idx = catalog_stmt_param.getIndex();
            this.param_histograms.put(stmt_param_idx, new ObjectHistogram());
        } // FOR
        this.has_preprocessed = true;
    }
View Full Code Here

        this.has_preprocessed = true;
    }

    @Override
    public void process(Database catalog_db, TransactionTrace xact) throws Exception {
        final Statement catalog_stmt = this.getCatalogItem(catalog_db);
        //
        // For each query, check whether they are going to our table
        // If so, then we need to update our statistics
        //
        int num_params = catalog_stmt.getParameters().size();
        long execute_count = 0;
        LOG.debug("Examining " + xact + " for instances of " + catalog_stmt);
        for (QueryTrace query : xact.getQueries()) {
            if (!query.getCatalogItemName().equals(CatalogKey.getNameFromKey(this.getCatalogKey())))
                continue;
View Full Code Here

        if (cache == null) {
            cache = new HashMap<MarkovVertex.Type, Statement>();
            CACHE_specialStatements.put(catalog_db, cache);
        }
       
        Statement catalog_stmt = cache.get(type);
        if (catalog_stmt == null) {
            catalog_stmt = new StatementWrapper(catalog_db.getCatalog(), type);
            cache.put(type, catalog_stmt);
        }
        return (catalog_stmt);
View Full Code Here

TOP

Related Classes of org.voltdb.catalog.Statement

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.