66 formatTableStatsItem ,
77 formatTabletMetricsItem ,
88} from '../../../../../components/InfoViewer/formatters' ;
9- import type { KeyValueRow } from '../../../../../types/api/query' ;
109import type {
1110 TColumnDataLifeCycle ,
1211 TColumnTableDescription ,
@@ -17,34 +16,12 @@ import type {
1716import { EPathType } from '../../../../../types/api/schema' ;
1817import { formatBytes , formatNumber } from '../../../../../utils/dataFormatters/dataFormatters' ;
1918import { formatDurationToShortTimeFormat } from '../../../../../utils/timeParsers' ;
20- import { isNumeric } from '../../../../../utils/utils' ;
2119
2220const isInStoreColumnTable = ( table : TColumnTableDescription ) => {
2321 // SchemaPresetId could be 0
2422 return table . SchemaPresetName && table . SchemaPresetId !== undefined ;
2523} ;
2624
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-
4825const prepareTTL = ( ttl : TTTLSettings | TColumnDataLifeCycle ) => {
4926 // ExpireAfterSeconds could be 0
5027 if ( ttl . Enabled && ttl . Enabled . ColumnName && ttl . Enabled . ExpireAfterSeconds !== undefined ) {
@@ -143,11 +120,7 @@ const prepareTableGeneralInfo = (PartitionConfig: TPartitionConfig, TTLSettings?
143120} ;
144121
145122/** 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 ) => {
151124 if ( ! data ) {
152125 return { } ;
153126 }
@@ -199,43 +172,33 @@ export const prepareTableInfo = (
199172 }
200173 }
201174
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+ ] ;
239202
240203 //@ts -expect-error
241204 const tabletMetricsInfo = formatObject ( formatTabletMetricsItem , TabletMetrics ) ;
0 commit comments