Skip to content
This repository was archived by the owner on Nov 7, 2025. It is now read-only.

Commit 8331c83

Browse files
committed
Extract function to filter common table index
1 parent 2be77f2 commit 8331c83

File tree

3 files changed

+14
-20
lines changed

3 files changed

+14
-20
lines changed

platform/common_table/const.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,15 @@ type VirtualTable struct {
6565
StoredAt string `json:"stored_at"`
6666
Columns []VirtualTableColumn `json:"columns"`
6767
}
68+
69+
// FilterCommonTableIndex filters out the common table index from the provided list of indexes
70+
func FilterCommonTableIndex(indexes []string) []string {
71+
// filter out common table index
72+
var filtered []string
73+
for _, index := range indexes {
74+
if index != TableName {
75+
filtered = append(filtered, index)
76+
}
77+
}
78+
return filtered
79+
}

platform/frontend_connectors/route_handlers.go

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -187,16 +187,7 @@ func HandleGetIndexMapping(ctx context.Context, sr schema.Registry, lm clickhous
187187

188188
allMappings := make(map[string]map[string]any)
189189

190-
var filteredIndexes []string
191-
for _, idx := range indexes {
192-
193-
if idx == common_table.TableName {
194-
// Skip the common table, it is not a real index
195-
continue
196-
}
197-
filteredIndexes = append(filteredIndexes, idx)
198-
}
199-
indexes = filteredIndexes
190+
indexes = common_table.FilterCommonTableIndex(indexes)
200191

201192
for _, resolvedIndex := range indexes {
202193

platform/functionality/field_capabilities/field_caps.go

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,7 @@ func handleFieldCapsIndex(cfg map[string]config.IndexConfiguration, schemaRegist
4848

4949
schemas := schemaRegistry.AllSchemas()
5050

51-
var filteredIndexes []string
52-
for _, index := range indexes {
53-
54-
if index == common_table.TableName {
55-
// Skip the common table, it is not a real index
56-
continue
57-
}
58-
filteredIndexes = append(filteredIndexes, index)
59-
}
60-
indexes = filteredIndexes
51+
indexes = common_table.FilterCommonTableIndex(indexes)
6152

6253
for _, resolvedIndex := range indexes {
6354
if len(resolvedIndex) == 0 {

0 commit comments

Comments
 (0)