コード例 #1
0
ファイル: executor.py プロジェクト: cmu-db/mongodb-d4
    def generatePaymentParams(self):
        """Return parameters for PAYMENT"""
        x = rand.number(1, 100)
        y = rand.number(1, 100)

        w_id = self.makeWarehouseId()
        d_id = self.makeDistrictId()
        c_w_id = None
        c_d_id = None
        c_id = None
        c_last = None
        h_amount = rand.fixedPoint(2, constants.MIN_PAYMENT, constants.MAX_PAYMENT)
        h_date = datetime.now()

        ## 85%: paying through own warehouse (or there is only 1 warehouse)
        if self.scaleParameters.warehouses == 1 or x <= 85:
            c_w_id = w_id
            c_d_id = d_id
        ## 15%: paying through another warehouse:
        else:
            ## select in range [1, num_warehouses] excluding w_id
            c_w_id = rand.numberExcluding(self.scaleParameters.starting_warehouse, self.scaleParameters.ending_warehouse, w_id)
            assert c_w_id != w_id
            c_d_id = self.makeDistrictId()

        ## 60%: payment by last name
        if y <= 60:
            c_last = rand.makeRandomLastName(self.scaleParameters.customersPerDistrict)
        ## 40%: payment by id
        else:
            assert y > 60
            c_id = self.makeCustomerId()

        return makeParameterDict(locals(), "w_id", "d_id", "h_amount", "c_w_id", "c_d_id", "c_id", "c_last", "h_date")
コード例 #2
0
ファイル: loader.py プロジェクト: cmu-db/mongodb-d4
    def generateCustomer(self, c_w_id, c_d_id, c_id, badCredit, doesReplicateName):
        c_first = rand.astring(constants.MIN_FIRST, constants.MAX_FIRST)
        c_middle = constants.MIDDLE

        assert 1 <= c_id and c_id <= constants.CUSTOMERS_PER_DISTRICT
        if c_id <= 1000:
            c_last = rand.makeLastName(c_id - 1)
        else:
            c_last = rand.makeRandomLastName(constants.CUSTOMERS_PER_DISTRICT)

        c_phone = rand.nstring(constants.PHONE, constants.PHONE)
        c_since = datetime.now()
        c_credit = constants.BAD_CREDIT if badCredit else constants.GOOD_CREDIT
        c_credit_lim = constants.INITIAL_CREDIT_LIM
        c_discount = rand.fixedPoint(constants.DISCOUNT_DECIMALS, constants.MIN_DISCOUNT, constants.MAX_DISCOUNT)
        c_balance = constants.INITIAL_BALANCE
        c_ytd_payment = constants.INITIAL_YTD_PAYMENT
        c_payment_cnt = constants.INITIAL_PAYMENT_CNT
        c_delivery_cnt = constants.INITIAL_DELIVERY_CNT
        c_data = rand.astring(constants.MIN_C_DATA, constants.MAX_C_DATA)

        c_street1 = rand.astring(constants.MIN_STREET, constants.MAX_STREET)
        c_street2 = rand.astring(constants.MIN_STREET, constants.MAX_STREET)
        c_city = rand.astring(constants.MIN_CITY, constants.MAX_CITY)
        c_state = rand.astring(constants.STATE, constants.STATE)
        c_zip = self.generateZip()

        return [ c_id, c_d_id, c_w_id, c_first, c_middle, c_last, \
                c_street1, c_street2, c_city, c_state, c_zip, \
                c_phone, c_since, c_credit, c_credit_lim, c_discount, c_balance, \
                c_ytd_payment, c_payment_cnt, c_delivery_cnt, c_data ]
コード例 #3
0
ファイル: loader.py プロジェクト: greinerb/mongodb-d4
    def generateCustomer(self, c_w_id, c_d_id, c_id, badCredit,
                         doesReplicateName):
        c_first = rand.astring(constants.MIN_FIRST, constants.MAX_FIRST)
        c_middle = constants.MIDDLE

        assert 1 <= c_id and c_id <= constants.CUSTOMERS_PER_DISTRICT
        if c_id <= 1000:
            c_last = rand.makeLastName(c_id - 1)
        else:
            c_last = rand.makeRandomLastName(constants.CUSTOMERS_PER_DISTRICT)

        c_phone = rand.nstring(constants.PHONE, constants.PHONE)
        c_since = datetime.now()
        c_credit = constants.BAD_CREDIT if badCredit else constants.GOOD_CREDIT
        c_credit_lim = constants.INITIAL_CREDIT_LIM
        c_discount = rand.fixedPoint(constants.DISCOUNT_DECIMALS,
                                     constants.MIN_DISCOUNT,
                                     constants.MAX_DISCOUNT)
        c_balance = constants.INITIAL_BALANCE
        c_ytd_payment = constants.INITIAL_YTD_PAYMENT
        c_payment_cnt = constants.INITIAL_PAYMENT_CNT
        c_delivery_cnt = constants.INITIAL_DELIVERY_CNT
        c_data = rand.astring(constants.MIN_C_DATA, constants.MAX_C_DATA)

        c_street1 = rand.astring(constants.MIN_STREET, constants.MAX_STREET)
        c_street2 = rand.astring(constants.MIN_STREET, constants.MAX_STREET)
        c_city = rand.astring(constants.MIN_CITY, constants.MAX_CITY)
        c_state = rand.astring(constants.STATE, constants.STATE)
        c_zip = self.generateZip()

        return [ c_id, c_d_id, c_w_id, c_first, c_middle, c_last, \
                c_street1, c_street2, c_city, c_state, c_zip, \
                c_phone, c_since, c_credit, c_credit_lim, c_discount, c_balance, \
                c_ytd_payment, c_payment_cnt, c_delivery_cnt, c_data ]
