@Override
    @SuppressWarnings({"squid:S2095", "squid:S2077"})
    public ResultSet getColumns(String catalog, String schemaPattern, String tableNamePattern, String columnNamePattern) throws SQLException {
        //TODO: Best way to convert type to JDBC data type
        // TODO: handle useCatalogs == true and return schema catalog name
        String sql = "SELECT " +
                catalogPlaceholder + " AS TABLE_CAT, " +
                "database AS TABLE_SCHEM, " +
                "table AS TABLE_NAME, " +
                "name AS COLUMN_NAME, " +
                "system.columns.type AS DATA_TYPE, " +
                "type AS TYPE_NAME, " +
                generateSqlTypeSizes("system.columns.type") + " AS COLUMN_SIZE, " +
                "toInt32(0) AS BUFFER_LENGTH, " +
                "IF (numeric_scale == 0, NULL, numeric_scale) as DECIMAL_DIGITS,  " +
                "toInt32(numeric_precision_radix) AS NUM_PREC_RADIX, " +
                "toInt32(position(type, 'Nullable(') >= 1 ?" + java.sql.DatabaseMetaData.typeNullable + " : " + java.sql.DatabaseMetaData.typeNoNulls + ") as NULLABLE, " +
                "system.columns.comment AS REMARKS, " +
                "system.columns.default_expression AS COLUMN_DEF, " +
                "toInt32(0) AS SQL_DATA_TYPE, " +
                "toInt32(0) AS SQL_DATETIME_SUB, " +
                "character_octet_length AS CHAR_OCTET_LENGTH, " +
                "toInt32(system.columns.position) AS ORDINAL_POSITION, " +
                "position(upper(type), 'NULLABLE') >= 1 ? 'YES' : 'NO' AS IS_NULLABLE," +
                "NULL AS SCOPE_CATALOG, " +
                "NULL AS SCOPE_SCHEMA, " +
                "NULL AS SCOPE_TABLE, " +
                "NULL AS SOURCE_DATA_TYPE, " +
                "'NO' as IS_AUTOINCREMENT, " +
                "'NO' as IS_GENERATEDCOLUMN " +
                " FROM system.columns" +
                " WHERE database LIKE '" + (schemaPattern == null ? "%" : SqlParser.escapeQuotes(schemaPattern)) + "'" +
                " AND table LIKE '" + (tableNamePattern == null ? "%" : SqlParser.escapeQuotes(tableNamePattern)) + "'" +
                " AND name LIKE '" + (columnNamePattern == null ? "%" : SqlParser.escapeQuotes(columnNamePattern)) + "'" +
                " ORDER BY TABLE_SCHEM, TABLE_NAME, ORDINAL_POSITION";
        try {
            return new MetadataResultSet((ResultSetImpl) connection.createStatement().executeQuery(sql))
                    .transform(DATA_TYPE_COL.getColumnName(), DATA_TYPE_COL, DatabaseMetaDataImpl::columnDataTypeToSqlType);
        } catch (Exception e) {
            throw ExceptionUtils.toSqlState(e);
        }
    }
Returns name of the ClickHouse table types as the broad category (rather than engine name).
@return - ResultSet with one column TABLE_TYPE
@throws SQLException - if an error occurs
jdbc-v2/src/main/java/com/clickhouse/jdbc/metadata/DatabaseMetaDataImpl.java