mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-17 17:22:42 -05:00
Pushing initial work for done in Query plan feature to main (#17986)
* Adding initial boilerplate for qp2 * Adding feature flag in query plan 2 * Clearing show plan 2 after every run * Adding sub tree cost * removing unused method. * WIP 2 * Adding properties view and relative cost to query plan * WIP * Add icons to ads * Assing relative costs and prop windows * Enabling older query plan again * Making some PR fixes * Some more PR related fixes * Use MS org azdataGraph module * Moving new properties to azdata proposed. * Moving new class properties to proposed * added missing doc component. * Changing how azdatagraph package is referenced * Removing empty lines, fixing localization keys * Removing empty line, localizing some string * making css classes more specific * making some logic concise * localizing some more strings * Making more css classes specific * Removing important tag from css props * Checking if sum is greater than 0 to prevent divide by zero exceptions * Fixed loader error in bootstrap * Fixing query index * -fixing image paths -making css class more class specific by using nested selectors Co-authored-by: kburtram <karlb@microsoft.com>
This commit is contained in:
@@ -17,6 +17,7 @@ import { ResultSetSubset } from 'sql/workbench/services/query/common/query';
|
||||
import { isUndefined } from 'vs/base/common/types';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import * as nls from 'vs/nls';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
|
||||
export const SERVICE_ID = 'queryManagementService';
|
||||
|
||||
@@ -119,7 +120,8 @@ export class QueryManagementService implements IQueryManagementService {
|
||||
constructor(
|
||||
@IConnectionManagementService private _connectionService: IConnectionManagementService,
|
||||
@IAdsTelemetryService private _telemetryService: IAdsTelemetryService,
|
||||
@ILogService private _logService: ILogService
|
||||
@ILogService private _logService: ILogService,
|
||||
@IConfigurationService private _configurationService: IConfigurationService
|
||||
) {
|
||||
}
|
||||
|
||||
@@ -329,6 +331,9 @@ export class QueryManagementService implements IQueryManagementService {
|
||||
public onResultSetUpdated(resultSetInfo: azdata.QueryExecuteResultSetNotificationParams): void {
|
||||
this._notify(resultSetInfo.ownerUri, (runner: QueryRunner) => {
|
||||
runner.handleResultSetUpdated(resultSetInfo.resultSetSummary);
|
||||
if (resultSetInfo.executionPlans && this._configurationService.getValue('queryPlan2.enableFeature')) {
|
||||
runner.handleQueryPlan2Available(resultSetInfo.executionPlans);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,8 @@ import {
|
||||
EditCreateRowResult,
|
||||
EditRevertCellResult,
|
||||
ExecutionPlanOptions,
|
||||
queryeditor
|
||||
queryeditor,
|
||||
QueryPlanGraph
|
||||
} from 'azdata';
|
||||
import { QueryInfo } from 'sql/workbench/services/query/common/queryModelService';
|
||||
import { IRange } from 'vs/editor/common/core/range';
|
||||
@@ -30,6 +31,12 @@ export interface IQueryPlanInfo {
|
||||
planXml: string;
|
||||
}
|
||||
|
||||
export interface IQueryPlan2Info {
|
||||
providerId: string;
|
||||
fileUri: string;
|
||||
planGraphs: QueryPlanGraph[];
|
||||
}
|
||||
|
||||
export interface IQueryInfo {
|
||||
range: IRange[];
|
||||
messages: IQueryMessage[];
|
||||
|
||||
@@ -352,6 +352,21 @@ export class QueryModelService implements IQueryModelService {
|
||||
this._onQueryEvent.fire(event);
|
||||
});
|
||||
|
||||
queryRunner.onQueryPlan2Available(qp2Info => {
|
||||
// fire extensibility API event
|
||||
let event: IQueryEvent = {
|
||||
type: 'executionPlan',
|
||||
uri: qp2Info.fileUri,
|
||||
queryInfo:
|
||||
{
|
||||
range: info.range!,
|
||||
messages: info.queryRunner!.messages
|
||||
},
|
||||
params: qp2Info.planGraphs
|
||||
};
|
||||
this._onQueryEvent.fire(event);
|
||||
});
|
||||
|
||||
queryRunner.onVisualize(resultSetInfo => {
|
||||
let event: IQueryEvent = {
|
||||
type: 'visualize',
|
||||
|
||||
@@ -6,9 +6,10 @@
|
||||
import { IQueryManagementService, QueryCancelResult, ExecutionPlanOptions } from 'sql/workbench/services/query/common/queryManagement';
|
||||
import * as Utils from 'sql/platform/connection/common/utils';
|
||||
import { Deferred } from 'sql/base/common/promise';
|
||||
import { IQueryPlanInfo } from 'sql/workbench/services/query/common/queryModel';
|
||||
import { IQueryPlanInfo, IQueryPlan2Info } from 'sql/workbench/services/query/common/queryModel';
|
||||
import { ResultSerializer, SaveFormat } from 'sql/workbench/services/query/common/resultSerializer';
|
||||
|
||||
import * as azdata from 'azdata';
|
||||
import * as nls from 'vs/nls';
|
||||
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
|
||||
import * as types from 'vs/base/common/types';
|
||||
@@ -72,6 +73,9 @@ export default class QueryRunner extends Disposable {
|
||||
private readonly _onQueryPlanAvailable = this._register(new Emitter<IQueryPlanInfo>());
|
||||
public readonly onQueryPlanAvailable = this._onQueryPlanAvailable.event;
|
||||
|
||||
private readonly _onQueryPlan2Available = this._register(new Emitter<IQueryPlan2Info>());
|
||||
public readonly onQueryPlan2Available = this._onQueryPlan2Available.event;
|
||||
|
||||
private readonly _onVisualize = this._register(new Emitter<ResultSetSummary>());
|
||||
public readonly onVisualize = this._onVisualize.event;
|
||||
|
||||
@@ -383,6 +387,16 @@ export default class QueryRunner extends Disposable {
|
||||
}
|
||||
}
|
||||
|
||||
public handleQueryPlan2Available(queryPlans: azdata.QueryPlanGraph[] | undefined) {
|
||||
if (queryPlans) {
|
||||
this._onQueryPlan2Available.fire({
|
||||
providerId: mssqlProviderName,
|
||||
fileUri: this.uri,
|
||||
planGraphs: queryPlans
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle a Mssage from the service layer
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user