@@ -268,6 +268,7 @@ class TJsonDescribe : public TViewerPipeClient<TJsonDescribe> {
268
268
headers = HTTPFORBIDDENJSON;
269
269
}
270
270
TProtoToJson::ProtoToJson (json, *DescribeResult, JsonSettings);
271
+ DecodeExternalTableContent (json);
271
272
} else {
272
273
json << " null" ;
273
274
}
@@ -276,6 +277,41 @@ class TJsonDescribe : public TViewerPipeClient<TJsonDescribe> {
276
277
PassAway ();
277
278
}
278
279
280
+ void DecodeExternalTableContent (TStringStream& json) const {
281
+ if (!DescribeResult) {
282
+ return ;
283
+ }
284
+
285
+ if (!DescribeResult->GetPathDescription ().HasExternalTableDescription ()) {
286
+ return ;
287
+ }
288
+
289
+ const auto & content = DescribeResult->GetPathDescription ().GetExternalTableDescription ().GetContent ();
290
+ if (!content) {
291
+ return ;
292
+ }
293
+
294
+ NJson::TJsonValue root;
295
+ const auto & sourceType = DescribeResult->GetPathDescription ().GetExternalTableDescription ().GetSourceType ();
296
+ try {
297
+ NJson::ReadJsonTree (json.Str (), &root);
298
+ root[" PathDescription" ][" ExternalTableDescription" ].EraseValue (" Content" );
299
+ auto source = AppData ()->ExternalSourceFactory ->GetOrCreate (sourceType);
300
+ auto parameters = source->GetParameters (content);
301
+ for (const auto & [key, items]: parameters) {
302
+ NJson::TJsonValue array{NJson::EJsonValueType::JSON_ARRAY};
303
+ for (const auto & item: items) {
304
+ array.AppendValue (item);
305
+ }
306
+ root[" PathDescription" ][" ExternalTableDescription" ][" Content" ][key] = array;
307
+ }
308
+ } catch (...) {
309
+ BLOG_CRIT (" Сan't unpack content for external table: " << sourceType << " , error: " << CurrentExceptionMessage ());
310
+ }
311
+ json.Clear ();
312
+ json << root;
313
+ }
314
+
279
315
void HandleTimeout () {
280
316
Send (Event->Sender , new NMon::TEvHttpInfoRes (Viewer->GetHTTPGATEWAYTIMEOUT (Event->Get ()), 0 , NMon::IEvHttpInfoRes::EContentType::Custom));
281
317
PassAway ();
0 commit comments