Skip to content

Commit

Permalink
Gather statistics #1
Browse files Browse the repository at this point in the history
  • Loading branch information
pdelewski committed Aug 26, 2024
1 parent 9736da7 commit 9431d1f
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions quesma/clickhouse/clickhouse.go
Original file line number Diff line number Diff line change
Expand Up @@ -497,14 +497,17 @@ func generateNonSchemaFieldsString(attrsMap map[string][]interface{}) (string, e

// This function implements heuristic for deciding if we should add new columns
func (lm *LogManager) shouldAlterColumns(table *Table, attrsMap map[string][]interface{}) bool {
_ = attrsMap
if len(table.Cols) < maxColumns {
return true
}
if lm.ingestFieldStatistics == nil {
lm.ingestFieldStatistics = make(IngestFieldStatistics)
}

lm.ingestFieldStatistics[IngestFieldBucketKey{indexName: table.Name, field: "test", insertBucket: 0}]++

return len(table.Cols) < maxColumns
attrKeys := getAttributesByArrayName(AttributesKeyColumn, attrsMap)
for _, field := range attrKeys {
lm.ingestFieldStatistics[IngestFieldBucketKey{indexName: table.Name, field: field, insertBucket: 0}]++
}
return false
}

func (lm *LogManager) BuildIngestSQLStatements(tableName string, data types.JSON, inValidJson types.JSON,
Expand Down

0 comments on commit 9431d1f

Please sign in to comment.