New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TableStatistics implementation for dolt side #3365
Conversation
Also, why does this have no release notes? @jcor11599 you are over using this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pretty good, some nits for docstrings, worth refactoring the histogram building to only write it once on the GMS side
// AnalyzeTable implements the sql.StatisticsTable interface. | ||
func (t *DoltTable) AnalyzeTable(ctx *sql.Context) error { | ||
table, err := t.DoltTable(ctx) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
now might be a good time to make either a HistogramBuilder
or TableStatisticsBuilder
in GMS to avoid the duplication here. A couple ways of doing that: i) builder for each table, consumes rows; ii) constructor is passed an sql.RowIter
, it exhausts the row iter and returns map[string]sql.TableStatistics
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(maybe fold with info schema fix?)
@@ -98,10 +99,16 @@ func (ds *DoltTableStatistics) NullCount() uint64 { | |||
} | |||
|
|||
func (ds *DoltTableStatistics) Histogram(colName string) (*sql.Histogram, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we need DoltTableStatistics
? just to wrap map[string]sql.TableStatistics
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it implements sql.TableStatistics
go/libraries/doltcore/sqle/tables.go
Outdated
} | ||
} | ||
|
||
// TODO: logic to determine ranges for buckets |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
merged comments should either be: 1) consolidated into a docstring to describe what the function does, or 2) explain tricky edge cases that future readers would stumble on
rowCount: numRows, | ||
}, nil | ||
|
||
// Load stats from the session |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above about docstrings
…to james/statistics
Implements the
sql.StatisticsTable
interface