6
6
formatTableStatsItem ,
7
7
formatTabletMetricsItem ,
8
8
} from '../../../../../components/InfoViewer/formatters' ;
9
- import type { KeyValueRow } from '../../../../../types/api/query' ;
10
9
import type {
11
10
TColumnDataLifeCycle ,
12
11
TColumnTableDescription ,
@@ -17,34 +16,12 @@ import type {
17
16
import { EPathType } from '../../../../../types/api/schema' ;
18
17
import { formatBytes , formatNumber } from '../../../../../utils/dataFormatters/dataFormatters' ;
19
18
import { formatDurationToShortTimeFormat } from '../../../../../utils/timeParsers' ;
20
- import { isNumeric } from '../../../../../utils/utils' ;
21
19
22
20
const isInStoreColumnTable = ( table : TColumnTableDescription ) => {
23
21
// SchemaPresetId could be 0
24
22
return table . SchemaPresetName && table . SchemaPresetId !== undefined ;
25
23
} ;
26
24
27
- const prepareOlapStats = ( olapStats : KeyValueRow [ ] ) => {
28
- const Bytes = olapStats ?. reduce ( ( acc , el ) => {
29
- const value = isNumeric ( el . Bytes ) ? Number ( el . Bytes ) : 0 ;
30
- return acc + value ;
31
- } , 0 ) ;
32
- const Rows = olapStats ?. reduce ( ( acc , el ) => {
33
- const value = isNumeric ( el . Rows ) ? Number ( el . Rows ) : 0 ;
34
- return acc + value ;
35
- } , 0 ) ;
36
- const tabletIds = olapStats ?. reduce ( ( acc , el ) => {
37
- acc . add ( el . TabletId ) ;
38
- return acc ;
39
- } , new Set ( ) ) ;
40
-
41
- return [
42
- { label : 'PartCount' , value : tabletIds ?. size ?? 0 } ,
43
- { label : 'RowCount' , value : formatNumber ( Rows ) ?? 0 } ,
44
- { label : 'DataSize' , value : formatBytes ( Bytes ) ?? 0 } ,
45
- ] ;
46
- } ;
47
-
48
25
const prepareTTL = ( ttl : TTTLSettings | TColumnDataLifeCycle ) => {
49
26
// ExpireAfterSeconds could be 0
50
27
if ( ttl . Enabled && ttl . Enabled . ColumnName && ttl . Enabled . ExpireAfterSeconds !== undefined ) {
@@ -143,11 +120,7 @@ const prepareTableGeneralInfo = (PartitionConfig: TPartitionConfig, TTLSettings?
143
120
} ;
144
121
145
122
/** Prepares data for Table, ColumnTable and ColumnStore */
146
- export const prepareTableInfo = (
147
- data ?: TEvDescribeSchemeResult ,
148
- type ?: EPathType ,
149
- olapStats ?: KeyValueRow [ ] ,
150
- ) => {
123
+ export const prepareTableInfo = ( data ?: TEvDescribeSchemeResult , type ?: EPathType ) => {
151
124
if ( ! data ) {
152
125
return { } ;
153
126
}
@@ -199,43 +172,33 @@ export const prepareTableInfo = (
199
172
}
200
173
}
201
174
202
- let tableStatsInfo : InfoViewerItem [ ] [ ] | undefined ;
203
-
204
- // There is no TableStats and TabletMetrics for ColumnTables inside ColumnStore
205
- // Therefore we parse olapStats
206
- if ( type === EPathType . EPathTypeColumnTable && isInStoreColumnTable ( ColumnTableDescription ) ) {
207
- if ( olapStats ) {
208
- tableStatsInfo = [ prepareOlapStats ( olapStats ) ] ;
209
- }
210
- } else {
211
- tableStatsInfo = [
212
- formatObject ( formatTableStatsItem , {
213
- PartCount,
214
- RowCount,
215
- DataSize,
216
- IndexSize,
217
- } ) ,
218
- formatObject ( formatTableStatsItem , {
219
- LastAccessTime,
220
- LastUpdateTime,
221
- } ) ,
222
- formatObject ( formatTableStatsItem , {
223
- ImmediateTxCompleted,
224
- PlannedTxCompleted,
225
- TxRejectedByOverload,
226
- TxRejectedBySpace,
227
- TxCompleteLagMsec,
228
- InFlightTxCount,
229
- } ) ,
230
- formatObject ( formatTableStatsItem , {
231
- RowUpdates,
232
- RowDeletes,
233
- RowReads,
234
- RangeReads,
235
- RangeReadRows,
236
- } ) ,
237
- ] ;
238
- }
175
+ const tableStatsInfo = [
176
+ formatObject ( formatTableStatsItem , {
177
+ PartCount,
178
+ RowCount,
179
+ DataSize,
180
+ IndexSize,
181
+ } ) ,
182
+ formatObject ( formatTableStatsItem , {
183
+ LastAccessTime,
184
+ LastUpdateTime,
185
+ } ) ,
186
+ formatObject ( formatTableStatsItem , {
187
+ ImmediateTxCompleted,
188
+ PlannedTxCompleted,
189
+ TxRejectedByOverload,
190
+ TxRejectedBySpace,
191
+ TxCompleteLagMsec,
192
+ InFlightTxCount,
193
+ } ) ,
194
+ formatObject ( formatTableStatsItem , {
195
+ RowUpdates,
196
+ RowDeletes,
197
+ RowReads,
198
+ RangeReads,
199
+ RangeReadRows,
200
+ } ) ,
201
+ ] ;
239
202
240
203
//@ts -expect-error
241
204
const tabletMetricsInfo = formatObject ( formatTabletMetricsItem , TabletMetrics ) ;
0 commit comments