joshigaurava commented on a change in pull request #7981: URL: https://github.com/apache/pinot/pull/7981#discussion_r780552843
##########
File path: pinot-controller/src/main/resources/app/utils/PinotMethodUtils.ts
##########
@@ -228,57 +228,60 @@ const getQueryResults = (params, url, checkedOptions) => {
let queryResponse = null;
queryResponse = getAsObject(data);
+ let errorStr = '';
+ let dataArray = [];
+ let columnList = [];
// if sql api throws error, handle here
if(typeof queryResponse === 'string'){
- return {error: queryResponse};
+ errorStr = queryResponse;
} else if(queryResponse.exceptions.length){
Review comment:
`queryResponse` could potentially be null.
```
else if (queryResponse && queryResponse.exceptions &&
queryResponse.exceptions.length) {}
```
##########
File path: pinot-controller/src/main/resources/app/pages/Query.tsx
##########
@@ -473,106 +473,106 @@ const QueryPage = () => {
{queryLoader ? (
<AppLoader />
) : (
- <>
- {resultError ? (
- <Alert severity="error" className={classes.sqlError}>
- {resultError}
- </Alert>
- ) : (
- <>
- {queryStats.columns.length ? (
+ <>
+ {queryStats.columns.length ? (
<Grid item xs style={{ backgroundColor: 'white' }}>
<CustomizedTables
- title="Query Response Stats"
- data={queryStats}
- showSearchBox={true}
- inAccordionFormat={true}
+ title="Query Response Stats"
+ data={queryStats}
+ showSearchBox={true}
+ inAccordionFormat={true}
/>
</Grid>
- ) : null}
+ ) : null}
- <Grid item xs style={{ backgroundColor: 'white' }}>
- {resultData.columns.length ? (
+ <Grid item xs style={{ backgroundColor: 'white' }}>
+ {resultData.columns.length ? (
<>
<Grid container className={classes.actionBtns}>
<Button
- variant="contained"
- color="primary"
- size="small"
- className={classes.btn}
- onClick={() => downloadData('xls')}
+ variant="contained"
+ color="primary"
+ size="small"
+ className={classes.btn}
+ onClick={() => downloadData('xls')}
>
Excel
</Button>
<Button
- variant="contained"
- color="primary"
- size="small"
- className={classes.btn}
- onClick={() => downloadData('csv')}
+ variant="contained"
+ color="primary"
+ size="small"
+ className={classes.btn}
+ onClick={() => downloadData('csv')}
>
CSV
</Button>
<Button
- variant="contained"
- color="primary"
- size="small"
- className={classes.btn}
- onClick={() => copyToClipboard()}
+ variant="contained"
+ color="primary"
+ size="small"
+ className={classes.btn}
+ onClick={() => copyToClipboard()}
>
Copy
</Button>
{copyMsg ? (
- <Alert
- icon={<FileCopyIcon fontSize="inherit" />}
- severity="info"
- >
- Copied {resultData.records.length} rows to
- Clipboard
- </Alert>
+ <Alert
+ icon={<FileCopyIcon fontSize="inherit" />}
+ severity="info"
+ >
+ Copied {resultData.records.length} rows to
+ Clipboard
+ </Alert>
) : null}
<FormControlLabel
- control={
- <Switch
- checked={checked.showResultJSON}
- onChange={handleChange}
- name="showResultJSON"
- color="primary"
- />
- }
- label="Show JSON format"
- className={classes.runNowBtn}
+ control={
+ <Switch
+ checked={checked.showResultJSON}
+ onChange={handleChange}
+ name="showResultJSON"
+ color="primary"
+ />
+ }
+ label="Show JSON format"
+ className={classes.runNowBtn}
/>
</Grid>
- {!checked.showResultJSON ? (
- <CustomizedTables
- title="Query Result"
- data={resultData}
- isPagination
- isSticky={true}
- showSearchBox={true}
- inAccordionFormat={true}
- />
- ) : resultData.columns.length ? (
- <SimpleAccordion
- headerTitle="Query Result (JSON Format)"
- showSearchBox={false}
- >
- <CodeMirror
- options={jsonoptions}
- value={outputResult}
- className={classes.queryOutput}
- autoCursor={false}
- />
- </SimpleAccordion>
- ) : null}
- </>
- ) : null}
- </Grid>
- </>
- )}
- </>
+ {resultError ? (
+ <Alert severity="error"
className={classes.sqlError}>
+ {resultError}
+ </Alert>
+ ) : (
+ <>
+ {!checked.showResultJSON ? (
+ <CustomizedTables
+ title="Query Result"
+ data={resultData}
+ isPagination
+ isSticky={true}
+ showSearchBox={true}
+ inAccordionFormat={true}
+ />
+ ) : resultData.columns.length ? (
+ <SimpleAccordion
+ headerTitle="Query Result (JSON
Format)"
+ showSearchBox={false}
+ >
+ <CodeMirror
+ options={jsonoptions}
+ value={outputResult}
+ className={classes.queryOutput}
+ autoCursor={false}
+ />
+ </SimpleAccordion>
+ ) : null}
+ )}
+ </>)}
+ </>) : null}
+ </Grid>
+ </>
+//.................................
Review comment:
Random comment! :)
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
