Package org.voltdb.types

Examples of org.voltdb.types.TimestampType


     * stop time if that comes before the next local stop time
     *
     * @return Next stop timestamp, True if it was the local time
     */
    public Pair<TimestampType, Boolean> getNextStopTime() {
        TimestampType next = null;
        Boolean is_local = null;
        TimestampType stop_local = null;
        TimestampType stop_total = null;

        if (this.limit_local_time != null && this.limit_local_time >= 0) {
            stop_local = this.getNextLocalStopTime();
        }
        if (this.limit_total_time != null && this.limit_total_time >= 0) {
View Full Code Here


        tuple[5] = secHandle.getCompanyId(counter); // s_co_id
        tuple[6] = (long)rnd.doubleIncrRange(S_NUM_OUTMin, S_NUM_OUTMax, 1.0); // s_num_out
       
        // start date
        int startDay = rnd.intRange(startDayMin, startDayMax);
        tuple[7] = new TimestampType(EGenDate.getDateFromDayNo(startDay)); // s_start_date
       
        // exchange date
        int exDay = rnd.intRange(startDay, startDayMax);
        tuple[8] = new TimestampType(EGenDate.getDateFromDayNo(exDay)); // s_exch_date
       
        tuple[9] = rnd.doubleIncrRange(S_PEMin, S_PEMax, 0.01); // s_pe
       
        // s_52wk_high
        double wkHigh = rnd.doubleIncrRange(TPCEConstants.minSecPrice + ((TPCEConstants.maxSecPrice - TPCEConstants.minSecPrice) / 2),
                TPCEConstants.maxSecPrice, 0.01);
        int wkDay = rnd.intRange(currDay - 7 * 52, currDay); // 7 days per week, 52 weeks per year
        tuple[10] = wkHigh; // s_52wk_high
        tuple[11] = new TimestampType(EGenDate.getDateFromDayNo(wkDay)); // s_52wk_high_date
       
        // s_52wk_low
        double wkLow = rnd.doubleIncrRange(TPCEConstants.minSecPrice, wkHigh, 0.01);
        wkDay = rnd.intRange(currDay - 7 * 52, currDay); // 7 days per week, 52 weeks per year
        tuple[12] = wkLow; // s_52wk_low
        tuple[13] = new TimestampType(EGenDate.getDateFromDayNo(wkDay)); // s_52wk_low_date
       
        double yield, dividend;
        if (rnd.rndPercent(percentCompaniesWithNonZeroDividend)) {
            yield = rnd.doubleIncrRange(S_YIELDNonZeroMin, S_YIELDMax, 0.01);
            dividend = rnd.doubleIncrRange(yield * 0.2, yield * 0.3, 0.01);
View Full Code Here

   
    @Override
    protected void setUp() throws Exception {
        super.setUp();
        this.customer_id = 100000l;
        this.flight_date = new TimestampType();
    }
View Full Code Here

    /**
     * testCalculateReturnDate
     */
    public void testCalculateReturnDate() {
        for (int return_day : this.return_days) {
            TimestampType return_flight_date = ReturnFlight.calculateReturnDate(this.flight_date, return_day);
            assertNotNull(return_flight_date);
            assertTrue(this.flight_date.getTime() < return_flight_date.getTime());
        } // FOR
    }
View Full Code Here

    @Test
    public void testExtractParams() throws Exception {
        Object params[] = {
            12345,
            123.45,
            new TimestampType(),
            "This is a string",
        };
       
        StringBuilder paramStr = new StringBuilder();
        for (Object obj : params) {
View Full Code Here

        long c_id = 10; // rng.nextInt((int)profile.num_customers);
        long f_id = 10; // rng.nextInt((int)profile.num_flights);
        long seatnum = rng.nextInt(SEATSConstants.FLIGHTS_NUM_SEATS);
        long attrs[] = new long[SEATSConstants.NEW_RESERVATION_ATTRS_SIZE];
        Arrays.fill(attrs, 9999l);
        Object params[] = { r_id, c_id, f_id, seatnum, 100d, attrs, new TimestampType() };
       
        // Check the number of available seats for this flight
        sql = "SELECT F_SEATS_LEFT " +
              "  FROM " + SEATSConstants.TABLENAME_FLIGHT +
              " WHERE F_ID = " + f_id;
View Full Code Here

     * @param seller_ids - Seller Ids
     * @param bid_ids - ItemBid Ids
     * @return
     */
    public VoltTable run(TimestampType benchmarkTimes[], TimestampType startTime, TimestampType endTime) {
        final TimestampType currentTime = AuctionMarkProfile.getScaledTimestamp(benchmarkTimes[0], benchmarkTimes[1], new TimestampType());
        final boolean debug = LOG.isDebugEnabled();

        if (debug) {
            LOG.debug(String.format("startTime=%s, endTime=%s, currentTime=%s",
                                    startTime, endTime, currentTime));
        }

        final VoltTable ret = new VoltTable(RESULT_COLS);
        int closed_ctr = 0;
        int waiting_ctr = 0;
        int round = 10;
        while (round-- > 0) {
            voltQueueSQL(getDueItems, startTime, endTime);
            final VoltTable[] dueItemsTable = voltExecuteSQL();
            assert (1 == dueItemsTable.length);
            if (dueItemsTable[0].getRowCount() == 0) break;
            if (debug)
                LOG.debug(String.format("Round #%02d - Due Items %d / %d\n%s\n",
                                       round, dueItemsTable[0].getRowCount(), (closed_ctr+waiting_ctr), dueItemsTable[0]));

            boolean with_bids[] = new boolean[dueItemsTable[0].getRowCount()];
            Object output_rows[][] = new Object[with_bids.length][];
            int i = 0;
            while (dueItemsTable[0].advanceRow()) {
                long itemId = dueItemsTable[0].getLong(0);
                long sellerId = dueItemsTable[0].getLong(1);
                double currentPrice = dueItemsTable[0].getDouble(2);
                long numBids = dueItemsTable[0].getLong(3);
                TimestampType endDate = dueItemsTable[0].getTimestampAsTimestamp(4);
                ItemStatus itemStatus = ItemStatus.get(dueItemsTable[0].getLong(5));
               
                if (debug)
                    LOG.debug(String.format("Getting max bid for itemId=%d / sellerId=%d", itemId, sellerId));
                assert(itemStatus == ItemStatus.OPEN);
View Full Code Here

                VoltTable vt = new VoltTable(ResultsColumns);
                AntiCacheManagerProfiler profiler = hstore_site.getAntiCacheManager().getDebugContext().getProfiler(this.partitionId);
                assert(profiler != null);
                for (EvictionHistory eh : profiler.eviction_history) {
                    Object row[] = {
                        new TimestampType(),
                        this.hstore_site.getSiteId(),
                        this.hstore_site.getSiteName(),
                        this.partitionId,
                        eh.startTimestamp,
                        eh.stopTimestamp,
View Full Code Here

            // ----------------------------------------------------------------------------
            case DISTRIBUTE_ID: {
                VoltTable vt = new VoltTable(ACCESS_HISTORY);
                AntiCacheManagerProfiler profiler = hstore_site.getAntiCacheManager().getDebugContext().getProfiler(this.partitionId);
                assert(profiler != null);
                TimestampType timestamp = new TimestampType();
                for (AccessHistory eah : profiler.evictedaccess_history) {
                    String procName = catalogContext.getProcedureById(eah.procId).getName();
                    Object row[] = {
                            timestamp,
                            this.hstore_site.getSiteId(),
View Full Code Here

        int month= cal.get(Calendar.MONTH);
        int day = cal.get(Calendar.DAY_OF_MONTH);
       
        cal.clear();
        cal.set(year, month, day);
        return (new TimestampType(cal.getTime()));
    }
View Full Code Here

TOP

Related Classes of org.voltdb.types.TimestampType

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.