コード例 #4
0
ファイル: loader.py プロジェクト: cmu-db/mongodb-d4
    def generateItem(self, id, original):
        i_id = id
        i_im_id = rand.number(constants.MIN_IM, constants.MAX_IM)
        i_name = rand.astring(constants.MIN_I_NAME, constants.MAX_I_NAME)
        i_price = rand.fixedPoint(constants.MONEY_DECIMALS, constants.MIN_PRICE, constants.MAX_PRICE)
        i_data = rand.astring(constants.MIN_I_DATA, constants.MAX_I_DATA)
        if original: i_data = self.fillOriginal(i_data)

        return [i_id, i_im_id, i_name, i_price, i_data]
コード例 #5
0
ファイル: loader.py プロジェクト: greinerb/mongodb-d4
    def generateItem(self, id, original):
        i_id = id
        i_im_id = rand.number(constants.MIN_IM, constants.MAX_IM)
        i_name = rand.astring(constants.MIN_I_NAME, constants.MAX_I_NAME)
        i_price = rand.fixedPoint(constants.MONEY_DECIMALS,
                                  constants.MIN_PRICE, constants.MAX_PRICE)
        i_data = rand.astring(constants.MIN_I_DATA, constants.MAX_I_DATA)
        if original: i_data = self.fillOriginal(i_data)

        return [i_id, i_im_id, i_name, i_price, i_data]
コード例 #6
0
ファイル: loader.py プロジェクト: cmu-db/mongodb-d4
    def generateOrderLine(self, ol_w_id, ol_d_id, ol_o_id, ol_number, max_items, newOrder):
        ol_i_id = rand.number(1, max_items)
        ol_supply_w_id = ol_w_id
        ol_delivery_d = datetime.now()
        ol_quantity = constants.INITIAL_QUANTITY

        if newOrder == False:
            ol_amount = 0.00
        else:
            ol_amount = rand.fixedPoint(constants.MONEY_DECIMALS, constants.MIN_AMOUNT, constants.MAX_PRICE * constants.MAX_OL_QUANTITY)
            ol_delivery_d = None
        ol_dist_info = rand.astring(constants.DIST, constants.DIST)

        return [ ol_o_id, ol_d_id, ol_w_id, ol_number, ol_i_id, ol_supply_w_id, ol_delivery_d, ol_quantity, ol_amount, ol_dist_info ]
コード例 #7
0
ファイル: loader.py プロジェクト: greinerb/mongodb-d4
    def generateOrderLine(self, ol_w_id, ol_d_id, ol_o_id, ol_number,
                          max_items, newOrder):
        ol_i_id = rand.number(1, max_items)
        ol_supply_w_id = ol_w_id
        ol_delivery_d = datetime.now()
        ol_quantity = constants.INITIAL_QUANTITY

        if newOrder == False:
            ol_amount = 0.00
        else:
            ol_amount = rand.fixedPoint(
                constants.MONEY_DECIMALS, constants.MIN_AMOUNT,
                constants.MAX_PRICE * constants.MAX_OL_QUANTITY)
            ol_delivery_d = None
        ol_dist_info = rand.astring(constants.DIST, constants.DIST)

        return [
            ol_o_id, ol_d_id, ol_w_id, ol_number, ol_i_id, ol_supply_w_id,
            ol_delivery_d, ol_quantity, ol_amount, ol_dist_info
        ]
コード例 #8
0
ファイル: executor.py プロジェクト: greinerb/mongodb-d4
    def generatePaymentParams(self):
        """Return parameters for PAYMENT"""
        x = rand.number(1, 100)
        y = rand.number(1, 100)

        w_id = self.makeWarehouseId()
        d_id = self.makeDistrictId()
        c_w_id = None
        c_d_id = None
        c_id = None
        c_last = None
        h_amount = rand.fixedPoint(2, constants.MIN_PAYMENT,
                                   constants.MAX_PAYMENT)
        h_date = datetime.now()

        ## 85%: paying through own warehouse (or there is only 1 warehouse)
        if self.scaleParameters.warehouses == 1 or x <= 85:
            c_w_id = w_id
            c_d_id = d_id
        ## 15%: paying through another warehouse:
        else:
            ## select in range [1, num_warehouses] excluding w_id
            c_w_id = rand.numberExcluding(
                self.scaleParameters.starting_warehouse,
                self.scaleParameters.ending_warehouse, w_id)
            assert c_w_id != w_id
            c_d_id = self.makeDistrictId()

        ## 60%: payment by last name
        if y <= 60:
            c_last = rand.makeRandomLastName(
                self.scaleParameters.customersPerDistrict)
        ## 40%: payment by id
        else:
            assert y > 60
            c_id = self.makeCustomerId()

        return makeParameterDict(locals(), "w_id", "d_id", "h_amount",
                                 "c_w_id", "c_d_id", "c_id", "c_last",
                                 "h_date")
コード例 #9
0
ファイル: loader.py プロジェクト: greinerb/mongodb-d4
 def generateTax(self):
     return rand.fixedPoint(constants.TAX_DECIMALS, constants.MIN_TAX,
                            constants.MAX_TAX)
コード例 #10
0
ファイル: loader.py プロジェクト: cmu-db/mongodb-d4
 def generateTax(self):
     return rand.fixedPoint(constants.TAX_DECIMALS, constants.MIN_TAX, constants.MAX_TAX)