Package com.oltpbenchmark.catalog

Examples of com.oltpbenchmark.catalog.Table


        LOG.info("*** START " + tableName);
        final AbstractTableGenerator generator = this.generators.get(tableName);
        assert (generator != null);

        // Generate Data
        final Table catalog_tbl = benchmark.getCatalog().getTable(tableName);
        assert(catalog_tbl != null) : tableName;
        final List<Object[]> volt_table = generator.getVoltTable();
        final String sql = SQLUtil.getInsertSQL(catalog_tbl);
        final PreparedStatement stmt = conn.prepareStatement(sql);
        final int types[] = catalog_tbl.getColumnTypes();
       
        while (generator.hasMore()) {
            generator.generateBatch();
           
//            StringBuilder sb = new StringBuilder();
View Full Code Here


        // and then check to make sure that our tables aren't empty
        this.benchmark.loadDatabase(this.conn);
        Histogram<String> tableSizes = new Histogram<String>();
        for (String tableName : this.catalog.getTableNames()) {
            if (this.ignoreTables.contains(tableName.toUpperCase())) continue;
            Table catalog_tbl = this.catalog.getTable(tableName);
           
            sql = SQLUtil.getCountSQL(catalog_tbl);
            result = stmt.executeQuery(sql);
            assertNotNull(result);
            boolean adv = result.next();
View Full Code Here

     * @author Djellel
     * Load num_users users.
     * @throws SQLException
     */
    protected void loadUsers() throws SQLException {
        Table catalog_tbl = this.getTableCatalog(TwitterConstants.TABLENAME_USER);
        assert(catalog_tbl != null);
        String sql = SQLUtil.getInsertSQL(catalog_tbl);
        PreparedStatement userInsert = this.conn.prepareStatement(sql);
       
        NameHistogram name_h = new NameHistogram();
View Full Code Here

     * The number of tweets is fixed to num_tweets
     * We simply select using the distribution who issued the tweet
     * @throws SQLException
     */
    protected void loadTweets() throws SQLException {
        Table catalog_tbl = this.getTableCatalog(TwitterConstants.TABLENAME_TWEETS);
        assert(catalog_tbl != null);
        String sql = SQLUtil.getInsertSQL(catalog_tbl);
        PreparedStatement tweetInsert = this.conn.prepareStatement(sql);
       
        int total = 0;
View Full Code Here

     * ZipfianGenerator (describes the followed most)
     * ScrambledZipfianGenerator (describes the heavy tweeters)
     * @throws SQLException
     */
    protected void loadFollowData() throws SQLException {
        Table catalog_tbl = this.getTableCatalog(TwitterConstants.TABLENAME_FOLLOWS);
        assert(catalog_tbl != null);
        final PreparedStatement followsInsert = this.conn.prepareStatement(SQLUtil.getInsertSQL(catalog_tbl));

        catalog_tbl = this.getTableCatalog(TwitterConstants.TABLENAME_FOLLOWERS);
        assert(catalog_tbl != null);
View Full Code Here

     * Get the catalog object for the given table name
     * @param tableName
     * @return
     */
    public Table getTableCatalog(String tableName) {
        Table catalog_tbl = this.benchmark.getCatalog().getTable(tableName.toUpperCase());
        assert(catalog_tbl != null) : "Invalid table name '" + tableName + "'";
        return (catalog_tbl);
    }
View Full Code Here

     */
    protected void loadFixedTables() {
        for (String table_name : SEATSConstants.TABLES_DATAFILES) {
            LOG.debug(String.format("Loading table '%s' from fixed file", table_name));
            try {   
                Table catalog_tbl = this.getTableCatalog(table_name);
                assert(catalog_tbl != null);
                Iterable<Object[]> iterable = this.getFixedIterable(catalog_tbl);
                this.loadTable(catalog_tbl, iterable, 5000);
            } catch (Throwable ex) {
                throw new RuntimeException("Failed to load data files for fixed-sized table '" + table_name + "'", ex);
View Full Code Here

        // IMPORTANT: FLIGHT must come before FREQUENT_FLYER so that we
        // can use the flights_per_airline histogram when selecting an airline to
        // create a new FREQUENT_FLYER account for a CUSTOMER
        for (String table_name : SEATSConstants.TABLES_SCALING) {
            try {
                Table catalog_tbl = this.getTableCatalog(table_name);
                assert(catalog_tbl != null);
                Iterable<Object[]> iterable = this.getScalingIterable(catalog_tbl);
                this.loadTable(catalog_tbl, iterable, 5000);
            } catch (Throwable ex) {
                throw new RuntimeException("Failed to load data files for scaling-sized table '" + table_name + "'", ex);
View Full Code Here

    protected final void saveProfile(Connection conn) throws SQLException {
        this.loaderStopTime = new Timestamp(System.currentTimeMillis());
       
        // CONFIG_PROFILE
        Table catalog_tbl = this.benchmark.getCatalog().getTable(AuctionMarkConstants.TABLENAME_CONFIG_PROFILE);
        assert(catalog_tbl != null);
        PreparedStatement stmt = conn.prepareStatement(SQLUtil.getInsertSQL(catalog_tbl));
        int param_idx = 1;
        stmt.setObject(param_idx++, this.scale_factor); // CFP_SCALE_FACTOR
        stmt.setObject(param_idx++, this.loaderStartTime); // CFP_LOADER_START
View Full Code Here

     */
    protected final void saveProfile(Connection conn) throws SQLException {
        PreparedStatement stmt = null;
       
        // CONFIG_PROFILE
        Table catalog_tbl = this.catalog.getTable(SEATSConstants.TABLENAME_CONFIG_PROFILE);
        assert(catalog_tbl != null);
        stmt = conn.prepareStatement(SQLUtil.getInsertSQL(catalog_tbl));
        int param_idx = 1;
        stmt.setObject(param_idx++, this.scale_factor);                  // CFP_SCALE_FACTOR
        stmt.setObject(param_idx++, this.airport_max_customer_id.toJSONString()); // CFP_AIPORT_MAX_CUSTOMER
        stmt.setObject(param_idx++, this.flight_start_date);             // CFP_FLIGHT_START
        stmt.setObject(param_idx++, this.flight_upcoming_date);          // CFP_FLIGHT_UPCOMING
        stmt.setObject(param_idx++, this.flight_past_days);              // CFP_FLIGHT_PAST_DAYS
        stmt.setObject(param_idx++, this.flight_future_days);            // CFP_FLIGHT_FUTURE_DAYS
        stmt.setObject(param_idx++, this.flight_upcoming_offset);        // CFP_FLIGHT_OFFSET
        stmt.setObject(param_idx++, this.reservation_upcoming_offset);   // CFP_RESERVATION_OFFSET
        stmt.setObject(param_idx++, this.num_reservations);              // CFP_NUM_RESERVATIONS
        stmt.setObject(param_idx++, JSONUtil.toJSONString(this.code_id_xref)); // CFP_CODE_ID_XREF
        int result = stmt.executeUpdate();
        stmt.close();
        assert(result == 1);
        if (LOG.isDebugEnabled())
            LOG.debug("Saved profile information into " + catalog_tbl.getName());
       
        // CONFIG_HISTOGRAMS
        catalog_tbl = this.catalog.getTable(SEATSConstants.TABLENAME_CONFIG_HISTOGRAMS);
        stmt = conn.prepareStatement(SQLUtil.getInsertSQL(catalog_tbl));
        for (Entry<String, Histogram<String>> e : this.airport_histograms.entrySet()) {
            param_idx = 1;
            stmt.setObject(param_idx++, e.getKey());                    // CFH_NAME
            stmt.setObject(param_idx++, e.getValue().toJSONString());   // CFH_DATA
            stmt.setObject(param_idx++, 1);                             // CFH_IS_AIRPORT
            result = stmt.executeUpdate();
            assert(result == 1);
        } // FOR
        if (LOG.isDebugEnabled())
            LOG.debug("Saved airport histogram information into " + catalog_tbl.getName());
       
        for (Entry<String, Histogram<String>> e : this.histograms.entrySet()) {
            param_idx = 1;
            stmt.setObject(param_idx++, e.getKey());                    // CFH_NAME
            stmt.setObject(param_idx++, e.getValue().toJSONString());   // CFH_DATA
            stmt.setObject(param_idx++, 0);                             // CFH_IS_AIRPORT
            result = stmt.executeUpdate();
            assert(result == 1);
        } // FOR
        stmt.close();
        if (LOG.isDebugEnabled())
            LOG.debug("Saved benchmark histogram information into " + catalog_tbl.getName());

        return;
    }
View Full Code Here

TOP

Related Classes of com.oltpbenchmark.catalog.Table

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.