ydb-embedded-ui 3.4.5 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +41 -0
- package/dist/components/InfoViewer/formatters/table.ts +6 -0
- package/dist/components/TruncatedQuery/TruncatedQuery.js +1 -1
- package/dist/components/TruncatedQuery/TruncatedQuery.scss +7 -3
- package/dist/containers/Node/{NodePages.js → NodePages.ts} +1 -1
- package/dist/containers/Tablet/TabletControls/TabletControls.tsx +2 -2
- package/dist/containers/Tenant/Diagnostics/Overview/Overview.tsx +11 -43
- package/dist/containers/Tenant/Diagnostics/Overview/TableInfo/TableInfo.tsx +19 -17
- package/dist/containers/Tenant/Diagnostics/Overview/TableInfo/prepareTableInfo.ts +192 -37
- package/dist/containers/Tenant/Diagnostics/TopQueries/TopQueries.scss +20 -14
- package/dist/containers/Tenant/Diagnostics/TopQueries/TopQueries.tsx +49 -12
- package/dist/containers/Tenant/Diagnostics/TopShards/TopShards.tsx +37 -18
- package/dist/containers/Tenant/QueryEditor/QueriesHistory/QueriesHistory.tsx +3 -3
- package/dist/containers/Tenant/QueryEditor/QueryDuration/QueryDuration.scss +8 -0
- package/dist/containers/Tenant/QueryEditor/QueryDuration/QueryDuration.tsx +21 -0
- package/dist/containers/Tenant/QueryEditor/QueryEditor.js +58 -82
- package/dist/containers/Tenant/QueryEditor/QueryEditor.scss +0 -33
- package/dist/containers/Tenant/QueryEditor/QueryEditorControls/OldQueryEditorControls.tsx +83 -0
- package/dist/containers/Tenant/QueryEditor/QueryEditorControls/QueryEditorControls.scss +57 -0
- package/dist/containers/Tenant/QueryEditor/QueryEditorControls/QueryEditorControls.tsx +84 -0
- package/dist/containers/Tenant/QueryEditor/QueryEditorControls/shared.ts +23 -0
- package/dist/containers/Tenant/QueryEditor/QueryExplain/QueryExplain.js +12 -23
- package/dist/containers/Tenant/QueryEditor/QueryResult/QueryResult.js +4 -6
- package/dist/containers/Tenant/QueryEditor/i18n/en.json +3 -0
- package/dist/containers/Tenant/QueryEditor/i18n/index.ts +11 -0
- package/dist/containers/Tenant/QueryEditor/i18n/ru.json +3 -0
- package/dist/containers/UserSettings/UserSettings.tsx +30 -1
- package/dist/routes.ts +1 -1
- package/dist/services/api.d.ts +4 -3
- package/dist/services/api.js +5 -5
- package/dist/store/reducers/{executeQuery.js → executeQuery.ts} +48 -43
- package/dist/store/reducers/executeTopQueries.ts +5 -1
- package/dist/store/reducers/{explainQuery.js → explainQuery.ts} +44 -59
- package/dist/store/reducers/{olapStats.js → olapStats.ts} +8 -18
- package/dist/store/reducers/settings.js +19 -4
- package/dist/store/reducers/storage.js +5 -7
- package/dist/types/api/error.ts +14 -0
- package/dist/types/api/query.ts +227 -115
- package/dist/types/api/schema.ts +523 -3
- package/dist/types/common.ts +1 -0
- package/dist/types/store/executeQuery.ts +38 -0
- package/dist/types/store/explainQuery.ts +38 -0
- package/dist/types/store/olapStats.ts +14 -0
- package/dist/types/store/query.ts +23 -3
- package/dist/utils/constants.ts +2 -1
- package/dist/utils/error.ts +25 -0
- package/dist/utils/index.js +0 -49
- package/dist/utils/prepareQueryExplain.ts +7 -24
- package/dist/utils/query.test.ts +148 -213
- package/dist/utils/query.ts +68 -90
- package/dist/utils/timeParsers/formatDuration.ts +30 -12
- package/dist/utils/timeParsers/i18n/en.json +9 -5
- package/dist/utils/timeParsers/i18n/ru.json +9 -5
- package/dist/utils/timeParsers/parsers.ts +9 -0
- package/dist/utils/utils.js +1 -2
- package/package.json +1 -1
package/dist/types/api/query.ts
CHANGED
@@ -1,36 +1,167 @@
|
|
1
|
-
//
|
1
|
+
// ==== types from backend protos ====
|
2
|
+
interface Position {
|
3
|
+
row?: number;
|
4
|
+
column?: number;
|
5
|
+
file?: string;
|
6
|
+
}
|
2
7
|
|
3
|
-
|
4
|
-
|
5
|
-
|
8
|
+
/** source: https://github.com/ydb-platform/ydb/blob/main/ydb/public/api/protos/ydb_issue_message.proto */
|
9
|
+
export interface IssueMessage {
|
10
|
+
position?: Position;
|
11
|
+
end_position?: Position;
|
12
|
+
message?: string;
|
13
|
+
issue_code?: number;
|
14
|
+
severity?: number;
|
15
|
+
issues?: IssueMessage[];
|
16
|
+
}
|
6
17
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
18
|
+
/** incomplete */
|
19
|
+
interface TDqStageStats {}
|
20
|
+
|
21
|
+
/** incomplete */
|
22
|
+
interface TKqpStatsCompile {}
|
23
|
+
|
24
|
+
interface TDqTableStats {
|
25
|
+
TablePath?: string;
|
26
|
+
/** uint64 */
|
27
|
+
ReadRows?: string;
|
28
|
+
/** uint64 */
|
29
|
+
ReadBytes?: string;
|
30
|
+
/** uint64 */
|
31
|
+
WriteRows?: string;
|
32
|
+
/** uint64 */
|
33
|
+
WriteBytes?: string;
|
34
|
+
/** uint64 */
|
35
|
+
EraseRows?: string;
|
36
|
+
/** uint64 */
|
37
|
+
EraseBytes?: string;
|
38
|
+
AffectedPartitions?: number;
|
39
|
+
Extra?: unknown;
|
11
40
|
}
|
12
41
|
|
13
|
-
|
14
|
-
|
42
|
+
/** source: https://github.com/ydb-platform/ydb/blob/main/ydb/library/yql/dq/actors/protos/dq_stats.proto */
|
43
|
+
interface TDqExecutionStats {
|
44
|
+
/** uint64 */
|
45
|
+
CpuTimeUs?: string;
|
46
|
+
/** uint64 */
|
47
|
+
DurationUs?: string;
|
48
|
+
/** uint64 */
|
49
|
+
ResultRows?: string;
|
50
|
+
/** uint64 */
|
51
|
+
ResultBytes?: string;
|
52
|
+
|
53
|
+
Tables?: TDqTableStats[];
|
54
|
+
|
55
|
+
/** uint64 */
|
56
|
+
ExecuterCpuTimeUs?: string;
|
57
|
+
/** uint64 */
|
58
|
+
StartTimeMs?: string;
|
59
|
+
/** uint64 */
|
60
|
+
FinishTimeMs?: string;
|
61
|
+
/** uint64 */
|
62
|
+
FirstRowTimeMs?: string;
|
63
|
+
|
64
|
+
Stages?: TDqStageStats[];
|
65
|
+
TxPlansWithStats?: string[];
|
66
|
+
|
67
|
+
Extra: unknown;
|
15
68
|
}
|
16
69
|
|
17
|
-
|
18
|
-
|
19
|
-
|
70
|
+
/** source: https://github.com/ydb-platform/ydb/blob/main/ydb/core/protos/kqp_stats.proto */
|
71
|
+
export interface TKqpStatsQuery {
|
72
|
+
/** uint64 */
|
73
|
+
DurationUs?: string;
|
74
|
+
Compilation?: TKqpStatsCompile;
|
75
|
+
|
76
|
+
/** uint64 */
|
77
|
+
WorkerCpuTimeUs?: string;
|
78
|
+
/** uint64 */
|
79
|
+
ReadSetsCount?: string;
|
80
|
+
/** uint64 */
|
81
|
+
MaxShardProgramSize?: string;
|
82
|
+
/** uint64 */
|
83
|
+
MaxShardReplySize?: string;
|
84
|
+
|
85
|
+
Executions?: TDqExecutionStats[];
|
20
86
|
}
|
21
87
|
|
22
|
-
|
23
|
-
|
24
|
-
|
88
|
+
// ==== Self-written types ====
|
89
|
+
// ==== Meta version 0.2 ====
|
90
|
+
// Backend code: https://github.com/ydb-platform/ydb/blob/main/ydb/core/kqp/opt/kqp_query_plan.cpp
|
25
91
|
|
26
|
-
//
|
27
|
-
export
|
92
|
+
// ==== Plan ====
|
93
|
+
export interface PlanMeta {
|
94
|
+
version: string;
|
95
|
+
type: 'script' | 'query';
|
96
|
+
}
|
28
97
|
|
29
|
-
|
98
|
+
export interface PlanTable {
|
99
|
+
name: string;
|
100
|
+
reads?: {
|
101
|
+
type: string;
|
102
|
+
lookup_by?: string[];
|
103
|
+
scan_by?: string[];
|
104
|
+
limit?: string;
|
105
|
+
reverse?: boolean;
|
106
|
+
columns?: string[];
|
107
|
+
}[];
|
108
|
+
writes?: {
|
109
|
+
type: string;
|
110
|
+
key?: string[];
|
111
|
+
columns?: string[];
|
112
|
+
}[];
|
113
|
+
}
|
30
114
|
|
31
|
-
|
115
|
+
interface PlanNodeStats {
|
116
|
+
TotalCpuTimeUs?: number;
|
117
|
+
TotalTasks?: number;
|
118
|
+
TotalInputBytes?: number;
|
119
|
+
TotalInputRows?: number;
|
120
|
+
TotalOutputBytes?: number;
|
121
|
+
TotalDurationMs?: number;
|
122
|
+
TotalOutputRows?: number;
|
123
|
+
}
|
32
124
|
|
33
|
-
|
125
|
+
interface PlanNodeOperator {
|
126
|
+
Name: string;
|
127
|
+
Limit?: string;
|
128
|
+
ReadLimit?: string;
|
129
|
+
ReadColumns?: string[];
|
130
|
+
ReadRanges?: string[];
|
131
|
+
Table?: string;
|
132
|
+
Iterator?: string;
|
133
|
+
}
|
134
|
+
|
135
|
+
export interface PlanNode {
|
136
|
+
PlanNodeId?: number;
|
137
|
+
'Node Type'?: string;
|
138
|
+
Plans?: PlanNode[];
|
139
|
+
Operators?: PlanNodeOperator[];
|
140
|
+
Tables?: string[];
|
141
|
+
PlanNodeType?: string;
|
142
|
+
Stats?: PlanNodeStats;
|
143
|
+
'CTE Name'?: string;
|
144
|
+
'Subplan Name'?: string;
|
145
|
+
'Parent Relationship'?: string;
|
146
|
+
}
|
147
|
+
|
148
|
+
export interface ScriptPlan {
|
149
|
+
queries?: {
|
150
|
+
Plan?: PlanNode;
|
151
|
+
tables?: PlanTable[];
|
152
|
+
}[];
|
153
|
+
meta: PlanMeta;
|
154
|
+
}
|
155
|
+
|
156
|
+
export interface ScanPlan {
|
157
|
+
Plan?: PlanNode;
|
158
|
+
tables?: PlanTable[];
|
159
|
+
meta: PlanMeta;
|
160
|
+
}
|
161
|
+
|
162
|
+
// ==== Common types ====
|
163
|
+
|
164
|
+
export type CellValue = string | number | null | undefined;
|
34
165
|
|
35
166
|
export type KeyValueRow<T = CellValue> = {
|
36
167
|
[key: string]: T;
|
@@ -43,110 +174,91 @@ export interface ColumnType {
|
|
43
174
|
type: string;
|
44
175
|
}
|
45
176
|
|
46
|
-
|
47
|
-
|
48
|
-
export type ExecuteModernResponse = {
|
49
|
-
result: ArrayRow[];
|
50
|
-
columns: ColumnType[];
|
51
|
-
} & CommonFields;
|
52
|
-
|
53
|
-
export type ExecuteClassicResponseDeep = {
|
54
|
-
result: KeyValueRow[];
|
55
|
-
} & CommonFields;
|
56
|
-
|
57
|
-
// can be undefined for queries like `insert into`
|
58
|
-
export type ExecuteClassicResponsePlain = KeyValueRow[] | undefined;
|
59
|
-
|
60
|
-
export type ExecuteClassicResponse = ExecuteClassicResponseDeep | ExecuteClassicResponsePlain;
|
61
|
-
|
62
|
-
export type ExecuteYdbResponse = {
|
63
|
-
result: KeyValueRow[];
|
64
|
-
} & CommonFields;
|
65
|
-
|
66
|
-
type ExecuteResponse<Schema extends Schemas> =
|
67
|
-
| CommonFields // result can be undefined for queries like `insert into`
|
68
|
-
| (Schema extends 'modern'
|
69
|
-
? ExecuteModernResponse
|
70
|
-
: Schema extends 'ydb'
|
71
|
-
? ExecuteYdbResponse
|
72
|
-
: Schema extends 'classic' | undefined
|
73
|
-
? ExecuteClassicResponse
|
74
|
-
: unknown);
|
75
|
-
|
76
|
-
// deprecated response from older versions, backward compatibility
|
77
|
-
|
78
|
-
type DeprecatedExecuteResponseValue =
|
79
|
-
| KeyValueRow[]
|
80
|
-
| string
|
81
|
-
// can be here because of a bug in the previous backend version
|
82
|
-
// should be ignored in parsing
|
83
|
-
| Plan;
|
84
|
-
|
85
|
-
export type DeprecatedExecuteResponseDeep = {
|
86
|
-
// can be undefined for queries like `insert into`
|
87
|
-
result?: DeprecatedExecuteResponseValue;
|
88
|
-
} & DeprecatedCommonFields;
|
89
|
-
|
90
|
-
// can be undefined for queries like `insert into`
|
91
|
-
export type DeprecatedExecuteResponsePlain = DeprecatedExecuteResponseValue | undefined;
|
92
|
-
|
93
|
-
export type DeprecatedExecuteResponse =
|
94
|
-
| DeprecatedExecuteResponseDeep
|
95
|
-
| DeprecatedExecuteResponsePlain;
|
177
|
+
/** undefined = 'classic' */
|
178
|
+
export type Schemas = 'classic' | 'modern' | 'ydb' | undefined;
|
96
179
|
|
97
|
-
|
180
|
+
/**
|
181
|
+
* undefined = 'execute'
|
182
|
+
*
|
183
|
+
* execute and execute-script have similar responses
|
184
|
+
*/
|
185
|
+
export type ExecuteActions = 'execute' | 'execute-scan' | 'execute-script' | undefined;
|
98
186
|
|
99
|
-
|
187
|
+
/** explain, explain-scan and explain-ast have similar responses */
|
188
|
+
export type ExplainActions = 'explain' | 'explain-scan' | 'explain-script' | 'explain-ast';
|
100
189
|
|
101
|
-
type
|
190
|
+
export type Actions = ExecuteActions | ExplainActions;
|
102
191
|
|
103
|
-
//
|
192
|
+
// ==== Error response ====
|
104
193
|
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
? ({result: Plan} & Required<DeprecatedCommonFields>) | Plan
|
110
|
-
: unknown;
|
194
|
+
export interface ErrorResponse {
|
195
|
+
error?: IssueMessage;
|
196
|
+
issues?: IssueMessage[];
|
197
|
+
}
|
111
198
|
|
112
|
-
// ====
|
199
|
+
// ==== Explain Responses ====
|
113
200
|
|
114
|
-
export
|
115
|
-
|
116
|
-
|
117
|
-
| null;
|
201
|
+
export interface ExplainScriptResponse {
|
202
|
+
plan?: ScriptPlan;
|
203
|
+
}
|
118
204
|
|
119
|
-
export
|
120
|
-
|
121
|
-
|
122
|
-
|
205
|
+
export interface ExplainScanResponse {
|
206
|
+
ast?: string;
|
207
|
+
plan?: ScanPlan;
|
208
|
+
}
|
123
209
|
|
124
|
-
export type
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
210
|
+
export type ExplainResponse<Action extends ExplainActions> = Action extends 'explain-script'
|
211
|
+
? ExplainScriptResponse
|
212
|
+
: ExplainScanResponse;
|
213
|
+
|
214
|
+
// ==== Execute Responses ====
|
215
|
+
|
216
|
+
type ResultFields<Schema extends Schemas> = Schema extends 'modern'
|
217
|
+
? {
|
218
|
+
result?: ArrayRow[];
|
219
|
+
columns?: ColumnType[];
|
220
|
+
}
|
221
|
+
: {
|
222
|
+
result?: KeyValueRow[];
|
223
|
+
};
|
224
|
+
|
225
|
+
export type ExecuteScanResponse<Schema extends Schemas> = {
|
226
|
+
plan?: ScanPlan;
|
227
|
+
ast?: string;
|
228
|
+
stats?: TKqpStatsQuery;
|
229
|
+
} & ResultFields<Schema>;
|
230
|
+
|
231
|
+
export type ExecuteScriptResponse<Schema extends Schemas> = {
|
232
|
+
plan?: ScriptPlan;
|
233
|
+
ast?: string;
|
234
|
+
stats?: TKqpStatsQuery;
|
235
|
+
} & ResultFields<Schema>;
|
236
|
+
|
237
|
+
export type ExecuteResponse<
|
238
|
+
Action extends ExecuteActions,
|
239
|
+
Schema extends Schemas,
|
240
|
+
> = Action extends 'execute-scan' ? ExecuteScanResponse<Schema> : ExecuteScriptResponse<Schema>;
|
241
|
+
|
242
|
+
// ==== Combined API response ====
|
243
|
+
export type QueryAPIResponse<
|
244
|
+
Action extends Actions,
|
245
|
+
Schema extends Schemas,
|
246
|
+
> = Action extends ExplainActions
|
247
|
+
? ExplainResponse<Action>
|
248
|
+
: Action extends ExecuteActions
|
249
|
+
? ExecuteResponse<Action, Schema>
|
250
|
+
: unknown;
|
251
|
+
|
252
|
+
// ==== types to use in query result preparation ====
|
253
|
+
export type AnyExplainResponse = ExplainScanResponse | ExplainScriptResponse;
|
254
|
+
|
255
|
+
export type ExecuteModernResponse = ExecuteScanResponse<'modern'> | ExecuteScriptResponse<'modern'>;
|
256
|
+
export type ExecuteClassicResponse =
|
257
|
+
| ExecuteScanResponse<'classic'>
|
258
|
+
| ExecuteScriptResponse<'classic'>;
|
259
|
+
export type ExecuteYdbResponse = ExecuteScanResponse<'ydb'> | ExecuteScriptResponse<'ydb'>;
|
130
260
|
|
131
261
|
export type AnyExecuteResponse =
|
132
262
|
| ExecuteModernResponse
|
133
263
|
| ExecuteClassicResponse
|
134
|
-
| ExecuteYdbResponse
|
135
|
-
| CommonFields
|
136
|
-
| DeprecatedExecuteResponse
|
137
|
-
| null;
|
138
|
-
|
139
|
-
export type DeepExecuteResponse =
|
140
|
-
| ExecuteModernResponse
|
141
|
-
| ExecuteClassicResponseDeep
|
142
|
-
| ExecuteYdbResponse
|
143
|
-
| DeprecatedExecuteResponseDeep;
|
144
|
-
|
145
|
-
export type AnyExplainResponse =
|
146
|
-
| ExplainResponse
|
147
|
-
| CommonFields
|
148
|
-
| DeprecatedExplainResponse<'explain'>
|
149
|
-
| DeprecatedExplainResponse<'explain-ast'>
|
150
|
-
| null;
|
151
|
-
|
152
|
-
export type AnyResponse = AnyExecuteResponse | AnyExplainResponse;
|
264
|
+
| ExecuteYdbResponse;
|