use of javax.json.JsonArray in project drill by apache.
the class ProfileParser method getOpInfo.
/**
* We often run test queries single threaded to make analysis of the profile
* easier. For a single-threaded (single slice) query, get a map from
* operator ID to operator information as preparation for additional
* analysis.
*
* @return
*/
public Map<Integer, OperatorProfile> getOpInfo() {
Map<Integer, String> ops = getOperators();
Map<Integer, OperatorProfile> info = new HashMap<>();
JsonArray frags = getFragmentProfile();
JsonObject fragProfile = frags.getJsonObject(0).getJsonArray("minorFragmentProfile").getJsonObject(0);
JsonArray opList = fragProfile.getJsonArray("operatorProfile");
for (JsonObject opProfile : opList.getValuesAs(JsonObject.class)) {
parseOpProfile(ops, info, opProfile);
}
return info;
}
use of javax.json.JsonArray in project scylla-jmx by scylladb.
the class APIClient method getMapStringIntegerValue.
public Map<String, Integer> getMapStringIntegerValue(String string, MultivaluedMap<String, String> queryParams) {
Map<String, Integer> res = new HashMap<String, Integer>();
JsonReader reader = getReader(string, queryParams);
JsonArray arr = reader.readArray();
JsonObject obj = null;
for (int i = 0; i < arr.size(); i++) {
obj = arr.getJsonObject(i);
res.put(obj.getString("key"), obj.getInt("value"));
}
return res;
}
use of javax.json.JsonArray in project scylla-jmx by scylladb.
the class APIClient method getSetStringValue.
public Set<String> getSetStringValue(String string, MultivaluedMap<String, String> queryParams) {
JsonReader reader = getReader(string, queryParams);
JsonArray arr = reader.readArray();
Set<String> res = new HashSet<String>();
for (int i = 0; i < arr.size(); i++) {
res.add(arr.getString(i));
}
reader.close();
return res;
}
use of javax.json.JsonArray in project scylla-jmx by scylladb.
the class APIClient method getReverseMapStrValue.
public Map<String, String> getReverseMapStrValue(String string, MultivaluedMap<String, String> queryParams) {
if (string.equals("")) {
return null;
}
JsonReader reader = getReader(string, queryParams);
JsonArray arr = reader.readArray();
Map<String, String> map = new HashMap<String, String>();
for (int i = 0; i < arr.size(); i++) {
JsonObject obj = arr.getJsonObject(i);
if (obj.containsKey("key") && obj.containsKey("value")) {
map.put(obj.getString("value"), obj.getString("key"));
}
}
reader.close();
return map;
}
use of javax.json.JsonArray in project scylla-jmx by scylladb.
the class APIClient method getEstimatedHistogramAsLongArrValue.
public long[] getEstimatedHistogramAsLongArrValue(String string, MultivaluedMap<String, String> queryParams) {
JsonObject obj = getJsonObj(string, queryParams);
JsonArray arr = obj.getJsonArray("buckets");
if (arr == null) {
return new long[0];
}
long[] res = new long[arr.size()];
for (int i = 0; i < arr.size(); i++) {
res[i] = arr.getJsonNumber(i).longValue();
}
return res;
}
Aggregations