Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,12 @@ public enum ClickHouseDataType implements SQLType {
Ring(Object.class, false, true, true, 0, 0, 0, 0, 0, true), // same as Array(Point)
LineString( Object.class, false, true, true, 0, 0, 0, 0, 0, true), // same as Array(Point)
MultiLineString(Object.class, false, true, true, 0, 0, 0, 0, 0, true), // same as Array(Ring)

JSON(Object.class, false, false, false, 0, 0, 0, 0, 0, true, 0x30),
@Deprecated
@Deprecated // (since = "CH 25.11")
Object(Object.class, true, true, false, 0, 0, 0, 0, 0, true),
String(String.class, false, true, false, 0, 0, 0, 0, 0, false, 0x15, "BINARY LARGE OBJECT", "BINARY VARYING", "BLOB",
"BYTEA", "CHAR", "CHAR LARGE OBJECT", "CHAR VARYING", "CHARACTER", "CHARACTER LARGE OBJECT",
"CHARACTER VARYING", "CLOB", "GEOMETRY", "LONGBLOB", "LONGTEXT", "MEDIUMBLOB", "MEDIUMTEXT",
"CHARACTER VARYING", "CLOB", "LONGBLOB", "LONGTEXT", "MEDIUMBLOB", "MEDIUMTEXT",
"NATIONAL CHAR", "NATIONAL CHAR VARYING", "NATIONAL CHARACTER", "NATIONAL CHARACTER LARGE OBJECT",
"NATIONAL CHARACTER VARYING", "NCHAR", "NCHAR LARGE OBJECT", "NCHAR VARYING", "NVARCHAR", "TEXT",
"TINYBLOB", "TINYTEXT", "VARBINARY", "VARCHAR", "VARCHAR2"),
Expand All @@ -131,6 +130,7 @@ public enum ClickHouseDataType implements SQLType {
Time(LocalDateTime.class, true, false, false, 4, 9, 0, 0, 9, false, 0x32), // 0x33 for Time(Timezone)
Time64(LocalDateTime.class, true, false, false, 8, 9, 0, 0, 0, false, 0x34), // 0x35 for Time64(P, Timezone)
QBit(Double.class, true, true, false, 0, 0, 0, 0, 0, false, 0x36),
Geometry(Object.class, false, false, false, 0, 0, 0, 0, 0, true),
;

public static final List<ClickHouseDataType> ORDERED_BY_RANGE_INT_TYPES =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ public void testVariantWithSimpleDataTypes() throws Exception {
switch (dataType) {
case BFloat16:
case QBit:
case Geometry:
// TODO: add support
continue dataTypesLoop;
// skipped
Expand Down Expand Up @@ -466,6 +467,7 @@ public void testDynamicWithPrimitives() throws Exception {
switch (dataType) {
case BFloat16:
case QBit:
case Geometry:
// TODO: add support
continue;
case Array:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@
assertEquals(rs.getShort("NULLABLE"), DatabaseMetaData.typeNoNulls);
}

if (dataType != ClickHouseDataType.Enum) {
if (dataType != ClickHouseDataType.Enum && dataType != ClickHouseDataType.Geometry) {
assertEquals(rs.getBoolean("CASE_SENSITIVE"), dataType.isCaseSensitive());
}
assertEquals(rs.getInt("SEARCHABLE"), DatabaseMetaData.typeSearchable);
Expand Down Expand Up @@ -478,7 +478,11 @@
nestedTypes.remove(typeName);
}

assertTrue(nestedTypes.isEmpty(), "Nested types " + nestedTypes + " not found");
if (ClickHouseVersion.of(getServerVersion()).check("(,25.10]")) {

Check warning on line 481 in jdbc-v2/src/test/java/com/clickhouse/jdbc/metadata/DatabaseMetaDataTest.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this use of "ClickHouseVersion"; it is deprecated.

See more on https://sonarcloud.io/project/issues?id=ClickHouse_clickhouse-java&issues=AZrmNdZPZ2BdMS4-YBx5&open=AZrmNdZPZ2BdMS4-YBx5&pullRequest=2679
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The version check range "(,25.10]" excludes 25.10 from the lower bound and includes it in the upper bound. However, this means the condition will never be true for exactly version 25.10. Consider using "[,25.10]" to include 25.10 in both bounds, or adjust the range based on the exact version where the behavior changed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry too confusing to understand why upper bound should be included in lower bound.
This expression means that any version from 0 to 25.10 else (when 25.11 or later) do something different.

assertEquals(nestedTypes, Arrays.asList("Geometry")); // Geometry was introduced in 25.11
} else {
assertEquals(nestedTypes, Arrays.asList("Object")); // Object is deprecated in 25.11
}
}
}
}
Expand Down
Loading