vogievetsky commented on a change in pull request #7402: SQL explain in web 
console
URL: https://github.com/apache/incubator-druid/pull/7402#discussion_r272395735
 
 

 ##########
 File path: web-console/src/utils/druid-query.tsx
 ##########
 @@ -43,3 +43,60 @@ export async function queryDruidSql(sqlQuery: 
Record<string, any>): Promise<any[
   }
   return sqlResultResp.data;
 }
+
+function parseQueryPlanResult(queryPlanResult: string) {
+  if (!queryPlanResult) {
+    return {
+      query: null,
+      signature: null
+    };
+  }
+
+  const queryAndSignature = queryPlanResult.split(', signature=');
+  const queryValue = new RegExp(/query=(.+)/).exec(queryAndSignature[0]);
+  const signatureValue = queryAndSignature[1];
+
+  let parsedQuery: any;
+
+  if (queryValue && queryValue[1]) {
+    try {
+      parsedQuery = JSON.parse(queryValue[1]);
+    } catch (e) {}
+  }
+
+  return {
+    query: parsedQuery || queryPlanResult,
+    signature: signatureValue || null
+  };
+}
+
+export function parseQueryPlan(raw: string): any {
 
 Review comment:
   Could you please explicitly write down the interface of the return type of 
this function?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org
For additional commands, e-mail: commits-h...@druid.apache.org

Reply via email to