Skip to content

Commit 8c7762d

Browse files
authored
[no-release-notes] edits for stat funcs (#2313)
* [no-release-notes] edits for stat funcs * edit drop interface to switch on fisk flush
1 parent c0f397a commit 8c7762d

File tree

5 files changed

+25
-0
lines changed

5 files changed

+25
-0
lines changed

memory/stats.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,3 +293,12 @@ func (s *StatsProv) DataLength(ctx *sql.Context, db, table string) (uint64, erro
293293
}
294294
return size, nil
295295
}
296+
297+
func (s *StatsProv) DropDbStats(ctx *sql.Context, db string, flush bool) error {
298+
for key, _ := range s.colStats {
299+
if strings.HasPrefix(string(key), db) {
300+
delete(s.colStats, key)
301+
}
302+
}
303+
return nil
304+
}

sql/analyzer/catalog.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ type Catalog struct {
4444
locks sessionLocks
4545
}
4646

47+
func (c *Catalog) DropDbStats(ctx *sql.Context, db string, flush bool) error {
48+
return c.StatsProvider.DropDbStats(ctx, db, flush)
49+
}
50+
4751
var _ sql.Catalog = (*Catalog)(nil)
4852
var _ sql.FunctionProvider = (*Catalog)(nil)
4953
var _ sql.TableFunctionProvider = (*Catalog)(nil)

sql/catalog_map.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,3 +143,8 @@ func (t MapCatalog) RowCount(ctx *Context, db, table string) (uint64, error) {
143143
func (t MapCatalog) DataLength(ctx *Context, db, table string) (uint64, error) {
144144
return 1, nil
145145
}
146+
147+
func (t MapCatalog) DropDbStats(ctx *Context, db string, flush bool) error {
148+
//TODO implement me
149+
panic("implement me")
150+
}

sql/statistics.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ type StatsProvider interface {
4343
GetStats(ctx *Context, qual StatQualifier, cols []string) (Statistic, bool)
4444
// DropStats deletes a set of column statistics
4545
DropStats(ctx *Context, qual StatQualifier, cols []string) error
46+
// DropAllStats deletes all database statistics
47+
DropDbStats(ctx *Context, db string, flush bool) error
4648
// RowCount returns the number of rows in a table
4749
RowCount(ctx *Context, db, table string) (uint64, error)
4850
// DataLength returns the estimated size of each row in the table

test/test_catalog.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,3 +208,8 @@ func (c *Catalog) DataLength(ctx *sql.Context, db, table string) (uint64, error)
208208
//TODO implement me
209209
panic("implement me")
210210
}
211+
212+
func (c *Catalog) DropDbStats(ctx *sql.Context, db string, flush bool) error {
213+
//TODO implement me
214+
panic("implement me")
215+
}

0 commit comments

Comments
 (0)