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

Commit 0f28d7b

Browse files
committed
Remove Table.Created
1 parent 035d6de commit 0f28d7b

File tree

16 files changed

+15
-58
lines changed

16 files changed

+15
-58
lines changed

platform/clickhouse/clickhouse.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -318,16 +318,12 @@ func (lm *LogManager) GetTableDefinitions() (TableMap, error) {
318318
func (lm *LogManager) AddTableIfDoesntExist(table *Table) bool {
319319
t := lm.FindTable(table.Name)
320320
if t == nil {
321-
table.Created = true
322-
323321
table.ApplyIndexConfig(lm.cfg)
324322

325323
lm.tableDiscovery.TableDefinitions().Store(table.Name, table)
326324
return true
327325
}
328-
wasntCreated := !t.Created
329-
t.Created = true
330-
return wasntCreated
326+
return false
331327
}
332328

333329
func (lm *LogManager) Ping() error {

platform/clickhouse/clickhouse_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,6 @@ func TestJsonConvertingBoolToStringAttr(t *testing.T) {
468468
// Doesn't test for 100% equality, as map iteration order isn't deterministic, but should definitely be good enough.
469469
func TestCreateTableString_1(t *testing.T) {
470470
table := Table{
471-
Created: false,
472471
Name: "/_bulk?refresh=false&_source_includes=originId&require_alias=true_16",
473472
Cols: map[string]*Column{
474473
"doc": {
@@ -570,7 +569,6 @@ func TestCreateTableString_1(t *testing.T) {
570569
// Doesn't test for 100% equality, as map iteration order isn't deterministic, but should definitely be good enough.
571570
func TestCreateTableString_NewDateTypes(t *testing.T) {
572571
table := Table{
573-
Created: false,
574572
Name: "abc",
575573
Cols: map[string]*Column{
576574
"low_card_string": {

platform/clickhouse/table.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ type Table struct {
1919
ClusterName string `default:""`
2020
Cols map[string]*Column
2121
Config *ChTableConfig
22-
Created bool // do we need to create it during first insert
2322
Indexes []IndexStatement
2423
aliases map[string]string //deprecated
2524
// TODO: we should use aliases directly from configuration, not store them here

platform/clickhouse/table_discovery.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,6 @@ func (td *tableDiscovery) populateTableDefinitions(configuredTables map[string]d
412412

413413
if !partiallyResolved {
414414
table := Table{
415-
Created: true,
416415
Name: tableName,
417416
Comment: resTable.comment,
418417
DatabaseName: databaseName,

platform/frontend_connectors/count_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,16 @@ func TestCountEndpoint(t *testing.T) {
2929

3030
tables := clickhouse.NewTableMap()
3131
tables.Store("no_db_name", &clickhouse.Table{
32-
Name: "no_db_name", Config: clickhouse.NewChTableConfigTimestampStringAttr(), Created: true, Cols: map[string]*clickhouse.Column{},
32+
Name: "no_db_name", Config: clickhouse.NewChTableConfigTimestampStringAttr(), Cols: map[string]*clickhouse.Column{},
3333
})
3434
tables.Store("with_db_name", &clickhouse.Table{
35-
Name: "with_db_name", Config: clickhouse.NewChTableConfigTimestampStringAttr(), Created: true, Cols: map[string]*clickhouse.Column{}, DatabaseName: "db_name",
35+
Name: "with_db_name", Config: clickhouse.NewChTableConfigTimestampStringAttr(), Cols: map[string]*clickhouse.Column{}, DatabaseName: "db_name",
3636
})
3737
tables.Store("common_prefix_1", &clickhouse.Table{
38-
Name: "common_prefix_1", Config: clickhouse.NewChTableConfigTimestampStringAttr(), Created: true, Cols: map[string]*clickhouse.Column{}, DatabaseName: "db_name",
38+
Name: "common_prefix_1", Config: clickhouse.NewChTableConfigTimestampStringAttr(), Cols: map[string]*clickhouse.Column{}, DatabaseName: "db_name",
3939
})
4040
tables.Store("common_prefix_2", &clickhouse.Table{
41-
Name: "common_prefix_2", Config: clickhouse.NewChTableConfigTimestampStringAttr(), Created: true, Cols: map[string]*clickhouse.Column{},
41+
Name: "common_prefix_2", Config: clickhouse.NewChTableConfigTimestampStringAttr(), Cols: map[string]*clickhouse.Column{},
4242
})
4343

4444
conn, mock := util.InitSqlMockWithPrettySqlAndPrint(t, false)

platform/frontend_connectors/search_opensearch_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ func TestSearchOpensearch(t *testing.T) {
2727
"message_____": {Name: "message_____", Type: clickhouse.NewBaseType("String")},
2828
"__bytes": {Name: "__bytes", Type: clickhouse.NewBaseType("Int64")},
2929
},
30-
Created: true,
3130
}
3231

3332
s := &schema.StaticRegistry{Tables: map[schema.IndexName]schema.Schema{}}
@@ -174,7 +173,6 @@ func TestHighlighter(t *testing.T) {
174173
"host_name": {Name: "host_name", Type: clickhouse.NewBaseType("String")},
175174
"_timestamp": {Name: "_timestamp", Type: clickhouse.NewBaseType("DateTime64")},
176175
},
177-
Created: true,
178176
}
179177
fields := map[schema.FieldName]schema.Field{
180178
"messeage$*%:;": {PropertyName: "message$*%:;", InternalPropertyName: "message_____", Type: schema.QuesmaTypeText},

platform/frontend_connectors/search_test.go

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ func TestAsyncSearchHandler(t *testing.T) {
6969
Type: clickhouse.NewBaseType("String"),
7070
},
7171
},
72-
Created: true,
7372
})
7473
fields := map[schema.FieldName]schema.Field{
7574
"@timestamp": {PropertyName: "@timestamp", InternalPropertyName: "@timestamp", Type: schema.QuesmaTypeDate},
@@ -114,7 +113,6 @@ func TestAsyncSearchHandlerSpecialCharacters(t *testing.T) {
114113
"message_____": {Name: "message_____", Type: clickhouse.NewBaseType("String")},
115114
"__bytes": {Name: "__bytes", Type: clickhouse.NewBaseType("Int64")},
116115
},
117-
Created: true,
118116
}
119117
fields := map[schema.FieldName]schema.Field{
120118
"host.name": {PropertyName: "host.name", InternalPropertyName: "host_name", Type: schema.QuesmaTypeObject},
@@ -168,7 +166,6 @@ var table = util.NewSyncMapWith(tableName, &clickhouse.Table{
168166
Type: clickhouse.NewBaseType("String"),
169167
},
170168
},
171-
Created: true,
172169
})
173170

174171
func TestSearchHandler(t *testing.T) {
@@ -262,7 +259,6 @@ func TestSearchHandler(t *testing.T) {
262259
Type: clickhouse.NewBaseType("String"),
263260
},
264261
},
265-
Created: true,
266262
}
267263

268264
tableMap := util.NewSyncMapWith(tableName, tab)
@@ -373,7 +369,6 @@ func TestSearchHandlerRuntimeMappings(t *testing.T) {
373369
Type: clickhouse.NewBaseType("String"),
374370
},
375371
},
376-
Created: true,
377372
})
378373

379374
s := &schema.StaticRegistry{
@@ -425,7 +420,6 @@ func TestSearchHandlerNoAttrsConfig(t *testing.T) {
425420
"message": {Name: "message", Type: clickhouse.NewBaseType("String")},
426421
"@timestamp": {Name: "@timestamp", Type: clickhouse.NewBaseType("DateTime64")},
427422
},
428-
Created: true,
429423
})
430424

431425
s := &schema.StaticRegistry{
@@ -477,7 +471,6 @@ func TestAsyncSearchFilter(t *testing.T) {
477471
Type: clickhouse.BaseType{Name: "Map(String, String)"},
478472
},
479473
},
480-
Created: true,
481474
}
482475
s := &schema.StaticRegistry{
483476
Tables: map[schema.IndexName]schema.Schema{
@@ -553,7 +546,7 @@ func TestHandlingDateTimeFields(t *testing.T) {
553546
},
554547
}
555548

556-
table := clickhouse.Table{Name: tableName, Config: clickhouse.NewChTableConfigTimestampStringAttr(), Created: true,
549+
table := clickhouse.Table{Name: tableName, Config: clickhouse.NewChTableConfigTimestampStringAttr(),
557550
Cols: map[string]*clickhouse.Column{
558551
"timestamp": {Name: "timestamp", Type: clickhouse.NewBaseType("DateTime")},
559552
"timestamp64": {Name: "timestamp64", Type: clickhouse.NewBaseType("DateTime64")},
@@ -685,7 +678,6 @@ func TestNumericFacetsQueries(t *testing.T) {
685678
Type: clickhouse.NewBaseType("Float64"),
686679
},
687680
},
688-
Created: true,
689681
})
690682
handlers := []string{"handleSearch", "handleAsyncSearch"}
691683
for i, tt := range testdata.TestsNumericFacets {
@@ -779,7 +771,6 @@ func TestSearchTrackTotalCount(t *testing.T) {
779771
"message": {Name: "message", Type: clickhouse.NewBaseType("String")},
780772
"@timestamp": {Name: "@timestamp", Type: clickhouse.NewBaseType("DateTime64")},
781773
},
782-
Created: true,
783774
})
784775

785776
test := func(handlerName string, testcase testdata.FullSearchTestCase) {
@@ -885,7 +876,6 @@ func TestFullQueryTestWIP(t *testing.T) {
885876
"message": {Name: "message", Type: clickhouse.NewBaseType("String")},
886877
"@timestamp": {Name: "@timestamp", Type: clickhouse.NewBaseType("DateTime64")},
887878
},
888-
Created: true,
889879
})
890880

891881
test := func(handlerName string, testcase testdata.FullSearchTestCase) {
@@ -996,7 +986,6 @@ func TestSearchAfterParameter_sortByJustTimestamp(t *testing.T) {
996986
"message": {Name: "message", Type: clickhouse.NewBaseType("String")},
997987
"@timestamp": {Name: "@timestamp", Type: clickhouse.NewBaseType("DateTime64")},
998988
},
999-
Created: true,
1000989
})
1001990

1002991
someTime := time.Date(2024, 1, 29, 18, 11, 36, 491000000, time.UTC) // 1706551896491 in UnixMilli
@@ -1133,7 +1122,6 @@ func TestSearchAfterParameter_sortByJustOneStringField(t *testing.T) {
11331122
Cols: map[string]*clickhouse.Column{
11341123
"message": {Name: "message", Type: clickhouse.NewBaseType("String")},
11351124
},
1136-
Created: true,
11371125
})
11381126

11391127
iterations := []struct {
@@ -1252,7 +1240,6 @@ func TestSearchAfterParameter_sortByMultipleFields(t *testing.T) {
12521240
"bicep_size": {Name: "bicep_size", Type: clickhouse.NewBaseType("Int64")},
12531241
"@timestamp": {Name: "@timestamp", Type: clickhouse.NewBaseType("DateTime64")},
12541242
},
1255-
Created: true,
12561243
})
12571244

12581245
someTime := time.Date(2024, 1, 29, 18, 11, 36, 491000000, time.UTC) // 1706551896491 in UnixMilli
@@ -1410,7 +1397,6 @@ func TestSearchAfterParameter_sortByNoField(t *testing.T) {
14101397
"bicep_size": {Name: "bicep_size", Type: clickhouse.NewBaseType("Int64")},
14111398
"@timestamp": {Name: "@timestamp", Type: clickhouse.NewBaseType("DateTime64")},
14121399
},
1413-
Created: true,
14141400
})
14151401

