mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
Initial sets up of new execution plan comparison result endpoint (#18813)
* Initial sets up of new execution plan comparison result endpoint * Makes query execution plan endpoint URI's more consistent.
This commit is contained in:
@@ -1123,7 +1123,16 @@ export interface GetExecutionPlanParams {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export namespace GetExecutionPlanRequest {
|
export namespace GetExecutionPlanRequest {
|
||||||
export const type = new RequestType<GetExecutionPlanParams, azdata.executionPlan.GetExecutionPlanResult, void, void>('queryexecutionplan/getexecutionplan');
|
export const type = new RequestType<GetExecutionPlanParams, azdata.executionPlan.GetExecutionPlanResult, void, void>('queryExecutionPlan/getExecutionPlan');
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ExecutionPlanComparisonParams {
|
||||||
|
firstExecutionPlanGraphInfo: azdata.executionPlan.ExecutionPlanGraphInfo;
|
||||||
|
secondExecutionPlanGraphInfo: azdata.executionPlan.ExecutionPlanGraphInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
export namespace ExecutionPlanComparisonRequest {
|
||||||
|
export const type = new RequestType<ExecutionPlanComparisonParams, azdata.executionPlan.ExecutionPlanComparisonResult, void, void>('queryExecutionPlan/compareExecutionPlanGraph');
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------- < Execution Plan > ------------------------------------
|
// ------------------------------- < Execution Plan > ------------------------------------
|
||||||
|
|||||||
@@ -1221,10 +1221,25 @@ export class ExecutionPlanServiceFeature extends SqlOpsFeature<undefined> {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const compareExecutionPlanGraph = (firstPlanFile: azdata.executionPlan.ExecutionPlanGraphInfo, secondPlanFile: azdata.executionPlan.ExecutionPlanGraphInfo): Thenable<azdata.executionPlan.ExecutionPlanComparisonResult> => {
|
||||||
|
const params: contracts.ExecutionPlanComparisonParams = {
|
||||||
|
firstExecutionPlanGraphInfo: firstPlanFile,
|
||||||
|
secondExecutionPlanGraphInfo: secondPlanFile
|
||||||
|
};
|
||||||
|
|
||||||
|
return client.sendRequest(contracts.ExecutionPlanComparisonRequest.type, params).then(
|
||||||
|
r => r,
|
||||||
|
e => {
|
||||||
|
client.logFailedRequest(contracts.ExecutionPlanComparisonRequest.type, e);
|
||||||
|
return Promise.reject(e);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
return azdata.dataprotocol.registerExecutionPlanProvider({
|
return azdata.dataprotocol.registerExecutionPlanProvider({
|
||||||
providerId: client.providerId,
|
providerId: client.providerId,
|
||||||
getExecutionPlan
|
getExecutionPlan,
|
||||||
|
compareExecutionPlanGraph
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
38
src/sql/azdata.proposed.d.ts
vendored
38
src/sql/azdata.proposed.d.ts
vendored
@@ -1268,6 +1268,38 @@ declare module 'azdata' {
|
|||||||
graphs: ExecutionPlanGraph[]
|
graphs: ExecutionPlanGraph[]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface ExecutionGraphComparisonResult {
|
||||||
|
/**
|
||||||
|
* The base ExecutionPlanNode for the ExecutionGraphComparisonResult.
|
||||||
|
*/
|
||||||
|
baseNode: ExecutionPlanNode;
|
||||||
|
/**
|
||||||
|
* The children of the ExecutionGraphComparisonResult.
|
||||||
|
*/
|
||||||
|
children: ExecutionGraphComparisonResult[];
|
||||||
|
/**
|
||||||
|
* The group index of the ExecutionGraphComparisonResult.
|
||||||
|
*/
|
||||||
|
groupIndex: number;
|
||||||
|
/**
|
||||||
|
* Flag to indicate if the ExecutionGraphComparisonResult has a matching node in the compared execution plan.
|
||||||
|
*/
|
||||||
|
hasMatch: boolean;
|
||||||
|
/**
|
||||||
|
* List of matching nodes for the ExecutionGraphComparisonResult.
|
||||||
|
*/
|
||||||
|
matchingNodes: ExecutionGraphComparisonResult[];
|
||||||
|
/**
|
||||||
|
* The parent of the ExecutionGraphComparisonResult.
|
||||||
|
*/
|
||||||
|
parentNode: ExecutionGraphComparisonResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ExecutionPlanComparisonResult extends ResultStatus {
|
||||||
|
firstComparisonResult: ExecutionGraphComparisonResult;
|
||||||
|
secondComparisonResult: ExecutionGraphComparisonResult;
|
||||||
|
}
|
||||||
|
|
||||||
export interface ExecutionPlanProvider extends DataProvider {
|
export interface ExecutionPlanProvider extends DataProvider {
|
||||||
// execution plan service methods
|
// execution plan service methods
|
||||||
|
|
||||||
@@ -1276,6 +1308,12 @@ declare module 'azdata' {
|
|||||||
* @param planFile file that contains the execution plan
|
* @param planFile file that contains the execution plan
|
||||||
*/
|
*/
|
||||||
getExecutionPlan(planFile: ExecutionPlanGraphInfo): Thenable<GetExecutionPlanResult>;
|
getExecutionPlan(planFile: ExecutionPlanGraphInfo): Thenable<GetExecutionPlanResult>;
|
||||||
|
/**
|
||||||
|
* Compares two execution plans and identifies matching regions in both execution plans.
|
||||||
|
* @param firstPlanFile file that contains the first execution plan.
|
||||||
|
* @param secondPlanFile file that contains the second execution plan.
|
||||||
|
*/
|
||||||
|
compareExecutionPlanGraph(firstPlanFile: ExecutionPlanGraphInfo, secondPlanFile: ExecutionPlanGraphInfo): Thenable<ExecutionPlanComparisonResult>;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -933,4 +933,8 @@ export class ExtHostDataProtocol extends ExtHostDataProtocolShape {
|
|||||||
public override $getExecutionPlan(handle: number, planFile: azdata.executionPlan.ExecutionPlanGraphInfo): Thenable<azdata.executionPlan.GetExecutionPlanResult> {
|
public override $getExecutionPlan(handle: number, planFile: azdata.executionPlan.ExecutionPlanGraphInfo): Thenable<azdata.executionPlan.GetExecutionPlanResult> {
|
||||||
return this._resolveProvider<azdata.executionPlan.ExecutionPlanProvider>(handle).getExecutionPlan(planFile);
|
return this._resolveProvider<azdata.executionPlan.ExecutionPlanProvider>(handle).getExecutionPlan(planFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override $compareExecutionPlanGraph(handle: number, firstPlanFile: azdata.executionPlan.ExecutionPlanGraphInfo, secondPlanFile: azdata.executionPlan.ExecutionPlanGraphInfo): Thenable<azdata.executionPlan.ExecutionPlanComparisonResult> {
|
||||||
|
return this._resolveProvider<azdata.executionPlan.ExecutionPlanProvider>(handle).compareExecutionPlanGraph(firstPlanFile, secondPlanFile);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -572,6 +572,10 @@ export abstract class ExtHostDataProtocolShape {
|
|||||||
* Gets the generic execution plan graph for a plan file.
|
* Gets the generic execution plan graph for a plan file.
|
||||||
*/
|
*/
|
||||||
$getExecutionPlan(handle: number, planFile: azdata.executionPlan.ExecutionPlanGraphInfo): Thenable<azdata.executionPlan.GetExecutionPlanResult> { throw ni(); }
|
$getExecutionPlan(handle: number, planFile: azdata.executionPlan.ExecutionPlanGraphInfo): Thenable<azdata.executionPlan.GetExecutionPlanResult> { throw ni(); }
|
||||||
|
/**
|
||||||
|
* Compares two execution plans and identifies matching sections in both.
|
||||||
|
*/
|
||||||
|
$compareExecutionPlanGraph(handle: number, firstPlanFile: azdata.executionPlan.ExecutionPlanGraphInfo, secondPlanFile: azdata.executionPlan.ExecutionPlanGraphInfo): Thenable<azdata.executionPlan.ExecutionPlanComparisonResult> { throw ni(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -123,6 +123,12 @@ export class ExecutionPlanService implements IExecutionPlanService {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
compareExecutionPlanGraph(firstPlanFile: azdata.executionPlan.ExecutionPlanGraphInfo, secondPlanFile: azdata.executionPlan.ExecutionPlanGraphInfo): Promise<azdata.executionPlan.ExecutionPlanComparisonResult> {
|
||||||
|
return this._runAction(firstPlanFile.graphFileType, (runner) => {
|
||||||
|
return runner.compareExecutionPlanGraph(firstPlanFile, secondPlanFile);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
getSupportedExecutionPlanExtensionsForProvider(providerId: string): string[] | undefined {
|
getSupportedExecutionPlanExtensionsForProvider(providerId: string): string[] | undefined {
|
||||||
return this._capabilitiesService.getCapabilities(providerId).connection.supportedExecutionPlanFileExtensions;
|
return this._capabilitiesService.getCapabilities(providerId).connection.supportedExecutionPlanFileExtensions;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,12 @@ export interface IExecutionPlanService {
|
|||||||
* Gets an execution plan for the given planFile.
|
* Gets an execution plan for the given planFile.
|
||||||
*/
|
*/
|
||||||
getExecutionPlan(planFile: azdata.executionPlan.ExecutionPlanGraphInfo): Promise<azdata.executionPlan.GetExecutionPlanResult>;
|
getExecutionPlan(planFile: azdata.executionPlan.ExecutionPlanGraphInfo): Promise<azdata.executionPlan.GetExecutionPlanResult>;
|
||||||
|
/**
|
||||||
|
* Compares two execution plans and identifies matching regions in both execution plans.
|
||||||
|
* @param firstPlanFile file that contains the first execution plan.
|
||||||
|
* @param secondPlanFile file that contains the second execution plan.
|
||||||
|
*/
|
||||||
|
compareExecutionPlanGraph(firstPlanFile: azdata.executionPlan.ExecutionPlanGraphInfo, secondPlanFile: azdata.executionPlan.ExecutionPlanGraphInfo): Promise<azdata.executionPlan.ExecutionPlanComparisonResult>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get execution plan file extensions supported by the provider.
|
* Get execution plan file extensions supported by the provider.
|
||||||
|
|||||||
Reference in New Issue
Block a user