protected boolean useHeavyweightClient() {
return true;
}
protected void buildConstraints() {
Expression constraint = null;
// WAREHOUSE table
Expression w_id = Verification.inRange("W_ID", (short) m_scaleParams.starting_warehouse,
(short) (m_scaleParams.warehouses * 2) + m_scaleParams.starting_warehouse);
Expression w_tax = Verification.inRange("W_TAX", TPCCConstants.MIN_TAX,
TPCCConstants.MAX_TAX);
Expression w_fk = new ForeignKeyConstraints("WAREHOUSE");
Expression warehouse = Verification.conjunction(ExpressionType.CONJUNCTION_AND,
w_id, w_tax, w_fk);
// DISTRICT table
Expression d_id = Verification.inRange("D_ID", (byte) 1,
(byte) m_scaleParams.districtsPerWarehouse);
Expression d_w_id = Verification.inRange("D_W_ID", (short) m_scaleParams.starting_warehouse,
(short) (m_scaleParams.warehouses * 2) + m_scaleParams.starting_warehouse);
Expression d_next_o_id = Verification.inRange("D_NEXT_O_ID", 1, 10000000);
Expression d_tax = Verification.inRange("D_TAX", TPCCConstants.MIN_TAX,
TPCCConstants.MAX_TAX);
Expression d_fk = new ForeignKeyConstraints("DISTRICT");
Expression district = Verification.conjunction(ExpressionType.CONJUNCTION_AND,
d_id, d_w_id, d_next_o_id, d_tax,
d_fk);
// CUSTOMER table
Expression c_id = Verification.inRange("C_ID", 1,
m_scaleParams.customersPerDistrict);
Expression c_d_id = Verification.inRange("C_D_ID", (byte) 1,
(byte) m_scaleParams.districtsPerWarehouse);
Expression c_w_id = Verification.inRange("C_W_ID", (short) m_scaleParams.starting_warehouse,
(short) (m_scaleParams.warehouses * 2) + m_scaleParams.starting_warehouse);
Expression c_discount = Verification.inRange("C_DISCOUNT", TPCCConstants.MIN_DISCOUNT,
TPCCConstants.MAX_DISCOUNT);
Expression c_credit =
Verification.conjunction(ExpressionType.CONJUNCTION_OR,
Verification.compareWithConstant(ExpressionType.COMPARE_EQUAL,
"C_CREDIT",
TPCCConstants.GOOD_CREDIT),
Verification.compareWithConstant(ExpressionType.COMPARE_EQUAL,
"C_CREDIT",
TPCCConstants.BAD_CREDIT));
Expression c_fk = new ForeignKeyConstraints("CUSTOMER");
Expression customer = Verification.conjunction(ExpressionType.CONJUNCTION_AND,
c_id, c_d_id, c_w_id, c_discount, c_credit,
c_fk);
// HISTORY table
Expression h_c_id = Verification.inRange("H_C_ID", 1,
m_scaleParams.customersPerDistrict);
Expression h_c_d_id = Verification.inRange("H_C_D_ID", (byte) 1,
(byte) m_scaleParams.districtsPerWarehouse);
Expression h_c_w_id = Verification.inRange("H_C_W_ID", (short) m_scaleParams.starting_warehouse,
(short) (m_scaleParams.warehouses * 2) + m_scaleParams.starting_warehouse);
Expression h_d_id = Verification.inRange("H_D_ID", (byte) 1,
(byte) m_scaleParams.districtsPerWarehouse);
Expression h_w_id = Verification.inRange("H_W_ID", (short) m_scaleParams.starting_warehouse,
(short) (m_scaleParams.warehouses * 2) + m_scaleParams.starting_warehouse);
Expression h_fk = new ForeignKeyConstraints("HISTORY");
Expression history = Verification.conjunction(ExpressionType.CONJUNCTION_AND,
h_c_id, h_c_d_id, h_c_w_id, h_d_id, h_w_id,
h_fk);
// NEW_ORDER table
Expression no_o_id = Verification.inRange("NO_O_ID", 1, 10000000);
Expression no_d_id = Verification.inRange("NO_D_ID", (byte) 1,
(byte) m_scaleParams.districtsPerWarehouse);
Expression no_w_id = Verification.inRange("NO_W_ID", (short) m_scaleParams.starting_warehouse,
(short) (m_scaleParams.warehouses * 2) + m_scaleParams.starting_warehouse);
Expression no_fk = new ForeignKeyConstraints("NEW_ORDER");
Expression new_order = Verification.conjunction(ExpressionType.CONJUNCTION_AND,
no_o_id, no_d_id, no_w_id, no_fk);
// ORDERS table
Expression o_id = Verification.inRange("O_ID", 1, 10000000);
Expression o_c_id = Verification.inRange("O_C_ID", 1,
m_scaleParams.customersPerDistrict);
Expression o_d_id = Verification.inRange("O_D_ID", (byte) 1,
(byte) m_scaleParams.districtsPerWarehouse);
Expression o_w_id = Verification.inRange("O_W_ID", (short) m_scaleParams.starting_warehouse,
(short) (m_scaleParams.warehouses * 2) + m_scaleParams.starting_warehouse);
Expression o_carrier_id =
Verification.conjunction(ExpressionType.CONJUNCTION_OR,
Verification.compareWithConstant(ExpressionType.COMPARE_EQUAL,
"O_CARRIER_ID",
(int) TPCCConstants.NULL_CARRIER_ID),
Verification.inRange("O_CARRIER_ID",
TPCCConstants.MIN_CARRIER_ID,
TPCCConstants.MAX_CARRIER_ID));
Expression o_fk = new ForeignKeyConstraints("ORDERS");
Expression orders = Verification.conjunction(ExpressionType.CONJUNCTION_AND,
o_id, o_c_id, o_d_id, o_w_id, o_carrier_id,
o_fk);
// ORDER_LINE table
Expression ol_o_id = Verification.inRange("OL_O_ID", 1, 10000000);
Expression ol_d_id = Verification.inRange("OL_D_ID", (byte) 1,
(byte) m_scaleParams.districtsPerWarehouse);
Expression ol_w_id = Verification.inRange("OL_W_ID", (short) m_scaleParams.starting_warehouse,
(short) (m_scaleParams.warehouses * 2) + m_scaleParams.starting_warehouse);
Expression ol_number = Verification.inRange("OL_NUMBER", 1,
TPCCConstants.MAX_OL_CNT);
Expression ol_i_id = Verification.inRange("OL_I_ID", 1, m_scaleParams.num_items);
Expression ol_supply_w_id = Verification.inRange("OL_SUPPLY_W_ID", (short) m_scaleParams.starting_warehouse,
(short) (m_scaleParams.warehouses * 2) + m_scaleParams.starting_warehouse);
Expression ol_quantity = Verification.inRange("OL_QUANTITY", 0,
TPCCConstants.MAX_OL_QUANTITY);
Expression ol_amount = Verification.inRange("OL_AMOUNT",
0.0,
TPCCConstants.MAX_PRICE * TPCCConstants.MAX_OL_QUANTITY);
Expression ol_fk = new ForeignKeyConstraints("ORDER_LINE");
Expression order_line = Verification.conjunction(ExpressionType.CONJUNCTION_AND,
ol_o_id, ol_d_id, ol_w_id, ol_number,
ol_i_id, ol_supply_w_id, ol_quantity,
ol_amount, ol_fk);
// ITEM table
Expression i_id = Verification.inRange("I_ID", 1, m_scaleParams.num_items);
Expression i_im_id = Verification.inRange("I_IM_ID", TPCCConstants.MIN_IM,
TPCCConstants.MAX_IM);
Expression i_price = Verification.inRange("I_PRICE", TPCCConstants.MIN_PRICE,
TPCCConstants.MAX_PRICE);
Expression i_fk = new ForeignKeyConstraints("ITEM");
Expression item = Verification.conjunction(ExpressionType.CONJUNCTION_AND,
i_id, i_im_id, i_price, i_fk);
// STOCK table
Expression s_i_id = Verification.inRange("S_I_ID", 1, m_scaleParams.num_items);
Expression s_w_id = Verification.inRange("S_W_ID", (short) m_scaleParams.starting_warehouse,
(short) (m_scaleParams.warehouses * 2) + m_scaleParams.starting_warehouse);
Expression s_quantity = Verification.inRange("S_QUANTITY", TPCCConstants.MIN_QUANTITY,
TPCCConstants.MAX_QUANTITY);
Expression s_fk = new ForeignKeyConstraints("STOCK");
Expression stock = Verification.conjunction(ExpressionType.CONJUNCTION_AND,
s_i_id, s_w_id, s_quantity, s_fk);
// Delivery (no need to check 'd_id', it's systematically generated)
constraint = Verification.conjunction(ExpressionType.CONJUNCTION_AND,
d_id, o_id);