@SuppressWarnings("unchecked")
    public <T> List<T> queryAll(String sqlQuery, Class<T> clazz, TableSchema schema, Supplier<T> allocator) {
        Map<String, POJOFieldDeserializer> classDeserializers = pojoSerDe.getFieldDeserializers(clazz, schema);

        if (classDeserializers.isEmpty()) {
            throw new IllegalArgumentException("No deserializers found for the query and class '" + clazz + "'. Did you forget to register it?");
        }

        try {
            int operationTimeout = getOperationTimeout();
            QuerySettings settings = new QuerySettings().setFormat(ClickHouseFormat.RowBinaryWithNamesAndTypes);
            CompletableFuture<QueryResponse> f = query(sqlQuery, settings);
            try (QueryResponse response = operationTimeout == 0 ? f.get() : f.get(operationTimeout, TimeUnit.MILLISECONDS)) {
                List<T> records = new ArrayList<>();
                RowBinaryWithNamesAndTypesFormatReader reader =
                        (RowBinaryWithNamesAndTypesFormatReader) newBinaryFormatReader(response);

                while (true) {

                    Object record;
                    try {
                        record = allocator == null ? clazz.getDeclaredConstructor().newInstance() : allocator.get();
                    } catch (NoSuchMethodException e) {
                        throw new ClientException("Failed to instantiate DTO to store data: no-args constructor is not defined");
                    }
                    if (reader.readToPOJO(classDeserializers, record)) {
                        records.add((T) record);
                    } else {
                        break;
                    }
                }

                return records;
            }
        } catch (ExecutionException e) {
            throw new ClientException("Failed to get query response", e.getCause());
        } catch (Exception e) {
            throw new ClientException("Failed to get query response", e);
        }
    }
WARNING: Experimental API

<p>Queries data and returns collection with whole result. Data is read directly to a DTO
 to save memory on intermediate structures. DTO will be instantiated with default constructor or
 by using allocator</p>
<p>{@code class} should be registered before calling this method using {@link #register(Class, TableSchema)}</p>
<p>Internally deserializer is compiled at the register stage. Compilation is done using ASM library by
 writing a bytecode</p>
<p>Note: this method will cache schema and it will use sql as a key for storage.</p>


@param sqlQuery - query to execute
@param clazz - class of the DTO
@param allocator - optional supplier to create new instances of the DTO.
@throws IllegalArgumentException when class is not registered or no setters found
@return List of POJOs filled with data
@param <T> type of POJO
client-v2/src/main/java/com/clickhouse/client/api/Client.java