peloton-test icon indicating copy to clipboard operation
peloton-test copied to clipboard

Assertion fail for identical output

Open hzxa21 opened this issue 8 years ago • 1 comments

When running the testing framework on Peloton against Postgres using TPCC traces, the assertion (https://github.com/cmu-db/peloton-test/blob/master/src/main/java/edu/cmu/cs/db/peloton/test/common/TestContainer.java#L57) fails although both of them produced identical result. This bug is probably originated from comparing decimal values.

Here is the output xml:

<?xml version="1.0" encoding="UTF-8" ?>
<testsuite errors="0" failures="1" hostname="osboxes" name="test[637: SELECT I_PRICE, I_NAME , I_DATA FROM ITEM WHERE I_ID = 55015](edu.cmu.cs.db.peloton.test.common.TestContainer)" skipped="0" tests="1" time="0.002" timestamp="2017-04-16T06:48:42">
  <properties />
  <testcase classname="edu.cmu.cs.db.peloton.test.app.JUnitRunner$DescriptionAsTest" name="test[637: SELECT I_PRICE, I_NAME , I_DATA FROM ITEM WHERE I_ID = 55015](edu.cmu.cs.db.peloton.test.common.TestContainer)" time="0.002">
    <error message="expected: java.util.HashSet&lt;[[81.44, bxpsckfnunetlxjowjf, lwmdjaqsupwqajspcqowdmphlbbq]]&gt; but was: java.util.HashSet&lt;[[81.44, bxpsckfnunetlxjowjf, lwmdjaqsupwqajspcqowdmphlbbq]]&gt;" type="java.lang.AssertionError">java.lang.AssertionError: expected: java.util.HashSet&lt;[[81.44, bxpsckfnunetlxjowjf, lwmdjaqsupwqajspcqowdmphlbbq]]&gt; but was: java.util.HashSet&lt;[[81.44, bxpsckfnunetlxjowjf, lwmdjaqsupwqajspcqowdmphlbbq]]&gt;
	at edu.cmu.cs.db.peloton.test.common.TestContainer.testEqual(TestContainer.java:57)
	at edu.cmu.cs.db.peloton.test.common.TestContainer.test(TestContainer.java:42)
	at edu.cmu.cs.db.peloton.test.app.JUnitRunner.runTests(JUnitRunner.java:41)
	at edu.cmu.cs.db.peloton.test.app.Main.main(Main.java:41)
</error>
  </testcase>
  <system-out><![CDATA[]]></system-out>
  <system-err><![CDATA[]]></system-err>
</testsuite>

And the CREATE, INSERT and SELECT queries are:

-- Postgres DDL
CREATE TABLE item (
  i_id int NOT NULL,
  i_name varchar(24) NOT NULL,
  i_price decimal(5,2) NOT NULL,
  i_data varchar(50) NOT NULL,
  i_im_id int NOT NULL,
  PRIMARY KEY (i_id)
);

-- Peloton DDL
CREATE TABLE item (
  i_id int NOT NULL PRIMARY KEY,
  i_name varchar(24) NOT NULL,
  i_price decimal(5,2) NOT NULL,
  i_data varchar(50) NOT NULL,
  i_im_id int NOT NULL
);

-- INSERT
INSERT INTO ITEM VALUES(55015, 'bxpsckfnunetlxjowjf', 81.44, 'lwmdjaqsupwqajspcqowdmphlbbq',1);

-- SELECT
SELECT I_PRICE, I_NAME , I_DATA FROM ITEM WHERE I_ID = 55015;

hzxa21 avatar Apr 16 '17 21:04 hzxa21

Most likely because of auto conversion to double resulting in round-off errors

tli2 avatar Apr 27 '17 01:04 tli2