ClickHouse connector returns incorrect results for predicate pushdown on double type with newer ClickHouse server version
Author: ebyhrCreated Sep 25, 2023Updated Sep 28, 2026
Labelscorrectness
ClickHouse server version >= 23.3 returns incorrect results when predicate pushdown happened on double type with specific range. For instance, 3.1415926835 & 1.79769E308 are fine, but 2.225E-307 has an issue.
try (TestTable table = new TestTable(onRemoteDatabase(), "tpch.test_incorrect_double", "(d double) ENGINE=Log")) {
onRemoteDatabase().execute("INSERT INTO " + table.getName() + " VALUES (CAST('2.225E-307' AS double))");
assertQuery("SELECT * FROM " + table.getName(), "VALUES CAST('2.225E-307' AS double)");
assertQueryReturnsEmptyResult("SELECT * FROM " + table.getName() + " WHERE d = CAST('2.225E-307' AS double)");
}The bottom query shouldn't return an empty result, but it passes in newer ClickHouse server versions.
Source: trinodb/trino