diff --git a/src/sqlancer/clickhouse/oracle/tlp/ClickHouseTLPDistinctOracle.java b/src/sqlancer/clickhouse/oracle/tlp/ClickHouseTLPDistinctOracle.java index 2d2426073..12fa35956 100644 --- a/src/sqlancer/clickhouse/oracle/tlp/ClickHouseTLPDistinctOracle.java +++ b/src/sqlancer/clickhouse/oracle/tlp/ClickHouseTLPDistinctOracle.java @@ -41,7 +41,7 @@ public void check() throws SQLException { } ComparatorHelper.assumeResultSetsAreEqual(resultSet, secondResultSet, originalQueryString, combinedString, - state); + state, ComparatorHelper::canonicalizeResultValue); } } diff --git a/src/sqlancer/clickhouse/oracle/tlp/ClickHouseTLPSetOpOracle.java b/src/sqlancer/clickhouse/oracle/tlp/ClickHouseTLPSetOpOracle.java index 2fc7d8f9e..2b4e319a9 100644 --- a/src/sqlancer/clickhouse/oracle/tlp/ClickHouseTLPSetOpOracle.java +++ b/src/sqlancer/clickhouse/oracle/tlp/ClickHouseTLPSetOpOracle.java @@ -103,13 +103,21 @@ private void checkUnionDistinct() throws SQLException { throw new IgnoreMeException(); } - Set baselineSet = new HashSet<>(baselineRows); - Set branchSet = new HashSet<>(branchRows); + Set baselineSet = toSetIgnoringZeroSign(baselineRows); + Set branchSet = toSetIgnoringZeroSign(branchRows); if (!baselineSet.equals(branchSet)) { throw new AssertionError(formatFailure("UNION_DISTINCT", baseline, branchUnion, baselineRows, branchRows)); } } + private static Set toSetIgnoringZeroSign(List rows) { + Set set = new HashSet<>(); + for (String r : rows) { + set.add(ComparatorHelper.canonicalizeResultValue(r)); + } + return set; + } + private static boolean containsNanOrInfinity(List rows) { for (String r : rows) { if (r == null) { @@ -139,8 +147,8 @@ private void checkIntersect() throws SQLException { if (containsNanOrInfinity(branchRows) || containsNanOrInfinity(intersectRows)) { throw new IgnoreMeException(); } - Set intersectSet = new HashSet<>(intersectRows); - Set branchSet = new HashSet<>(branchRows); + Set intersectSet = toSetIgnoringZeroSign(intersectRows); + Set branchSet = toSetIgnoringZeroSign(branchRows); if (!intersectSet.equals(branchSet)) { throw new AssertionError( "INTERSECT subset violated: branch=" + branchName + " INTERSECT T produced " + intersectRows