File tree Expand file tree Collapse file tree 2 files changed +19
-2
lines changed
src/containers/Tenant/Query/QueryResult
tests/suites/tenant/queryEditor Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ import {Ast} from './components/Ast/Ast';
2828import { Graph } from './components/Graph/Graph' ;
2929import { QueryInfoDropdown } from './components/QueryInfoDropdown/QueryInfoDropdown' ;
3030import { QueryJSONViewer } from './components/QueryJSONViewer/QueryJSONViewer' ;
31+ import { QueryResultError } from './components/QueryResultError/QueryResultError' ;
3132import { ResultSetsViewer } from './components/ResultSetsViewer/ResultSetsViewer' ;
3233import { SimplifiedPlan } from './components/SimplifiedPlan/SimplifiedPlan' ;
3334import { StubMessage } from './components/Stub/Stub' ;
@@ -254,7 +255,11 @@ export function QueryResultViewer({
254255 }
255256
256257 if ( error ) {
257- return renderCommonErrorView ( isStopped ) ;
258+ return isExecute || isStopped ? (
259+ renderCommonErrorView ( isStopped )
260+ ) : (
261+ < QueryResultError error = { error } />
262+ ) ;
258263 }
259264
260265 if ( activeSection === RESULT_OPTIONS_IDS . schema ) {
Original file line number Diff line number Diff line change @@ -74,7 +74,7 @@ test.describe('Test Query Editor', async () => {
7474 await expect ( explainAST ) . toBeVisible ( { timeout : VISIBILITY_TIMEOUT } ) ;
7575 } ) ;
7676
77- test ( 'Error is displayed for invalid query' , async ( { page} ) => {
77+ test ( 'Error is displayed for invalid query for run ' , async ( { page} ) => {
7878 const queryEditor = new QueryEditor ( page ) ;
7979
8080 const invalidQuery = 'Select d' ;
@@ -86,6 +86,18 @@ test.describe('Test Query Editor', async () => {
8686 await expect ( errorMessage ) . toContain ( 'Column references are not allowed without FROM' ) ;
8787 } ) ;
8888
89+ test ( 'Error is displayed for invalid query for explain' , async ( { page} ) => {
90+ const queryEditor = new QueryEditor ( page ) ;
91+
92+ const invalidQuery = 'Select d' ;
93+ await queryEditor . setQuery ( invalidQuery ) ;
94+ await queryEditor . clickExplainButton ( ) ;
95+
96+ await expect ( queryEditor . waitForStatus ( 'Failed' ) ) . resolves . toBe ( true ) ;
97+ const errorMessage = await queryEditor . getErrorMessage ( ) ;
98+ await expect ( errorMessage ) . toContain ( 'Column references are not allowed without FROM' ) ;
99+ } ) ;
100+
89101 test ( 'Run and Explain buttons are disabled when query is empty' , async ( { page} ) => {
90102 const queryEditor = new QueryEditor ( page ) ;
91103
You can’t perform that action at this time.
0 commit comments