TPC-Council / HammerDB

HammerDB Database Load Testing and Benchmarking Tool
http://www.hammerdb.com
GNU General Public License v3.0
545 stars 115 forks source link

TPROC-H o_totalprice calculated incorrectly #609

Closed sm-shaw closed 9 months ago

sm-shaw commented 9 months ago

Describe the bug In the TPROC-H schema build (and refresh function) the TPC-H specification calculates o_totalprice as follows:

o->totalprice +=((o->l[lcnt].eprice (100 - o->l[lcnt].discount)) / PENNIES) (100 + o->l[lcnt].tax) / PENNIES;

HammerDB does the following:

set totalprice [format %4.2f [ expr {$totalprice + [ expr {(($leprice (100 - $ldiscount)) / 100) (100 + $ltax) / 100} ]}]]

However, the TPC-H spec converts to integer first for the calculations and HammerDB using floating point so the calculation is incorrect and orders and lineitem totals do not match.

To Reproduce Check the sum of lineitems for the same orderkey with discount and tax applied and it should be the same as o_totalprice in orders. At the moment it is not the same.

Expected behavior The sum of lineitems for the same orderkey with discount and tax applied is the same as o_totalprice for all orderkeys.

HammerDB Version (please complete the following information):

HammerDB Interface (please complete the following information):

Operating System (please complete the following information):

Database Server (please complete the following information):

Database Client (please complete the following information):

Additional context The fix is for HammerDB to take the same approach as the specification and use integer for the calculations, so they match.