Package org.voltdb.types

Examples of org.voltdb.types.TimestampType


        }

        private TimestampType getRandomStartTimestamp(TimestampType endDate) {
            long duration = ((long)profile.randomDuration.nextInt()) * AuctionMarkConstants.MICROSECONDS_IN_A_DAY;
            long lStartTimestamp = endDate.getTime() - duration;
            TimestampType startTimestamp = new TimestampType(lStartTimestamp);
            return startTimestamp;
        }
View Full Code Here


            TimestampType startTimestamp = new TimestampType(lStartTimestamp);
            return startTimestamp;
        }
        private TimestampType getRandomEndTimestamp() {
            long timeDiff = profile.randomTimeDiff.nextLong();
            TimestampType time = new TimestampType(profile.getBenchmarkStartTime().getTime() + (timeDiff * 1000000));
//            LOG.info(timeDiff + " => " + sdf.format(time.asApproximateJavaDate()));
            return time;
        }
View Full Code Here

//            LOG.info(timeDiff + " => " + sdf.format(time.asApproximateJavaDate()));
            return time;
        }
        private TimestampType getRandomPurchaseTimestamp(TimestampType endDate) {
            long duration = profile.randomPurchaseDuration.nextInt();
            return new TimestampType(endDate.getTime() + duration * AuctionMarkConstants.MICROSECONDS_IN_A_DAY);
        }
View Full Code Here

            // Flights Per Departure Time
            histogram = profile.getHistogram(SEATSConstants.HISTOGRAM_FLIGHTS_PER_DEPART_TIMES)
            this.flight_times = new FlatHistogram<String>(rng, histogram);
           
            // Figure out how many flights that we want for each day
            this.today = new TimestampType();
           
            // Sometimes there are more flights per day, and sometimes there are fewer
            int flightsPerDayMin = (int)Math.round(SEATSConstants.FLIGHTS_PER_DAY_MIN * getScaleFactor());
            int flightsPerDayMax = (int)Math.round(SEATSConstants.FLIGHTS_PER_DAY_MAX * getScaleFactor());
            Gaussian gaussian = new Gaussian(rng, flightsPerDayMin, flightsPerDayMax);
           
            this.total = 0;
            boolean first = true;
            for (long t = this.today.getTime() - (days_past * SEATSConstants.MICROSECONDS_PER_DAY);
                 t < this.today.getTime(); t += SEATSConstants.MICROSECONDS_PER_DAY) {
                TimestampType timestamp = new TimestampType(t);
                if (first) {
                    this.start_date = timestamp;
                    first = false;
                }
                int num_flights = gaussian.nextInt();
                this.flights_per_day.put(timestamp, num_flights);
                this.total += num_flights;
            } // FOR
            if (this.start_date == null) this.start_date = this.today;
            profile.setFlightStartDate(this.start_date);
           
            // This is for upcoming flights that we want to be able to schedule
            // new reservations for in the benchmark
            profile.setFlightUpcomingDate(this.today);
            for (long t = this.today.getTime(), last_date = this.today.getTime() + (days_future * SEATSConstants.MICROSECONDS_PER_DAY);
                 t <= last_date; t += SEATSConstants.MICROSECONDS_PER_DAY) {
                TimestampType timestamp = new TimestampType(t);
                int num_flights = gaussian.nextInt();
                this.flights_per_day.put(timestamp, num_flights);
                this.total += num_flights;
            } // FOR
           
View Full Code Here

                throw new RuntimeException("Invalid MINUTE in time code '" + code + "'", ex);
            }
            assert(minute != -1);
           
            long offset = (hour * 60 * SEATSConstants.MICROSECONDS_PER_MINUTE) + (minute * SEATSConstants.MICROSECONDS_PER_MINUTE);
            return (new TimestampType(base_date.getTime() + offset));
        }