14161402
someTime := time.Date(2024, 1, 29, 18, 11, 36, 491000000, time.UTC) // 1706551896491 in UnixMilli

platform/frontend_connectors/terms_enum_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ func testHandleTermsEnumRequest(t *testing.T, requestBody []byte, fieldName stri
9494
Type: clickhouse.NewBaseType("LowCardinality(String)"),
9595
},
9696
},
97-
Created: true,
9897
}
9998
tableResolver := table_resolver.NewEmptyTableResolver()
10099
managementConsole := ui.NewQuesmaManagementConsole(&config.QuesmaConfiguration{}, nil, make(<-chan logger.LogWithLevel, 50000), diag.EmptyPhoneHomeRecentStatsProvider(), nil, tableResolver)

platform/ingest/common_table_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,6 @@ func TestIngestToCommonTable(t *testing.T) {
172172
},
173173
},
174174
Config: NewDefaultCHConfig(),
175-
Created: true,
176175
}
177176

178177
for _, col := range tt.alreadyExistingColumns {
@@ -220,7 +219,6 @@ func TestIngestToCommonTable(t *testing.T) {
220219
Name: indexName,
221220
Cols: map[string]*clickhouse.Column{},
222221
Config: NewDefaultCHConfig(),
223-
Created: true,
224222
VirtualTable: true,
225223
}
226224

platform/ingest/ingest_validator_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,6 @@ func TestIngestValidation(t *testing.T) {
234234
},
235235
}},
236236
},
237-
Created: true,
238237
})
239238
for i := range inputJson {
240239
conn, mock := util.InitSqlMockWithPrettyPrint(t, true)

0 commit comments

Comments
 (0)