Package org.voltdb.types

Examples of org.voltdb.types.QueryType


        catalogStmt.setSinglepartition(false);
        catalogStmt.setBatched(false);
        catalogStmt.setParamnum(paramCount);

        // determine the type of the query
        QueryType qtype = QueryType.SELECT;
        catalogStmt.setReadonly(true);
        if (sql.toLowerCase().startsWith("insert")) {
            qtype = QueryType.INSERT;
            catalogStmt.setReadonly(false);
        }
        if (sql.toLowerCase().startsWith("update")) {
            qtype = QueryType.UPDATE;
            catalogStmt.setReadonly(false);
        }
        if (sql.toLowerCase().startsWith("delete")) {
            qtype = QueryType.DELETE;
            catalogStmt.setReadonly(false);
        }
        catalogStmt.setQuerytype(qtype.getValue());
        // name will look like "basename-stmt-#"
        String name = catalogStmt.getParent().getTypeName() + "-" + catalogStmt.getTypeName();

        DatabaseEstimates estimates = new DatabaseEstimates();
        TrivialCostModel costModel = new TrivialCostModel();
View Full Code Here


        Map<QueryType, Integer> query_counts = new HashMap<QueryType, Integer>();
        for (QueryType type : QueryType.values()) {
            query_counts.put(type, 0);
        } // FOR
        for (Statement catalog_stmt : this.catalog_stmts) {
            QueryType type = QueryType.get(catalog_stmt.getQuerytype());
            query_counts.put(type, query_counts.get(type) + 1);
        } // FOR
        return (query_counts);
    }
View Full Code Here

            Set<Column> all_modified = new HashSet<Column>();
            Set<Column> all_modified_no_inserts = new HashSet<Column>();

            for (Procedure catalog_proc : catalog_db.getProcedures()) {
                for (Statement catalog_stmt : catalog_proc.getStatements()) {
                    QueryType qtype = QueryType.get(catalog_stmt.getQuerytype());
                    if (qtype == QueryType.SELECT)
                        continue;

                    // Get the columns that referenced by this Statement
                    CatalogUtil.getReferencedColumns(catalog_stmt);
View Full Code Here

     */
    private synchronized void generateCache(final Statement catalog_stmt) throws Exception {
        // Check whether we already have a CacheEntry for the Statement that we
        // can reuse
        String stmt_key = CatalogKey.createKey(catalog_stmt);
        QueryType stmt_type = QueryType.get(catalog_stmt.getQuerytype());
        PartitionEstimator.CacheEntry stmt_cache = this.cache_statementEntries.get(stmt_key);
        if (stmt_cache == null) {
            stmt_cache = new PartitionEstimator.CacheEntry(stmt_type);
        } else {
            // assert(stmt_cache.isValid()) :
View Full Code Here

                                             final int base_partition,
                                             final Map<String, PartitionSet> entry_table_partitions,
                                             final PartitionSet entry_all_partitions) throws Exception {

        // Hash the input parameters to determine what partitions we're headed to
        QueryType stmt_type = target.query_type;

        // Update cache
        if (target.is_array == null) {
            target.is_array = new boolean[params.length];
            for (int i = 0; i < target.is_array.length; i++) {
View Full Code Here

            if (this.ignoredProcedures.contains(catalog_proc)) continue;
           
            ProcedureInfo pInfo = new ProcedureInfo(catalog_proc);
            for (Statement catalog_stmt : catalog_proc.getStatements()) {
                if (this.ignoredStatements.contains(catalog_stmt)) continue;
                QueryType qtype = QueryType.get(catalog_stmt.getQuerytype());
                if (qtype == QueryType.SELECT) {
                    pInfo.readQueries.add(catalog_stmt);
                } else {
                    pInfo.writeQueries.add(catalog_stmt);
                }
View Full Code Here

            boolean alwaysConflicting0 = this.alwaysReadWriteConflicting(stmt0, tables0);
            // assert(cols0.isEmpty() == false) : "No columns for " + stmt0.fullName();
           
            for (Statement stmt1 : pInfo1.writeQueries) {
                if (this.ignoredStatements.contains(stmt1)) continue;
                QueryType type1 = QueryType.get(stmt1.getQuerytype());
                Collection<Table> tables1 = CatalogUtil.getReferencedTables(stmt1);
                Collection<Table> intersectTables = CollectionUtils.intersection(tables0, tables1);
                Collection<Column> cols1 = CatalogUtil.getReferencedColumns(stmt1);
                boolean alwaysConflicting1 = this.alwaysWriteConflicting(stmt1, type1, tables1, cols1);
                if (debug.val)
View Full Code Here

        // Any INSERT or DELETE is always a conflict
        // For UPDATE, we will check whether their columns intersect
        for (Statement stmt0 : pInfo0.writeQueries) {
            if (this.ignoredStatements.contains(stmt0)) continue;
            Collection<Table> tables0 = CatalogUtil.getReferencedTables(stmt0);
            QueryType type0 = QueryType.get(stmt0.getQuerytype());
            Collection<Column> cols0 = CatalogUtil.getReferencedColumns(stmt0);
            boolean alwaysConflicting0 = this.alwaysWriteConflicting(stmt0, type0, tables0, cols0);
           
            for (Statement stmt1 : pInfo1.writeQueries) {
                if (this.ignoredStatements.contains(stmt1)) continue;
                Collection<Table> tables1 = CatalogUtil.getReferencedTables(stmt1);
                QueryType type1 = QueryType.get(stmt1.getQuerytype());
                Collection<Column> cols1 = CatalogUtil.getReferencedColumns(stmt1);
                boolean alwaysConflicting1 = this.alwaysWriteConflicting(stmt1, type1, tables1, cols1);
               
                Collection<Table> intersectTables = CollectionUtils.intersection(tables0, tables1);
                if (debug.val)
View Full Code Here

        final Table catalog_tbl = this.getCatalogItem(catalog_db);
        // For each query, check whether they are going to our table
        // If so, then we need to update our statistics
        for (QueryTrace query : xact.getQueries()) {
            Statement catalog_stmt = query.getCatalogItem(catalog_db);
            QueryType query_type = QueryType.get(catalog_stmt.getQuerytype());
            // System.out.println("Examining " + catalog_stmt + " for " +
            // catalog_tbl);

            if (CatalogUtil.getReferencedTables(catalog_stmt).contains(catalog_tbl)) {
                // Query Type Counts
View Full Code Here

     * @throws Exception
     */
    protected void process(Database catalog_db, QueryTrace query) throws Exception {
        Statement catalog_stmt = query.getCatalogItem(catalog_db);

        QueryType query_type = QueryType.get(catalog_stmt.getQuerytype());
        this.proc_query_counts += 1;

        if (catalog_stmt.getQuerytype() == QueryType.INSERT.getValue() || catalog_stmt.getQuerytype() == QueryType.UPDATE.getValue() || catalog_stmt.getQuerytype() == QueryType.DELETE.getValue()) {
            this.proc_readonly = false;
        }
View Full Code Here

TOP

Related Classes of org.voltdb.types.QueryType

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.