Skip to content

Commit

Permalink
showing Query Result as blank table and json format toggle even if qu…
Browse files Browse the repository at this point in the history
…ery response has 0 records (#6223)
  • Loading branch information
shahsank3t committed Nov 3, 2020
1 parent e3b0bfc commit bee125e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
25 changes: 21 additions & 4 deletions pinot-controller/src/main/resources/app/pages/Query.tsx
Expand Up @@ -118,6 +118,23 @@ const sqlFuntionsList = [
'SUMMV', 'AVGMV', 'MINMAXRANGEMV', 'DISTINCTCOUNTMV', 'DISTINCTCOUNTBITMAPMV', 'DISTINCTCOUNTHLLMV',
'DISTINCTCOUNTRAWHLLMV', 'DISTINCT', 'ST_UNION'];

const responseStatCols = [
'timeUsedMs',
'numDocsScanned',
'totalDocs',
'numServersQueried',
'numServersResponded',
'numSegmentsQueried',
'numSegmentsProcessed',
'numSegmentsMatched',
'numConsumingSegmentsQueried',
'numEntriesScannedInFilter',
'numEntriesScannedPostFilter',
'numGroupsLimitReached',
'partialResponse',
'minConsumingFreshnessTimeMs'
];

const QueryPage = () => {
const classes = useStyles();
const [fetching, setFetching] = useState(true);
Expand Down Expand Up @@ -196,7 +213,7 @@ const QueryPage = () => {
);
setResultError(results.error || '');
setResultData(results.result || { columns: [], records: [] });
setQueryStats(results.queryStats || { columns: [], records: [] });
setQueryStats(results.queryStats || { columns: responseStatCols, records: [] });
setOutputResult(JSON.stringify(results.data, null, 2) || '');
setQueryLoader(false);
};
Expand Down Expand Up @@ -380,7 +397,7 @@ const QueryPage = () => {
</Alert>
) : (
<>
{queryStats.records.length ? (
{queryStats.columns.length ? (
<Grid item xs style={{ backgroundColor: 'white' }}>
<CustomizedTables
title="Query Response Stats"
Expand All @@ -392,7 +409,7 @@ const QueryPage = () => {
) : null}

<Grid item xs style={{ backgroundColor: 'white' }}>
{resultData.records.length ? (
{resultData.columns.length ? (
<>
<Grid container className={classes.actionBtns}>
<Button
Expand Down Expand Up @@ -454,7 +471,7 @@ const QueryPage = () => {
showSearchBox={true}
inAccordionFormat={true}
/>
) : resultData.records.length ? (
) : resultData.columns.length ? (
<SimpleAccordion
headerTitle="Query Result (JSON Format)"
showSearchBox={false}
Expand Down
Expand Up @@ -262,7 +262,7 @@ const getQueryResults = (params, url, checkedOptions) => {
dataArray = queryResponse.resultTable.rows;
}

const columnStats = [ 'timeUsedMs',
const columnStats = ['timeUsedMs',
'numDocsScanned',
'totalDocs',
'numServersQueried',
Expand Down

0 comments on commit bee125e

Please sign in to comment.