Skip to content

Commit

Permalink
chore: log sample rate in query run context logs (#1459)
Browse files Browse the repository at this point in the history
* chore: add sampling context logs

* comments

* typo
  • Loading branch information
jczhong84 committed Jun 12, 2024
1 parent f019471 commit 731a166
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -216,10 +216,6 @@ class DataDocQueryCellComponent extends React.PureComponent<IProps, IState> {
return this.state.meta.limit ?? DEFAULT_ROW_LIMIT;
}

public get sampleRate() {
return this.state.meta.sample_rate ?? -1;
}

public get samplingTables() {
const samplingTables = this.state.samplingTables;
Object.keys(samplingTables).forEach((tableName) => {
Expand All @@ -232,6 +228,11 @@ class DataDocQueryCellComponent extends React.PureComponent<IProps, IState> {
return Object.keys(this.samplingTables).length > 0;
}

public get sampleRate() {
// -1 for tables don't support sampling, 0 for default sample rate (which means disable sampling)
return this.hasSamplingTables ? this.state.meta.sample_rate ?? 0 : -1;
}

@decorate(memoizeOne)
public _keyMapMemo(engines: IQueryEngine[]) {
const keyMap = {
Expand Down Expand Up @@ -467,6 +468,7 @@ class DataDocQueryCellComponent extends React.PureComponent<IProps, IState> {
element: ElementType.RUN_QUERY_BUTTON,
aux: {
lintError: this.state.hasLintError,
sampleRate: this.sampleRate,
},
});
return runQuery(
Expand Down

0 comments on commit 731a166

Please sign in to comment.