Skip to content

Commit

Permalink
Fix #69 - Add HashSpillDetails to warnings tooltip section
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinPealing committed Jan 29, 2018
1 parent f6a0c63 commit eb65514
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/qp.xslt
Expand Up @@ -532,6 +532,9 @@
<xsl:for-each select="s:Warnings/s:MemoryGrantWarning">
<div>The query memory grant detected "<xsl:value-of select="@GrantWarningKind" />", which may impact the reliability. Grant size: Initial <xsl:value-of select="@RequestedMemory" /> KB, Final <xsl:value-of select="@GrantedMemory" /> KB, Used <xsl:value-of select="@MaxUsedMemory" /> KB.</div>
</xsl:for-each>
<xsl:for-each select="s:Warnings/s:HashSpillDetails">
<div>Hash wrote <xsl:value-of select="@WritesToTempDb" /> pages to and read <xsl:value-of select="@ReadsFromTempDb" /> pages from tempdb with granted memory <xsl:value-of select="@GrantedMemoryKb" />KB and used memory <xsl:value-of select="@UsedMemoryKb" />KB.</div>
</xsl:for-each>
</div>
</xsl:if>
</xsl:template>
Expand Down
3 changes: 2 additions & 1 deletion test/plans.ts
Expand Up @@ -29,6 +29,7 @@ var plan = {
UpvotesForEachTag: require('raw-loader!../test_plans/stack overflow/How many upvotes do I have for each tag.sqlplan'),
unmatched_index: require('raw-loader!../test_plans/unmatched_index.sqlplan'),
columns_with_no_statistics: require('raw-loader!../test_plans/columns_with_no_statistics.sqlplan'),
spilltotempdb: require('raw-loader!../test_plans/spilltotempdb.sqlplan')
spilltotempdb: require('raw-loader!../test_plans/spilltotempdb.sqlplan'),
HashSpillDetails: require('raw-loader!../test_plans/HashSpillDetails.sqlplan')
}
export { plan };
9 changes: 9 additions & 0 deletions test/tooltip_warning_test.ts
Expand Up @@ -86,4 +86,13 @@ describe("Tooltip Warnings Section", () => {

})

it("Shows HashSpillDetails warning", () => {

const expected = "Hash wrote 10040 pages to and read 19040 pages from tempdb with granted memory 997376KB and used memory 996656KB.";
let container = helper.showPlan(plan.HashSpillDetails);
let hashMatch = helper.findNodeById(container, "2");
assert.equal(true, helper.getToolTipSection(hashMatch, "Warnings").indexOf(expected) >= 0);

})

})
2 changes: 1 addition & 1 deletion test_plans/HashSpillDetails.sqlplan
Expand Up @@ -92,7 +92,7 @@
</OutputList>
<Warnings>
<SpillToTempDb SpillLevel="1" SpilledThreadCount="8"/>
<HashSpillDetails GrantedMemoryKb="997376" UsedMemoryKb="996656" WritesToTempDb="19040" ReadsFromTempDb="19040"/>
<HashSpillDetails GrantedMemoryKb="997376" UsedMemoryKb="996656" WritesToTempDb="10040" ReadsFromTempDb="19040"/>
</Warnings>
<MemoryFractions Input="0.5" Output="0.5"/>
<RunTimeInformation>
Expand Down

0 comments on commit eb65514

Please sign in to comment.