@@ -20,7 +20,12 @@ import {
2020} from '../../../components/InfoViewer/schemaOverview' ;
2121import Icon from '../../../components/Icon/Icon' ;
2222
23- import { EPathSubType , EPathType , TDirEntry } from '../../../types/api/schema' ;
23+ import {
24+ EPathSubType ,
25+ EPathType ,
26+ TColumnTableDescription ,
27+ TDirEntry ,
28+ } from '../../../types/api/schema' ;
2429import { isColumnEntityType , isIndexTable , isTableType } from '../utils/schema' ;
2530
2631import {
@@ -57,19 +62,26 @@ const initialTenantCommonInfoState = {
5762 collapsed : getInitialIsSummaryCollapsed ( ) ,
5863} ;
5964
60- function prepareOlapTableSchema ( tableSchema : any ) {
61- const { Name, Schema = { } } = tableSchema ;
62- const { Columns, KeyColumnNames} = Schema ;
63- const KeyColumnIds = KeyColumnNames ?. map ( ( name : string ) => {
64- const column = Columns ?. find ( ( el : any ) => el . Name === name ) ;
65- return column . Id ;
66- } ) ;
65+ function prepareOlapTableSchema ( tableSchema : TColumnTableDescription = { } ) {
66+ const { Name, Schema} = tableSchema ;
67+
68+ if ( Schema ) {
69+ const { Columns, KeyColumnNames} = Schema ;
70+ const KeyColumnIds = KeyColumnNames ?. map ( ( name : string ) => {
71+ const column = Columns ?. find ( ( el ) => el . Name === name ) ;
72+ return column ?. Id ;
73+ } ) ;
74+
75+ return {
76+ Columns,
77+ KeyColumnNames,
78+ Name,
79+ KeyColumnIds,
80+ } ;
81+ }
6782
6883 return {
69- Columns,
70- KeyColumnNames,
7184 Name,
72- KeyColumnIds,
7385 } ;
7486}
7587
@@ -118,7 +130,8 @@ function ObjectSummary(props: ObjectSummaryProps) {
118130
119131 const schema =
120132 isTableType ( props . type ) && isColumnEntityType ( props . type )
121- ? prepareOlapTableSchema ( tableSchema )
133+ ? // process data for ColumnTable
134+ prepareOlapTableSchema ( tableSchema )
122135 : tableSchema ;
123136
124137 useEffect ( ( ) => {
0 commit comments