From 13a1e3ca4744344556f346909e5b7c43959e0e5e Mon Sep 17 00:00:00 2001 From: Groene AI <270696204+groeneai@users.noreply.github.com> Date: Wed, 25 Nov 2026 12:59:41 +0000 Subject: [PATCH] fix(clickhouse): VariantSubcolumn inserts strings without type inference The oracle inserts each String row as CAST('' AS String) into a Variant(Int64, String) column and expects it to stay a String. The VALUES result is converted to the column type with CAST, and with cast_string_to_variant_use_inference = 1 (the default since 25.4) a String is parsed into the Variant, so the word `null` is stored as NULL (variantType None). Every subcolumn read then correctly returns NULL and the oracle reports "Java expects null but read NULL". Turn the inference off for this INSERT only, so every word lands in the String variant as the model assumes. The subcolumn reads under test are unchanged. Co-Authored-By: Claude Opus 5.5 --- .../oracle/dynamicsub/ClickHouseVariantSubcolumnOracle.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/sqlancer/clickhouse/oracle/dynamicsub/ClickHouseVariantSubcolumnOracle.java b/src/sqlancer/clickhouse/oracle/dynamicsub/ClickHouseVariantSubcolumnOracle.java index dbf6eeb3a..91f49c3af 100644 --- a/src/sqlancer/clickhouse/oracle/dynamicsub/ClickHouseVariantSubcolumnOracle.java +++ b/src/sqlancer/clickhouse/oracle/dynamicsub/ClickHouseVariantSubcolumnOracle.java @@ -115,7 +115,8 @@ private void checkVariant(long id) throws SQLException { throw new IgnoreMeException(); } int rows = 30 + r.getInteger(0, 41); - StringBuilder sb = new StringBuilder("INSERT INTO ").append(table).append(" (k, v) VALUES "); + StringBuilder sb = new StringBuilder("INSERT INTO ").append(table) + .append(" (k, v) SETTINGS cast_string_to_variant_use_inference = 0 VALUES "); for (int i = 0; i < rows; i++) { boolean asInt = Randomly.getBoolean(); if (i > 0) {