Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion src/test/external/RunSpark.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public static void main(String[] args) throws Exception {
System.out.print(output);
int status = ps.waitFor();
String[] lines = output.split("\n");
if (lines.length < 2 || !"7433139".equals(lines[0]) || !"1.429378704487457E8".equals(lines[1])) {
if (lines.length < 2 || !"7433139".equals(lines[0]) || !sumMatches(lines[1])) {
throw new RuntimeException("Spark SQL test output check failed");
}
if (status == 0) {
Expand All @@ -27,6 +27,18 @@ public static void main(String[] args) throws Exception {
System.exit(status);
}

// Sum of FLOAT values depends on the order in which they are added, physical row order
// of the DuckLake table is not stable across setups, so the last digits can differ.
static boolean sumMatches(String line) {
double expected = 1.429378704487457E8;
try {
double actual = Double.parseDouble(line.trim());
return Math.abs(actual - expected) <= Math.abs(expected) * 1e-9;
} catch (NumberFormatException e) {
return false;
}
}

static String fromEnv(String envVarName, String defaultValue) {
String env = System.getenv(envVarName);
if (null != env) {
Expand Down
Loading