Skip to content

Commit

Permalink
handle error in simulateQueryPlan for modal with Druid query
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianmroz-allegro committed Dec 6, 2022
1 parent b05d0a2 commit b7a5a95
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/client/modals/druid-query-modal/druid-query-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,16 @@ export const DruidQueryModal: React.FunctionComponent<DruidQueryModalProps> = ({
const queryFn = visualization.name === "grid" ? gridQuery : standardQuery;
const query = queryFn(essence, timekeeper);
const external = External.fromJS({ engine: "druid", attributes, source, customAggregations, customTransforms });
const plan = query.simulateQueryPlan({ main: external });
const planSource = JSON.stringify(plan, null, 2);
let plan;
try {
plan = JSON.stringify(query.simulateQueryPlan({ main: external }), null, 2);
} catch (e) {
plan = "Couldn't create Druid Query Plan.";
}

return <SourceModal
onClose={onClose}
title="Druid query"
copyLabel="Copy query"
source={planSource} />;
source={plan} />;
};

0 comments on commit b7a5a95

Please sign in to comment.