File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed
main/java/com/clickhouse/jdbc/metadata
test/java/com/clickhouse/jdbc/metadata Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -897,7 +897,7 @@ private static String generateSqlTypeSizes(String columnName) {
897897 SQLType type = JdbcUtils .CLICKHOUSE_TYPE_NAME_TO_SQL_TYPE_MAP .get (typeName );
898898 if (type == null ) {
899899 try {
900- type = JdbcUtils .convertToSqlType (ClickHouseColumn . of ( "v1" , typeName ). getDataType ( ));
900+ type = JdbcUtils .convertToSqlType (ClickHouseDataType . valueOf ( typeName ));
901901 } catch (Exception e ) {
902902 log .error ("Failed to convert column data type to SQL type: {}" , typeName , e );
903903 type = JDBCType .OTHER ; // In case of error, return SQL type 0
Original file line number Diff line number Diff line change 1919import java .sql .Types ;
2020import java .util .Arrays ;
2121import java .util .Collections ;
22+ import java .util .HashSet ;
2223import java .util .List ;
2324import java .util .Properties ;
25+ import java .util .Set ;
26+ import java .util .stream .Collectors ;
2427
2528import static org .testng .Assert .assertEquals ;
2629import static org .testng .Assert .assertFalse ;
@@ -453,6 +456,24 @@ public void testGetTypeInfo() throws Exception {
453456 }
454457 }
455458
459+ @ Test (groups = {"integration" })
460+ public void testFindNestedTypes () throws Exception {
461+ try (Connection conn = getJdbcConnection ()) {
462+ DatabaseMetaData dbmd = conn .getMetaData ();
463+ try (ResultSet rs = dbmd .getTypeInfo ()) {
464+ Set <String > nestedTypes = Arrays .stream (ClickHouseDataType .values ())
465+ .filter (dt -> dt .isNested ()).map (dt -> dt .name ()).collect (Collectors .toSet ());
466+
467+ while (rs .next ()) {
468+ String typeName = rs .getString ("TYPE_NAME" );
469+ nestedTypes .remove (typeName );
470+ }
471+
472+ assertTrue (nestedTypes .isEmpty (), "Nested types " + nestedTypes + " not found" );
473+ }
474+ }
475+ }
476+
456477 @ Test (groups = { "integration" })
457478 public void testGetFunctions () throws Exception {
458479 if (ClickHouseVersion .of (getServerVersion ()).check ("(,23.8]" )) {
You can’t perform that action at this time.
0 commit comments