in src/main/java/com/aliyun/openservices/log/common/QueryResult.java [257:342]
private void parseMetadata(JSONObject asJsonObj) {
setProcessStatus(asJsonObj.getString("progress"));
if (asJsonObj.containsKey("aggQuery")) {
setAggQuery(asJsonObj.getString("aggQuery"));
}
if (asJsonObj.containsKey("whereQuery")) {
setWhereQuery(asJsonObj.getString("whereQuery"));
}
if (asJsonObj.containsKey("hasSQL")) {
setHasSQL(asJsonObj.getBooleanValue("hasSQL"));
}
if (asJsonObj.containsKey("processedRows")) {
setProcessedRows(asJsonObj.getLongValue("processedRows"));
}
if (asJsonObj.containsKey("elapsedMillisecond")) {
setElapsedMillisecond(asJsonObj.getLongValue("elapsedMillisecond"));
}
if (asJsonObj.containsKey("cpuSec")) {
setCpuSec(asJsonObj.getDoubleValue("cpuSec"));
}
if (asJsonObj.containsKey("cpuCores")) {
setCpuCores(asJsonObj.getLongValue("cpuCores"));
}
JSONArray keyList = asJsonObj.getJSONArray("keys");
if (keyList != null) {
keys = new ArrayList<String>(keyList.size());
for (int i = 0; i < keyList.size(); ++i) {
keys.add(keyList.getString(i));
}
} else {
keys = new ArrayList<String>();
}
JSONArray termsAsJson = asJsonObj.getJSONArray("terms");
terms = new ArrayList<Term>();
if (termsAsJson != null) {
for (int i = 0; i < termsAsJson.size(); ++i) {
JSONObject term = termsAsJson.getJSONObject(i);
if (term.size() == 2) {
terms.add(new Term(term.getString("key"), term.getString("term")));
}
}
}
if (asJsonObj.containsKey("limited")) {
limited = asJsonObj.getLongValue("limited");
}
if (asJsonObj.containsKey("marker")) {
marker = asJsonObj.getString("marker");
}
if (asJsonObj.containsKey("mode")) {
queryMode = asJsonObj.getIntValue("mode");
if (queryMode == 1)
isPhraseQuery = true;
}
setPhraseQueryInfo(PhraseQueryInfo.deserializeFrom(asJsonObj.getJSONObject("phraseQueryInfo")));
if (asJsonObj.containsKey("shard")) {
shard = asJsonObj.getIntValue("shard");
}
if (asJsonObj.containsKey("scanBytes")) {
scanBytes = asJsonObj.getLongValue("scanBytes");
}
JSONArray jsonArray = asJsonObj.getJSONArray("highlights");
if (jsonArray != null) {
highlights = new ArrayList<List<LogContent>>(jsonArray.size());
for (int i = 0; i < jsonArray.size(); ++i) {
JSONObject jsonObject = jsonArray.getJSONObject(i);
if (jsonObject == null) {
highlights.add(new ArrayList<LogContent>());
} else {
List<LogContent> logContents = new ArrayList<LogContent>(jsonObject.size());
Set<String> keySey = jsonObject.keySet();
for (String key : keySey) {
String value = jsonObject.getString(key);
logContents.add(new LogContent(key, value));
}
highlights.add(logContents);
}
}
}
JSONArray columnTypesAsJson = asJsonObj.getJSONArray("columnTypes");
if (columnTypesAsJson != null) {
columnTypes = new ArrayList<String>(columnTypesAsJson.size());
for (int i = 0; i < columnTypesAsJson.size(); ++i) {
columnTypes.add(columnTypesAsJson.getString(i));
}
}
}