Skip to content

Commit 8a10bc3

Browse files
committed
fixed tests for specific version
1 parent 76c335d commit 8a10bc3

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

client-v2/src/test/java/com/clickhouse/client/datatypes/DataTypeTests.java

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -830,9 +830,12 @@ private void testDynamicWith(String withWhat, Object[] values, String[] expected
830830

831831
String table = "test_dynamic_with_" + withWhat;
832832
client.execute("DROP TABLE IF EXISTS " + table).get();
833-
client.execute(tableDefinition(table, "rowId Int32", "field Dynamic"),
834-
(CommandSettings) new CommandSettings().serverSetting("allow_experimental_dynamic_type", "1")
835-
.serverSetting("allow_experimental_time_time64_type", "1")).get();
833+
834+
CommandSettings createTableSettings = (CommandSettings) new CommandSettings().serverSetting("allow_experimental_dynamic_type", "1");
835+
if (isVersionMatch("[25.6,)")) {
836+
createTableSettings.serverSetting("allow_experimental_time_time64_type", "1"); // time64 was introduced in 25.6
837+
}
838+
client.execute(tableDefinition(table, "rowId Int32", "field Dynamic"),createTableSettings).get();
836839

837840
client.register(DTOForDynamicPrimitivesTests.class, client.getTableSchema(table));
838841

@@ -858,10 +861,13 @@ private void testVariantWith(String withWhat, String[] fields, Object[] values,
858861
actualFields[0] = "rowId Int32";
859862
System.arraycopy(fields, 0, actualFields, 1, fields.length);
860863
client.execute("DROP TABLE IF EXISTS " + table).get();
861-
client.execute(tableDefinition(table, actualFields),
862-
(CommandSettings) new CommandSettings()
863-
.serverSetting("allow_experimental_variant_type", "1")
864-
.serverSetting("allow_experimental_time_time64_type", "1")).get();
864+
865+
866+
CommandSettings createTableSettings = (CommandSettings) new CommandSettings().serverSetting("allow_experimental_variant_type", "1");
867+
if (isVersionMatch("[25.6,)")) {
868+
createTableSettings.serverSetting("allow_experimental_time_time64_type", "1"); // time64 was introduced in 25.6
869+
}
870+
client.execute(tableDefinition(table, actualFields),createTableSettings).get();
865871

866872
client.register(DTOForVariantPrimitivesTests.class, client.getTableSchema(table));
867873

0 commit comments

Comments
 (0)