com.github.housepower.jdbc.protocol.QueryResponse Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of clickhouse-native-jdbc Show documentation
Show all versions of clickhouse-native-jdbc Show documentation
ClickHouse Native Protocol JDBC implementation
package com.github.housepower.jdbc.protocol;
import com.github.housepower.jdbc.data.Block;
import java.util.ArrayList;
import java.util.List;
public class QueryResponse {
private final Block header;
private final List data;
// Progress
// Totals
// Extremes
// ProfileInfo
// EndOfStream
public QueryResponse(List responses) {
List dataResponses = new ArrayList(responses.size());
List totalsResponses = new ArrayList(responses.size());
List progressResponses = new ArrayList(responses.size());
List extremesResponses = new ArrayList(responses.size());
List profileInfoResponses = new ArrayList(responses.size());
for (RequestOrResponse response : responses) {
if (response instanceof DataResponse) {
dataResponses.add((DataResponse) response);
} else if (response instanceof TotalsResponse) {
totalsResponses.add((TotalsResponse) response);
} else if (response instanceof ProgressResponse) {
progressResponses.add((ProgressResponse) response);
} else if (response instanceof ExtremesResponse) {
extremesResponses.add((ExtremesResponse) response);
} else if (response instanceof ProfileInfoResponse) {
profileInfoResponses.add((ProfileInfoResponse) response);
}
}
data = dataResponses;
header = dataResponses.isEmpty() ? new Block() : dataResponses.remove(0).block();
}
public Block header() {
return header;
}
public List data() {
return data;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy