Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 6632429

Browse files
Merge branch 'joe_explain_zero_rows_warning' into 'master'
feat (UI): Display warning when a plan returns zero rows See merge request postgres-ai/database-lab!943
2 parents f4706d4 + ec72050 commit 6632429

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

‎ui/packages/platform/src/pages/JoeSessionCommand/JoeSessionCommandWrapper.jsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ export const JoeSessionCommandWrapper = (props) => {
3838
bottomSpace: {
3939
...styles.bottomSpace,
4040
},
41+
warningContainer: {
42+
marginTop: theme.spacing(2)
43+
}
4144
}),
4245
{ index: 1 },
4346
)

‎ui/packages/platform/src/pages/JoeSessionCommand/index.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import Permissions from 'utils/permissions';
3535
import format from 'utils/format';
3636

3737
import { TabPanel } from './TabPanel';
38+
import Alert from "@mui/material/Alert";
3839

3940
const hashLinkVisualizePrefix = 'visualize-';
4041

@@ -139,6 +140,19 @@ class JoeSessionCommand extends Component {
139140
return !!data && data.command === 'explain';
140141
};
141142

143+
planHasNoRows = () => {
144+
if (!this.isExplain()) return false;
145+
const data = this.getCommandData();
146+
const planExecJson = data && data.planExecJson;
147+
if (!planExecJson) return false;
148+
149+
const planExecJsonParsed = JSON.parse(planExecJson);
150+
if (!Array.isArray(planExecJsonParsed) || planExecJsonParsed.length === 0) return false;
151+
152+
const plan = planExecJsonParsed[0] && planExecJsonParsed[0]["Plan"];
153+
return plan && plan["Actual Rows"] === 0;
154+
}
155+
142156
showExternalVisualization = (type) => {
143157
const data = this.getCommandData();
144158

@@ -351,6 +365,11 @@ class JoeSessionCommand extends Component {
351365
</div>
352366
}
353367

368+
{this.planHasNoRows() && <div className={classes.warningContainer}>
369+
<Alert severity="warning">Query returned 0 rows. This may not reflect production performance or use the same query plan. If you expect results, try adjusting parameters (e.g., different ID values).
370+
</Alert>
371+
</div>}
372+
354373
<div>
355374
<h4>Author:</h4>
356375
<p>

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /