Repository navigation
fix(mssql,oracle): render bare Stddev as sample standard deviation - #12161
Merged
deepyaman merged 8 commits intoOct 18, 2026
Merged
Conversation
deepyaman
requested changes
Oct 13, 2026
…ddev-sample # Conflicts: # ibis/backends/sql/tests/test_compiler.py
…ddev-sample # Conflicts: # ibis/backends/tests/test_dot_sql.py
deepyaman
requested changes
Oct 16, 2026
deepyaman
left a comment
Collaborator
There was a problem hiding this comment.
Two minor comments, and then it looks good
Co-authored-by: Deepyaman Datta <deepyaman.datta@utexas.edu>
deepyaman
self-requested a review
October 16, 2026 20:55
deepyaman
approved these changes
Oct 16, 2026
deepyaman
enabled auto-merge (squash)
October 16, 2026 20:56
deepyaman
reviewed
Oct 17, 2026
deepyaman
reviewed
Oct 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of changes
The MSSQL dialect mapped a bare
sge.StddevtoSTDEVP, but T-SQL'sSTDEVis the sample standard deviation, soSTDEVin user SQL was silently turned into a population one. Oracle had the same problem:STDDEVbecameSTDDEV_POP, even though Oracle'sSTDDEVis sample. This shows up throughTable.sql()andcon.sql(..., dialect=...), notBackend.sql()without a dialect. It also affected cross-dialect queries, e.g. a DuckDB or PostgresSTDDEVsent to MSSQL or Oracle came back as the population value.This removes the
sge.Stddevoverrides for MSSQL and Oracle, so sqlglot's defaults are used, which already renderSTDEVandSTDDEV. Since the Oracle override was applied to sqlglot's global Oracle dialect, removing it also fixes plainsqlglot.transpile(..., write="oracle")for anyone who imported ibis. SQL generated from ibis expressions liket.x.std()doesn't change, since that always goes throughstddev_samp/stddev_pop.Tests:
test_dot_sql_transpile_stddevintest_dot_sql.pyruns DuckDB SQL over a few rows on every backend and compares against the sample standard deviation (with markers for SQLite, Druid, RisingWave and BigQuery, where the query can't run as written).MySQL isn't changed here. sqlglot parses MySQL's
STDDEV/VARIANCE(population) into the same nodes as DuckDB's sample versions, so fixing that needs a change in sqlglot (tobymao/sqlglot#8626). MySQL and SingleStoreDB are markednotyetin the new test for now.Issues closed