Skip to content
This repository was archived by the owner on Nov 7, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion platform/frontend_connectors/search_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ func TestSearchHandler(t *testing.T) {
"user.id": {PropertyName: "user.id", InternalPropertyName: "user_id", Type: schema.QuesmaTypeKeyword},
"tags": {PropertyName: "tags", InternalPropertyName: "tags", Type: schema.QuesmaTypeKeyword},
"age": {PropertyName: "age", InternalPropertyName: "age", Type: schema.QuesmaTypeInteger},
"host.name": {PropertyName: "host.name", InternalPropertyName: "host_name", Type: schema.QuesmaTypeObject},
"host.name": {PropertyName: "host.name", InternalPropertyName: "host_name", Type: schema.QuesmaTypeKeyword},
"status": {PropertyName: "status", InternalPropertyName: "status", Type: schema.QuesmaTypeKeyword},
"namespace": {PropertyName: "namespace", InternalPropertyName: "namespace", Type: schema.QuesmaTypeKeyword},
"namespaces": {PropertyName: "namespaces", InternalPropertyName: "namespaces", Type: schema.QuesmaTypeKeyword},
Expand Down
22 changes: 21 additions & 1 deletion platform/frontend_connectors/search_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,27 @@ func (q *QueryRunner) resolveIndexesNonCommonTable(ctx context.Context, clickhou
return
}

currentSchema = resolvedSchema
// Clone the resolved schema to currentSchema
//
// Schema can be modified during the query execution, we don't want to modify the original schema, and we don't need any concurrency issues here.
//
// resolveIndexesCommonTable also returns an ephemeral schema

currentSchema = schema.Schema{
Fields: make(map[schema.FieldName]schema.Field),
Aliases: make(map[schema.FieldName]schema.FieldName),
ExistsInDataSource: resolvedSchema.ExistsInDataSource,
DatabaseName: resolvedSchema.DatabaseName,
}

for fieldName, field := range resolvedSchema.Fields {
currentSchema.Fields[fieldName] = field
}

for aliasName, targetFieldName := range resolvedSchema.Aliases {
currentSchema.Aliases[aliasName] = targetFieldName
}

return
}

Expand Down
Loading