Skip to content

Commit

Permalink
Remove PQL response parser in quickstart (#8081)
Browse files Browse the repository at this point in the history
  • Loading branch information
xiangfu0 authored Jan 28, 2022
1 parent 18777b7 commit 0fe7ef8
Showing 1 changed file with 0 additions and 61 deletions.
61 changes: 0 additions & 61 deletions pinot-tools/src/main/java/org/apache/pinot/tools/Quickstart.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,67 +85,6 @@ public static String prettyPrintResponse(JsonNode response) {
}
responseBuilder.append(NEW_LINE);
}
return responseBuilder.toString();
}

// Selection query
if (response.has("selectionResults")) {
JsonNode columns = response.get("selectionResults").get("columns");
int numColumns = columns.size();
for (int i = 0; i < numColumns; i++) {
responseBuilder.append(columns.get(i).asText()).append(TAB);
}
responseBuilder.append(NEW_LINE);
JsonNode rows = response.get("selectionResults").get("results");
int numRows = rows.size();
for (int i = 0; i < numRows; i++) {
JsonNode row = rows.get(i);
for (int j = 0; j < numColumns; j++) {
responseBuilder.append(row.get(j).asText()).append(TAB);
}
responseBuilder.append(NEW_LINE);
}
return responseBuilder.toString();
}

// Aggregation only query
if (!response.get("aggregationResults").get(0).has("groupByResult")) {
JsonNode aggregationResults = response.get("aggregationResults");
int numAggregations = aggregationResults.size();
for (int i = 0; i < numAggregations; i++) {
responseBuilder.append(aggregationResults.get(i).get("function").asText()).append(TAB);
}
responseBuilder.append(NEW_LINE);
for (int i = 0; i < numAggregations; i++) {
responseBuilder.append(aggregationResults.get(i).get("value").asText()).append(TAB);
}
responseBuilder.append(NEW_LINE);
return responseBuilder.toString();
}

// Aggregation group-by query
JsonNode groupByResults = response.get("aggregationResults");
int numGroupBys = groupByResults.size();
for (int i = 0; i < numGroupBys; i++) {
JsonNode groupByResult = groupByResults.get(i);
responseBuilder.append(groupByResult.get("function").asText()).append(TAB);
JsonNode columns = groupByResult.get("groupByColumns");
int numColumns = columns.size();
for (int j = 0; j < numColumns; j++) {
responseBuilder.append(columns.get(j).asText()).append(TAB);
}
responseBuilder.append(NEW_LINE);
JsonNode rows = groupByResult.get("groupByResult");
int numRows = rows.size();
for (int j = 0; j < numRows; j++) {
JsonNode row = rows.get(j);
responseBuilder.append(row.get("value").asText()).append(TAB);
JsonNode columnValues = row.get("group");
for (int k = 0; k < numColumns; k++) {
responseBuilder.append(columnValues.get(k).asText()).append(TAB);
}
responseBuilder.append(NEW_LINE);
}
}
return responseBuilder.toString();
}
Expand Down

0 comments on commit 0fe7ef8

Please sign in to comment.