Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add list of selected variables to JSON output #19

Merged
merged 1 commit into from
Jul 18, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/engine/Server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,8 @@ string Server::composeResponseJson(const ParsedQuery& query,
const QueryExecutionTree& qet,
size_t maxSend) const {

// TODO(schnelle) we really should use a json library
// such as https://github.com/nlohmann/json
const ResultTable& rt = qet.getResult();
_requestProcessingTimer.stop();
off_t compResultUsecs = _requestProcessingTimer.usecs();
Expand All @@ -315,6 +317,14 @@ string Server::composeResponseJson(const ParsedQuery& query,
<< "\"status\": \"OK\",\n"
<< "\"resultsize\": \"" << resultSize << "\",\n";

os << "\"selected\": ";
if (query._selectedVariables.size()) {
os << "[\"" <<
ad_utility::join(query._selectedVariables, "\", \"") << "\"],\n";
} else {
os << "[],\n";
}

os << "\"res\": ";
size_t limit = MAX_NOF_ROWS_IN_RESULT;
size_t offset = 0;
Expand Down