Skip to content

Commit 040d925

Browse files
committed
[native] Fix v1/operation/task/getDetail
1 parent fb4e489 commit 040d925

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

presto-native-execution/presto_cpp/main/PrestoServerOperations.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,14 @@ std::string getConnectorCacheStats(proxygen::HTTPMessage* message) {
6868
VELOX_USER_FAIL("connector '{}' operation is not supported", name);
6969
}
7070

71+
std::string prettyJson(folly::dynamic const& dyn) {
72+
folly::json::serialization_opts opts;
73+
opts.pretty_formatting = true;
74+
opts.sort_keys = true;
75+
opts.convert_int_keys = true;
76+
return folly::json::serialize(dyn, opts);
77+
}
78+
7179
} // namespace
7280

7381
void PrestoServerOperations::runOperation(
@@ -205,7 +213,7 @@ std::string PrestoServerOperations::taskOperation(
205213
if (task == taskMap.end()) {
206214
return fmt::format("No task found with id {}", id);
207215
}
208-
return folly::toPrettyJson(task->second->toJson());
216+
return prettyJson(task->second->toJson());
209217
}
210218
case ServerOperation::Action::kListAll: {
211219
uint32_t limit;
@@ -233,7 +241,7 @@ std::string PrestoServerOperations::taskOperation(
233241
break;
234242
}
235243
}
236-
oss << folly::toPrettyJson(arrayObj);
244+
oss << prettyJson(arrayObj);
237245
return oss.str();
238246
}
239247
default:

0 commit comments

Comments
 (0)