@Override
    public ResultSet getTables(String catalog, String schemaPattern, String tableNamePattern, String[] types) throws SQLException {
        log.info("getTables: catalog={}, schemaPattern={}, tableNamePattern={}, types={}", catalog, schemaPattern, tableNamePattern, types);
        // TODO: when switch between catalog and schema is implemented, then TABLE_SCHEMA and TABLE_CAT should be populated accordingly
//        String commentColumn = connection.getServerVersion().check("[21.6,)") ? "t.comment" : "''";
        // TODO: handle useCatalogs == true and return schema catalog name
        if (types == null || types.length == 0) {
            types = TABLE_TYPES;
        }

        String sql = "SELECT " +
                 catalogPlaceholder + " AS TABLE_CAT, " +
                "t.database AS TABLE_SCHEM, " +
                "t.name AS TABLE_NAME, " +
                "CASE WHEN t.engine LIKE '%Log' THEN 'LOG TABLE' " +
                "WHEN t.engine in ('Buffer', 'Memory', 'Set') THEN 'MEMORY TABLE' " +
                "WHEN t.is_temporary != 0 THEN 'TEMPORARY TABLE' " +
                "WHEN t.engine like '%View' THEN 'VIEW'" +
                "WHEN t.engine = 'Dictionary' THEN 'DICTIONARY' " +
                "WHEN t.engine LIKE 'Async%' OR t.engine LIKE 'System%' THEN 'SYSTEM TABLE' " +
                "WHEN empty(t.data_paths) THEN 'REMOTE TABLE' " +
                "ELSE 'TABLE' END AS TABLE_TYPE, " +
                "t.comment AS REMARKS, " +
                "null AS TYPE_CAT, " + // no types catalog
                "d.engine AS TYPE_SCHEM, " + // no types schema
                "null AS TYPE_NAME, " + // vendor type name ?
                "null AS SELF_REFERENCING_COL_NAME, " +
                "null AS REF_GENERATION" +
                " FROM system.tables t" +
                " JOIN system.databases d ON system.tables.database = system.databases.name" +
                " WHERE t.database LIKE '" + (schemaPattern == null ? "%" : schemaPattern) + "'" +
                " AND t.name LIKE '" + (tableNamePattern == null ? "%" : tableNamePattern) + "'" +
                " AND TABLE_TYPE IN ('" + String.join("','", types) + "')";

        try {
            return connection.createStatement().executeQuery(sql);
        } catch (Exception e) {
            throw ExceptionUtils.toSqlState(e);
        }
    }
Returns tables defined for a schema. Parameter {@code catalog} is ignored

@return - ResultSet with information about tables
@throws SQLException
jdbc-v2/src/main/java/com/clickhouse/jdbc/metadata/DatabaseMetaDataImpl.java