From e0fad53b97179d41c9dd534822078c024afb8970 Mon Sep 17 00:00:00 2001 From: Luigi Dell'Aquila Date: Mon, 5 Sep 2022 13:02:15 +0200 Subject: [PATCH] Review unsigned long tests failing due to H2 lower precision --- .../qa/server/src/main/resources/unsigned-long.csv-spec | 8 ++++---- .../qa/server/src/main/resources/unsigned-long.sql-spec | 7 +------ 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/x-pack/plugin/sql/qa/server/src/main/resources/unsigned-long.csv-spec b/x-pack/plugin/sql/qa/server/src/main/resources/unsigned-long.csv-spec index 82852a9af4847..2bbde74ea06cc 100644 --- a/x-pack/plugin/sql/qa/server/src/main/resources/unsigned-long.csv-spec +++ b/x-pack/plugin/sql/qa/server/src/main/resources/unsigned-long.csv-spec @@ -37,11 +37,11 @@ SELECT 9223372036854775807::unsigned_long * 2 AS x; ; arithmeticDivide -SELECT 18446744073709551614 / 2 AS x; +SELECT 18446744073709551614 / 2 AS x, 18446744073709551614 / 7306.0 AS y, 18446744073709551614 / 7306 AS z ; - x:ul ---------------- -9223372036854775807 + x:ul | y:d | z:ul +--------------------+-------------------------+------------------------- +9223372036854775807 | 2.5248760024239735E15 | 2524876002423973 ; arithmeticModulo diff --git a/x-pack/plugin/sql/qa/server/src/main/resources/unsigned-long.sql-spec b/x-pack/plugin/sql/qa/server/src/main/resources/unsigned-long.sql-spec index 7fd38cac21b52..1776b4e6c3311 100644 --- a/x-pack/plugin/sql/qa/server/src/main/resources/unsigned-long.sql-spec +++ b/x-pack/plugin/sql/qa/server/src/main/resources/unsigned-long.sql-spec @@ -10,6 +10,7 @@ // RAND takes an int. // ROUND only works for values < Long.MAX_VALUE // ES's CEIL & FLOOR don't work with unsigned_longs (TODO) + they can return longs, while H2's always returns doubles +// Divide and Modulo operations lose precision in H2 on big numbers (led to random failures in the past, so they were removed) plus SELECT 18446744073709551614 + 1 AS x; @@ -17,14 +18,8 @@ plusLongMax SELECT 9223372036854775808 + ROUND(RAND(DAY(CURRENT_TIMESTAMP())) * 10000) AS x; minus SELECT 18446744073709551615 - ROUND(RAND(DAY(CURRENT_TIMESTAMP())) * 10000) AS x; -// AwaitsFix https://github.com/elastic/elasticsearch/issues/83516 -divide-Ignore -SELECT 18446744073709551615 / ROUND(RAND(DAY(CURRENT_TIMESTAMP())) * 10000) AS x; multiply SELECT 18446744073709551615 * 1 AS x; -// AwaitsFix https://github.com/elastic/elasticsearch/issues/83516 -mod-Ignore -SELECT 18446744073709551615 % ROUND(RAND(DAY(CURRENT_TIMESTAMP())) * 10000) AS x; abs SELECT ABS(9223372036854775808 + ROUND(RAND(DAY(CURRENT_TIMESTAMP())) * 10000)) AS x;