diff --git a/querybook/webapp/components/DataDocQueryCell/DataDocQueryCell.tsx b/querybook/webapp/components/DataDocQueryCell/DataDocQueryCell.tsx index cfb6990f3..acc873680 100644 --- a/querybook/webapp/components/DataDocQueryCell/DataDocQueryCell.tsx +++ b/querybook/webapp/components/DataDocQueryCell/DataDocQueryCell.tsx @@ -216,10 +216,6 @@ class DataDocQueryCellComponent extends React.PureComponent { 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) => { @@ -232,6 +228,11 @@ class DataDocQueryCellComponent extends React.PureComponent { 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 = { @@ -467,6 +468,7 @@ class DataDocQueryCellComponent extends React.PureComponent { element: ElementType.RUN_QUERY_BUTTON, aux: { lintError: this.state.hasLintError, + sampleRate: this.sampleRate, }, }); return runQuery(