View Full Code Here

            switch (columnIdx) {
                // FLIGHT ID
                case (0): {
                    // Figure out what date we are currently on
                    Integer remaining = null;
                    TimestampType date;
                    do {
                        // Move to the next day.
                        // Make sure that we reset the set of FlightIds that we've used for today
                        if (remaining != null) {
                            this.todays_flights.clear();
View Full Code Here

        if ((slot == byte.class) && (pclass == Byte.class)) return param;
        if ((slot == double.class) && (pclass == Double.class)) return param;
        if ((slot == boolean.class) && (pclass == Boolean.class)) return param;
        if ((slot == String.class) && (pclass == String.class)) return param;
        if (slot == TimestampType.class) {
            if (pclass == Long.class) return new TimestampType((Long)param);
            if (pclass == TimestampType.class) return param;
        }
        if (slot == BigDecimal.class) {
            if (pclass == Long.class) {
                BigInteger bi = new BigInteger(param.toString());
View Full Code Here

            return (col);
        }
        private TimestampType getRandomCommentDate(TimestampType startDate, TimestampType endDate) {
            int start = Math.round(startDate.getTime() / 1000000);
            int end = Math.round(endDate.getTime() / 1000000);
            return new TimestampType((profile.rng.number(start, end)) * 1000 * 1000);
        }
View Full Code Here

            else if (type == VoltType.BIGINT)
                args[ii] = Long.MIN_VALUE;
            else if (type == VoltType.FLOAT)
                args[ii] = VoltType.NULL_DOUBLE;
            else if (type == VoltType.TIMESTAMP)
                args[ii] = new TimestampType(Long.MIN_VALUE);
            else if (type == VoltType.STRING)
                args[ii] = VoltType.NULL_STRING;
            else if (type == VoltType.DECIMAL)
                args[ii] = VoltType.NULL_DECIMAL;
            else
View Full Code Here

                // If this is a new item and there is more than one bid, then
                // we'll choose the bidder's UserId at random.
                // If there is only one bid, then it will have to be the last bidder
                bidderId = (itemInfo.numBids == 1 ? itemInfo.lastBidderId :
                                                    profile.getRandomBuyerId(itemInfo.sellerId));
                TimestampType endDate;
                if (itemInfo.status == ItemStatus.OPEN) {
                    endDate = profile.getBenchmarkStartTime();
                } else {
                    endDate = itemInfo.endDate;
                }
                this.currentCreateDateAdvanceStep = (endDate.getTime() - itemInfo.startDate.getTime()) / (remaining + 1);
                this.currentBidPriceAdvanceStep = itemInfo.initialPrice * AuctionMarkConstants.ITEM_BID_PERCENT_STEP;
            }
            // The last bid must always be the item's lastBidderId
            else if (remaining == 0) {
                bidderId = itemInfo.lastBidderId;
            }
            // The first bid for a two-bid item must always be different than the lastBidderId
            else if (itemInfo.numBids == 2) {
                assert(remaining == 1);
                bidderId = profile.getRandomBuyerId(itemInfo.lastBidderId, itemInfo.sellerId);
            }
            // Since there are multiple bids, we want randomly select one based on the previous bidders
            // We will get the histogram of bidders so that we are more likely to select
            // an existing bidder rather than a completely random one
            else {
                assert(this.bid != null);
                ObjectHistogram<UserId> bidderHistogram = itemInfo.getBidderHistogram();
                bidderId = profile.getRandomBuyerId(bidderHistogram, this.bid.bidderId, itemInfo.sellerId);
            }
            assert(bidderId != null);

            float last_bid = (this.new_item ? itemInfo.initialPrice : this.bid.maxBid);
            this.bid = itemInfo.getNextBid(this.count, bidderId);
            this.bid.createDate = new TimestampType(itemInfo.startDate.getTime() + this.currentCreateDateAdvanceStep);
            this.bid.updateDate = this.bid.createDate;
           
            if (remaining == 0) {
                this.bid.maxBid = itemInfo.currentPrice;
                if (itemInfo.purchaseDate != null) {
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.