Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import com.fasterxml.jackson.core.JsonFactory;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonToken;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.type.CollectionType;

Expand Down Expand Up @@ -341,6 +342,19 @@ public void run() {
};
}

private boolean supportedType(String type) {
if (type.startsWith("long")) {
return true;
}
if (type.startsWith("double")) {
return true;
}
if (type.equals("hyperUnique")) {
return true;
}
return false;
}

/** Reads segment metadata, and populates a list of columns and metrics. */
void metadata(String dataSourceName, List<String> intervals,
Map<String, SqlTypeName> fieldBuilder, Set<String> metricNameBuilder) {
Expand All @@ -353,19 +367,26 @@ void metadata(String dataSourceName, List<String> intervals,
}
try (InputStream in0 = post(url, data, requestHeaders, 10000, 1800000);
InputStream in = traceResponse(in0)) {
final ObjectMapper mapper = new ObjectMapper();
final ObjectMapper mapper = new ObjectMapper().configure(
DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
final CollectionType listType =
mapper.getTypeFactory().constructCollectionType(List.class,
JsonSegmentMetadata.class);
final List<JsonSegmentMetadata> list = mapper.readValue(in, listType);
in.close();
for (JsonSegmentMetadata o : list) {
for (Map.Entry<String, JsonColumn> entry : o.columns.entrySet()) {
if (!supportedType(entry.getValue().type)) {
continue;
}
fieldBuilder.put(entry.getKey(), entry.getValue().sqlType());
}
if (o.aggregators != null) {
for (Map.Entry<String, JsonAggregator> entry
: o.aggregators.entrySet()) {
if (!supportedType(entry.getValue().type)) {
continue;
}
fieldBuilder.put(entry.getKey(), entry.getValue().sqlType());
metricNameBuilder.add(entry.getKey());
}
Expand Down