Package org.voltdb.catalog

Examples of org.voltdb.catalog.Statement


     * testGetPartitionsStatement
     */
    public void testGetPartitionsStatement() throws Exception {
        Procedure catalog_proc = this.getProcedure("InsertCallForwarding");
        assertNotNull(catalog_proc);
        Statement catalog_stmt = catalog_proc.getStatements().get("query1");
        assertNotNull(catalog_stmt);
       
        Object params[] = new Object[] { new String("Doesn't Matter") };
        p_estimator.getAllPartitions(partitions, catalog_stmt, params, base_partition);
        // System.out.println(catalog_stmt.getName() + " Partitions: " + partitions);
View Full Code Here


    /**
     * testGetPartitionsPlanFragment
     */
    public void testGetPartitionsPlanFragment() throws Exception {
        Procedure catalog_proc = this.getProcedure(GetNewDestination.class);
        Statement catalog_stmt = catalog_proc.getStatements().get("GetData");
        assertNotNull(catalog_stmt);
       
        // System.out.println("Num Partitions: " + CatalogUtil.getNumberOfPartitions(catalog_db));
        Object params[] = new Object[] {
            new Long(54),   // S_ID
            new Long(3),    // SF_TYPE
            new Long(0),    // START_TIME
            new Long(22),   // END_TIME
        };
       
        // We should see one PlanFragment with no partitions and then all others need something
        boolean internal_flag = false;
        for (PlanFragment catalog_frag : catalog_stmt.getMs_fragments()) {
            partitions.clear();
            p_estimator.getPartitions(partitions, catalog_frag, params, base_partition);
            if (partitions.isEmpty()) {
                assertFalse(internal_flag);
                internal_flag = true;
View Full Code Here

    /**
     * testGetAllFragmentPartitions
     */
    public void testGetAllFragmentPartitions() throws Exception {
        Procedure catalog_proc = this.getProcedure(GetNewDestination.class);
        Statement catalog_stmt = catalog_proc.getStatements().get("GetData");
        assertNotNull(catalog_stmt);
       
        // System.out.println("Num Partitions: " + CatalogUtil.getNumberOfPartitions(catalog_db));
        Object params[] = new Object[] {
            new Long(54),   // S_ID
            new Long(3),    // SF_TYPE
            new Long(0),    // START_TIME
            new Long(22),   // END_TIME
        };

        Map<PlanFragment, PartitionSet> all_partitions = new HashMap<PlanFragment, PartitionSet>();
        CatalogMap<PlanFragment> fragments = catalog_stmt.getMs_fragments();
        p_estimator.getAllFragmentPartitions(all_partitions, fragments.values(), params, base_partition);
       
        // We should see one PlanFragment with that only has our local partition and then all others need something
        boolean internal_flag = false;
        for (PlanFragment catalog_frag : fragments) {
View Full Code Here

        MultiColumn mc = MultiColumn.get(catalog_cols);
        assertNotNull(mc);
        catalog_tbl.setPartitioncolumn(mc);
        p_estimator.initCatalog(clone_catalogContext);
       
        Statement catalog_stmt = this.getStatement(clone_db, catalog_proc, "GetData");
        Long params[] = new Long[] {
            new Long(1111), // S_ID
            new Long(1111), // S_ID
            new Long(2222), // SF_TYPE
            new Long(3333), // START_TIME
View Full Code Here

        MultiColumn mc = MultiColumn.get(catalog_cols);
        assertNotNull(mc);
        catalog_tbl.setPartitioncolumn(mc);
        p_estimator.initCatalog(clone_catalogContext);
       
        Statement catalog_stmt = this.getStatement(clone_db, catalog_proc, "GetData");
        Long params[] = new Long[] {
            new Long(1111), // S_ID
            new Long(2222), // AI_TYPE
        };
        Map<String, PartitionSet> partitions = p_estimator.getTablePartitions(catalog_stmt, params, base_partition);
View Full Code Here

    public static Column getColumnForStmtParameter(StmtParameter catalog_stmt_param) {
        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);
View Full Code Here

        Procedure catalog_proc = this.getCatalogItem(catalog_db);
        for (Statement stmt : catalog_proc.getStatements()) {
            counts.put(stmt, 0);
        }
        for (QueryTrace query : this.queries) {
            Statement stmt = query.getCatalogItem(catalog_db);
            assert(stmt != null) : "Invalid query name '" + query.getCatalogItemName() + "' for " + catalog_proc;
            assert(counts.containsKey(stmt)) : "Unexpected " + CatalogUtil.getDisplayName(stmt) + " in " + catalog_proc;
            counts.put(stmt, counts.get(stmt) + 1);
        }
        return (counts);
View Full Code Here

      };
      Long duration = workload.getMaxStartTimestamp() - workload.getMinStartTimestamp();
    for (TransactionTrace txn : workload) {
      for (QueryTrace query : txn.getQueries()) {
       
        Statement stmt = query.getCatalogItem(db);
        Collection<Table> tables = CatalogUtil.getReferencedTables(stmt);
        List<Column> allPrimaryKeyColumns = new ArrayList<Column>();
        for(Table table : tables){
          Collection<Column> cols = CatalogUtil.getPrimaryKeyColumns(table);
          allPrimaryKeyColumns.addAll(cols);         
View Full Code Here

    /**
     * Grabs the parent procedure for this query/statement
     * @return the Procedure catalog object
     */
    public Procedure getCatalogProcedure(Database catalog_db) {
        Statement catalog_stmt = this.getCatalogItem(catalog_db);
        return catalog_stmt.getParent();
    }
View Full Code Here

   
    protected void fromJSONObject(JSONObject object, Procedure catalog_proc) throws JSONException {
        super.fromJSONObject(object, CatalogUtil.getDatabase(catalog_proc));
        this.batch_id = object.getInt(Members.BATCH_ID.name());
       
        Statement catalog_stmt = null;
        if (this.catalog_item_name.contains(":") == false) {
            catalog_stmt = catalog_proc.getStatements().getIgnoreCase(this.catalog_item_name);
        } else {
            catalog_stmt = CatalogKey.getFromKey(CatalogUtil.getDatabase(catalog_proc),
                                                 this.catalog_item_name, Statement.class);
        }
        if (catalog_stmt == null) {
            catalog_stmt = catalog_proc.getStatements().getIgnoreCase(CatalogKey.getNameFromKey(this.catalog_item_name));
            if (catalog_stmt == null) {
                String msg = "Procedure '" + catalog_proc.getName() + "' does not have a Statement '" + this.catalog_item_name + "'";
                msg += "\nValid Statements: " + CatalogUtil.debug(catalog_proc.getStatements());
                throw new JSONException(msg);
            }
        }
        // HACK
        this.catalog_item_name = CatalogKey.createKey(catalog_stmt);
       
        try {
            super.paramsFromJSONObject(object, catalog_stmt.getParameters(), "javatype");
        } catch (Exception ex) {
            LOG.fatal("Failed to load query trace for " + this.catalog_item_name);
            throw new JSONException(ex);
        }
    }
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.