From 25354e8d2139c05cbc1bceb1b24b26f418db59c4 Mon Sep 17 00:00:00 2001 From: jsus Date: Sun, 16 Apr 2023 11:59:14 +0300 Subject: [PATCH] feat: explain query request --- src/table.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/table.ts b/src/table.ts index d4b3400d..eeeb4a77 100644 --- a/src/table.ts +++ b/src/table.ts @@ -37,6 +37,7 @@ import IType = Ydb.IType; import DescribeTableResult = Ydb.Table.DescribeTableResult; import PrepareQueryResult = Ydb.Table.PrepareQueryResult; import ExecuteQueryResult = Ydb.Table.ExecuteQueryResult; +import ExplainQueryResult = Ydb.Table.ExplainQueryResult import ITransactionSettings = Ydb.Table.ITransactionSettings; import BeginTransactionResult = Ydb.Table.BeginTransactionResult; import ITransactionMeta = Ydb.Table.ITransactionMeta; @@ -671,6 +672,17 @@ export class Session extends EventEmitter implements ICreateSessionResult { }); }); } + + public async explainQuery(query: string, operationParams?: Ydb.Operations.IOperationParams): Promise { + const request: Ydb.Table.IExplainDataQueryRequest = { + sessionId: this.sessionId, + yqlText: query, + operationParams + }; + const response = await this.api.explainDataQuery(request); + const payload = getOperationPayload(this.processResponseMetadata(request, response)); + return ExplainQueryResult.decode(payload); + } } type SessionCallback = (session: Session) => Promise;