Repository navigation
feat(birdbench): add Snowflake dialect, graded on a local stand-in - #6483
abelatnvidia wants to merge 29 commits into
Conversation
dialect: snowflake grades a model's Snowflake SQL. With the default snowflake_engine: fakesnow there is no Snowflake account behind it: fakesnow transpiles the query with sqlglot and runs it on DuckDB, over a read-only copy of the BIRD databases that the server builds on first start (one schema per db_id, BIRD's names created quoted, Spark's column typing). The gold stays the untouched SQLite query and only the result sets are compared, as for Spark and PostgreSQL. DuckDB accepts things Snowflake refuses, so a static check runs first: a single query only, identifiers resolved by Snowflake's rules (unquoted means upper case, including JOIN ... USING names, and a table-qualified name must be a real column, not a select alias), and no SQLite-only spellings such as IIF or LIMIT a, b. DuckDB's file and network access is off and locked, so model SQL can't read files through table functions such as read_csv. Timed-out queries are interrupted, queries run single-threaded so float sums are repeatable, and rows are read by position because fakesnow's fetchall() drops one of two same-named columns. As for PostgreSQL, a failure of the engine or its connection (SQLSTATE class 08 and the other infrastructure classes, DuckDB I/O errors) raises and masks the row as a verifier error; anything else the query raises, including a value Python can't hold, scores as the model's error. Each load records a layout version, and startup refuses a BIRD.db built with another layout. snowflake_engine: snowflake points the same grader at a real account that already holds the data, through a named connection in the connector's connections.toml. It has not run against an account yet. fakesnow==0.12.1 and snowflake-connector-python<5 are locked dependencies of bird_sql, like pyspark and psycopg. The pin is exact because the grader reads two private fakesnow attributes, and fakesnow 0.12.1 doesn't import with connector 5.x. fakesnow requires sqlglot ~=30.22.0, so the lock moves sqlglot from 30.30.0 to 30.22.0. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Abel Brown <[email protected]>
…ld check prepare renders the schema with schema-qualified, double-quoted names in BIRD's case and the Snowflake column types the stand-in loads; it needs only pandas. The prompt is the PostgreSQL one with the engine changed. Its sentence asking for every name double-quoted exactly as shown holds on Snowflake, which folds unquoted names to upper case. eval.sh passes the dialect and, for train, its own stand-in directory. snowflake_gold_check.py grades sqlglot transpiles of the golds with the server's own comparison. On dev, 1,430 of 1,534 (93.2%) match after one mechanical fix, identifier case (a second fix, double-quoted names to strings, fires on no dev gold). None match without the case fix: the identifier check refuses them, although DuckDB alone would run them. Each gold that doesn't match gets a failure class, and failures_by_class.json lists the question ids of each class, numbered as prepare numbers them, so that whoever validates generated training SQL on the stand-in can leave those questions out. --split train checks the train uberset. The README says where the stand-in passes wrong Snowflake SQL or fails correct SQL. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Abel Brown <[email protected]>
The tests load a small schema into a temporary BIRD.db and need no account or server. They cover routing and engine selection, the static check, the loader and its layout check, grading (identifier case, same-named columns, LIKE versus ILIKE, timeouts, refused statements, a read-only stand-in), and the split between query faults and engine failures, including 'infinity'::date and a closed connection. They also cover the gold check's failure classes. prepare's Snowflake rendering is covered in birdbench. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Abel Brown <[email protected]>
A user's default secondary roles are often ALL. A session that names a read-only role then still holds every other role the user has, and can write through them: on a real account, a session as a SELECT-only role could INSERT, DELETE and DROP through SYSADMIN, and could see every database. Each connection of the snowflake engine, including the one that checks the loaded data at startup, now runs USE SECONDARY ROLES NONE, so only the connection's own role applies. A connection where that fails is closed and the error raised. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Abel Brown <[email protected]>
On a real account, 17 translated dev golds matched on the stand-in but
failed on Snowflake, which refuses SUM/AVG of a boolean (SUM("x" = 'y'),
10 golds) and a SELECT DISTINCT ordered by something it doesn't select
(7). DuckDB runs both. The static check now refuses them too, including
an IFF, CASE or COALESCE whose results are all booleans, an ORDER BY
column qualified by another table, and an ORDER BY column the select
list only uses inside an expression. It stays conservative: a number
in between (IFF(c, 1, 0), CAST, COUNT_IF), a selected column, alias,
position or expression, an expression built from selected columns,
SELECT DISTINCT * and aggregates in the ORDER BY are left alone. A
SUM(DISTINCT) with no argument is unparsable instead of an IndexError
that would mask the answer as a verifier error.
Rechecked against every saved Snowflake outcome: of 3,105 distinct
queries, the check refuses none of the 1,477 Snowflake ran, and 29 live
edge cases matched what Snowflake does. No input made it raise in a
fuzz over 39,023 cut-off queries.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Abel Brown <[email protected]>
The BIRD dev databases were loaded into a Snowflake account in the layout check_bird_snowflake_account expects, and the gold check was run there through a read-only role. snowflake_gold_check.py takes --snowflake-connection NAME to grade on such an account instead of the stand-in. On dev, sqlglot's translations of the golds match on 1,439 of 1,534 on Snowflake and 1,413 on the stand-in; the two agree on pass or fail for 1,498 of the 1,532 whose gold runs on SQLite (97.8%). The READMEs now give these numbers and replace the guesses with what the account did: - Date functions on the VARCHAR date columns: YEAR, MONTH, EXTRACT and DATE_PART fail on Snowflake too. Only DATEDIFF and DATEADD on a string run on Snowflake and fail on the stand-in. - Text arithmetic: Snowflake casts it (20 of 24 such golds match). - Every query the static check refuses, Snowflake refuses too. - DuckDB-only functions, TO_CHAR of a VARCHAR with a format and division by zero run on the stand-in and fail on Snowflake. The gold check's failure classes carry the measured outcomes. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Abel Brown <[email protected]>
snowflake_engine: snowflake needs the data already loaded in the exact
layout check_bird_snowflake_account reads, and nothing produced it.
load_bird_snowflake_account loads every missing db_id through an admin
connection: the same schemas, quoted names and column types as the
stand-in, written with write_pandas into explicit DDL. Snowflake
commits DDL on its own, so a db_id's loaded row is written last, after
every table's row count matches SQLite, and its schema is dropped if
the load fails.
On a shared account a schema named like a db_id may be someone else's,
so the loader marks the schemas it creates with a comment and replaces
only those; any other schema of that name stops the load ("drop it
first"). It grants the grader's read-only role USAGE and SELECT on each
db_id right after loading it, and again on every run: FUTURE grants
need MANAGE GRANTS, which a database owner such as SYSADMIN usually
lacks. The admin connection keeps the user's secondary roles on
purpose. check_bird_snowflake_account now raises when the grader's
role can't see a db_id's tables, which would otherwise refuse every
query on it as an unknown table and score it 0.
benchmarks/birdbench/snowflake_load_account.py runs it once from the
command line; the bird_sql README gives the account setup. On a real
account, dev loads in about 7 minutes and the loaded catalog equals
the stand-in's (798 columns, every type). The tests use a fake
connection; no account is needed.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Abel Brown <[email protected]>
|
Pushed four commits on top of what was here (no force push). They come from running the grader on a real Snowflake account, on BIRD dev:
Nothing changed for |
Brings the branch up to date with main. The only conflict was resources_servers/bird_sql/uv.lock, which main's lock upgrade (NVIDIA-NeMo#6528) rewrote. Resolved by taking main's lock and re-locking with uv 0.13.4, the version CI uses: every version main locks is kept, and the Snowflake dependencies are added at the versions this PR already tested (fakesnow 0.12.1, snowflake-connector-python 4.8.1, duckdb 2.0.0, boto3 and botocore 1.44.5, and their dependencies). Two of main's versions move down because those dependencies require it: sqlglot 30.33.0 -> 30.22.0 (fakesnow pins ~=30.22.0, as before) and python-dateutil 4.0.0 -> 2.9.0.post0 (botocore requires <3, through the Snowflake connector). scripts/component_locks.py passes for all 327 managed projects. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Abel Brown <[email protected]>
…ctions Calibrating the stand-in on a model's own Snowflake SQL (Nemotron 3.5 Lightning, all of dev) against a real account found 14 answers that pass on the stand-in and fail on Snowflake. Six were SQL Snowflake doesn't have: an aggregate FILTER (WHERE ...) clause (5) and DIVIDE() (1), which DuckDB runs. The static check now refuses the FILTER clause and six DuckDB-only functions, each one an unknown function on an account: DIVIDE, EPOCH_MS, LIST_VALUE, REGEXP_MATCHES, STRING_AGG and STRPTIME. Snowflake's own FILTER(array, lambda), DIV0 and LISTAGG stay allowed. Function names are matched as written, like the SQLite-only list: a quoted name or a query with a CTE of the same name gets past, and a table alias with a column list of that name is refused; the READMEs say so. Rechecked against every saved Snowflake outcome (gold translations, probes and the model's answers): of 4,614 distinct queries, the check refuses none of the 2,681 Snowflake ran, and 37 hand-written edge cases of the check, run live on the account, give the same verdict as Snowflake. On the model's answers, agreement between the stand-in and Snowflake goes from 99.0% to 99.4% (1,523 of 1,532); the gold check is unchanged. The READMEs give the model-output result and document what remains: five ratios where Snowflake's fixed-point division changes the sixth decimal, a precision limit the check can't see. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Abel Brown <[email protected]>
|
Pushed two more commits (no force push):
Nothing changed for |
Brings the branch up to date with main, which now carries NVIDIA-NeMo#6534 (sanitized Spark table names). One conflict, in the DbHandle docstring of benchmarks/birdbench/build_db_values.py: NVIDIA-NeMo#6534 rewrote the Spark sentence (tables named as Spark loads them) and this PR appended the Snowflake one; both are kept. The code merged cleanly: NVIDIA-NeMo#6534's _table_name hook is the identity for Snowflake, which keeps BIRD's names, and its is_prepared_data_current() only checks Spark files. eval.sh, prepare.py and the build_db_values tests auto-merged. Main changes no lock this PR touches. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Abel Brown <[email protected]>
The Snowflake connector gives an error without a SQLSTATE the placeholder "n/a". That string is truthy, so a failed request (OperationalError 250003) was judged by it, read as the query's fault, and scored as an unmasked 0. Now "n/a" counts as no SQLSTATE, and an OperationalError or InterfaceError without one is an engine failure, re-raised and masked as a verifier error, as psycopg's are for PostgreSQL. A ProgrammingError without one is still the query's. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Abel Brown <[email protected]>
fakesnow keeps every completed query's Arrow result, SQL and AST in a results_cache shared by all of an instance's connections (it serves RESULT_SCAN), and closing a connection does not free them, so the stand-in's memory grew with every graded query. LocalSnowflake's fetch_all now drops its own query's entry once the rows are read, leaving other connections' entries alone. The grader reads each result exactly once, so nothing that reads the cache later is lost. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Abel Brown <[email protected]>
The static check refused two shapes of query that Snowflake runs (checked on a real account): - A comment after the last semicolon (SELECT 1; -- why). sqlglot returns it as a separate Semicolon node, which the check counted as a second statement. Comment-only nodes are no longer counted; a real second statement still is. - JOIN ... USING (k) where k is a column the joined CTEs or derived tables output. USING names were checked against catalog columns only; they are now checked against the query's output columns too, so an unquoted name the catalog lacks in that case is still refused. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Abel Brown <[email protected]>
When the timeout fired while snowflake.connect() was still running in the worker thread, nothing was interrupted (the connection didn't exist yet), the semaphore slot was released at once, and the worker then connected and ran the query anyway, outside the concurrency bound. execute_snowflake_async now tells the worker to stop (a worker that finishes connecting after the timeout closes the connection without running the query), interrupts the query again until the worker thread has stopped, and only then releases its semaphore slot. The test runs three queries whose connect outlasts the timeout under a semaphore of one: none runs, and no two overlap. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Abel Brown <[email protected]>
Four static-check gaps from review, each checked on a real account: - An alias no longer vouches for a wrong-case column inside its own definition: MAX(height_cm) AS height_cm passed and ran on the stand-in; Snowflake says invalid identifier. Aliases used in WHERE, ORDER BY or a later select item are still fine. - A column must belong to its own table, not to any table of the schema: foreign_data."multiverseId" passed because cards has that column. Qualified columns are checked against their table; unqualified ones against the catalog tables in scope (or an enclosing scope, for a correlated subquery), and only when every source in reach is a catalog table. - A bare function in FROM, such as DuckDB's range() or query() (which runs any SQL), is refused: Snowflake gives a syntax error there, and its own table functions, wrapped in TABLE() or LATERAL, are unaffected. - VALUES rows output COLUMN1, COLUMN2, ...; selecting them was refused though Snowflake runs it. Of 4,614 saved queries with a Snowflake outcome, the check still refuses none of the 2,681 Snowflake ran, and now refuses 15 more of those it failed. 20 review cases and the 37 earlier edge cases run live on the account all behave as Snowflake does. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Abel Brown <[email protected]>
The timeout clock started when the coroutine handed the work to a thread, so it also counted waiting for a free worker thread, the static check and, on an account, the login. On a busy server a query that takes milliseconds alone took 4.5 s, and a timeout is scored as the model's 0. The clock now starts when the query is sent. Getting there taking over two minutes raises instead, as the engine's failure, which verify masks. On an account, whose server stops the query itself at its statement timeout, the client waits 10 s longer, so the timeout is the server's verdict rather than a race with it. Stopping a timed-out query moves into one helper, which interrupts it again every second until the worker thread is done: DuckDB drops an interrupt sent before the query starts (for example while fakesnow transpiles), and the query would otherwise run on with no limit. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Abel Brown <[email protected]>
Turning a query's result into Python rows can't be interrupted. A model query returning 30 million rows ran 14 s past its 1 s timeout on the stand-in, holding a worker thread and memory. Both engines now check the row count first: a result over 5,000,000 rows (18 times the largest BIRD dev gold result, 278,230 rows) is not converted, or, from an account, not downloaded, and scores as the query's failure. The stand-in still frees its cached result. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Abel Brown <[email protected]>
The startup check caught a db_id only when its role could see none of its tables. One table missing its grant still refused every model query on it as an unknown table, scored 0. The check now compares the tables the grader's role can see with each SQLite file's tables and names every one it can't see. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Abel Brown <[email protected]>
…count behavior The READMEs now say what the review fixes changed and what they leave: columns resolve per table and an alias doesn't cover its own definition; a bare function in FROM is refused; a query's timeout counts from when it starts and its slot is held until its thread stops; results over 5,000,000 rows aren't converted; startup checks every table. On an account, TABLE(...) functions such as QUERY_HISTORY() pass the static check and are contained by the read-only role, and each query logs in again, so the connection needs non-interactive authentication and adds about a second per query outside the timeout. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Abel Brown <[email protected]>
|
Pushed 10 more commits (no force push): a merge of
None of this moved a calibration number. The description has the details. |
|
@agronskiy could you finish the review of the Snowflake stand-in and its execution verifier? The author pushed fixes from two reviews on 2026-11-22, and CI is green at |
NVIDIA-NeMo#6711 (BIRD versions and the schema-only prompt) and this branch both added a section after the dialect notes in benchmarks/birdbench/README.md. Both are kept: the Snowflake section first (it belongs to the dialect notes), then main's Versions and Schema-only prompt sections. No other conflicts. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Abel Brown <[email protected]>
…l_context test, annotations Review-readiness changes for the Snowflake dialect, no grading change: - The lines this PR adds say "verifier", the repo's word, not "grader" (26 lines in the READMEs, the loader, setup and tests, including the loader's --grant-to help text; the fake _FakeGraderConnection is now _FakeVerifierConnection). - bird_sql's README lists the licenses of what the Snowflake dialect adds to this server's lock: fakesnow (Apache-2.0 by its repository LICENSE; its package classifier says MIT), snowflake-connector-python (Apache-2.0), duckdb, and the connector's other new dependencies (MIT or Apache-2.0). - A copy of the Snowflake sql_context test is in tests/unit_tests/benchmarks/test_birdbench_snowflake_context.py, since CI doesn't run benchmarks/*/tests. Its BM25 retriever is stubbed out (CI's core environment has no bm25s or nltk); its assertions cover the schema rendering only. The original stays, with the real retriever; each points at the other. - birdbench's README says the Snowflake exclusion list and its counts are for dev_20240627 only: snowflake_gold_check.py has no --version. - Annotations in the files this PR adds, and on the lines it adds to eval_utils.py and app.py, use built-in generics, X | None and A | B (ruff UP006, UP007, UP035, UP045). Lines that already exist on main are unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Abel Brown <[email protected]>
|
Push history, moved out of the description to keep it short. Newest first. Since
|
|
@anwithk, here's a licensing check for this PR, raised now so it doesn't hold up the merge later, as the driver question did on #6708. The Snowflake dialect adds these to
None is GPL or LGPL. Unless you say otherwise, I'll treat fakesnow as Apache-2.0, per its LICENSE file. The list is also in the |
|
Merged current @agronskiy this is the head to review. @ffrujeri could you |
dhruvnathawani
left a comment
There was a problem hiding this comment.
LGTM, minor suggestions
| if isinstance(column.this, exp.Star): | ||
| continue | ||
| source = scope.sources.get(column.table) if column.table else None | ||
| if isinstance(source, exp.Table) and source.name in tables and column.name not in tables[source.name]: |
There was a problem hiding this comment.
Could you account for renamed columns in table aliases? SELECT a.y FROM "t" AS a(y) is valid Snowflake SQL but currently gets scored as pred_sql_error
There was a problem hiding this comment.
The static check now handles renamed columns in FROM "t" AS a(y), both qualified (a.y) and unqualified (y). It rejects extra aliases and rejects the previous names when the list renames every column. With a partial list, the check keeps the previous names because the catalog lacks column order. DuckDB checks those cases at execution.
| deadline = timeout_s + getattr(snowflake, "timeout_buffer_s", 0.0) | ||
| elapsed = time.monotonic() - started.result() if started.done() else 0.0 | ||
| try: | ||
| return await asyncio.wait_for(asyncio.shield(worker), timeout=max(0.0, deadline - elapsed)) |
There was a problem hiding this comment.
Could you stop and drain the SQL worker on CancelledError before releasing the semaphore? Cancelling a request currently leaves its query running and allows concurrency to exceed the configured limit.
There was a problem hiding this comment.
Cancellation now holds the semaphore slot until the Snowflake worker exits, including cancellation during connect, repeated cancellation during the drain, and shutdown. On a real Snowflake account, interrupt() is a no-op, so the slot stays held until the query returns or STATEMENT_TIMEOUT_IN_SECONDS stops it. The SQLite gold step and Spark executor still have their existing cancellation gap.
…s query before releasing the slot Review on NVIDIA-NeMo#6483: - A table alias with a column list (SELECT a.y FROM "t" AS a(y)) renames the table's columns: the new names are accepted, and with every column renamed the old ones are refused, as Snowflake does. With fewer names than columns the old names stay accepted too, since the catalog doesn't keep column order. - If the request is cancelled while its Snowflake query runs, the query is interrupted and its worker thread drained before the semaphore slot is released (also when cancelled again while draining), so no more queries run at once than the configured limit. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Abel Brown <[email protected]>
…ion drains even when the interrupt fails Codex double-blind review of b584dfe: - Unqualified columns are judged against the columns each table shows under its alias, so a new name that another table also has is accepted and a renamed-away name is refused. - More alias names than the table has columns is refused (alias_columns), as Snowflake does; a table alias with a column list is no function call for the SQLite/DuckDB function scan. - _stop_snowflake_worker keeps interrupting and waiting when an interrupt raises, and raises that error only after the worker thread has ended; the cancellation path waits for the stop without shielding its exception into the caller, so the slot is held until the thread ends. - The cancellation test's fake query ends only when interrupted (no timing dependence), and covers a failed first interrupt. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Abel Brown <[email protected]>
… alias-name exemption Codex double-blind review of 1b3ed04: - The query runs on its own thread whose end is a plain future, not a to_thread task: cancelling every task (as asyncio.run does on shutdown) can no longer mark it done while the thread runs, and the cancellation drain calls the stop inline, restarting it if cancelled again, so the slot is held until the thread has ended. - A later successful interrupt clears an earlier interrupt error. - The token scan's alias exemption is dropped: exempting an alias name let a real call of that name through anywhere in the statement. An alias named like a refused function stays a (contrived) false positive. - Tests: the second cancel provably lands mid-drain (the worker's connection close is gated), and a request cancelled while connecting holds its slot until the thread ends. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Abel Brown <[email protected]>
…query thread keeps the request's context Codex double-blind review of 15d235c: - SELECT y AS "x" FROM "t" AS a(y) WHERE "x" > 0 is accepted: select aliases count in the unqualified check even when a catalog column has the same name. - The query thread runs in a copy of the request's context (as asyncio.to_thread did) and isn't a daemon (as the default executor's workers weren't), and the cancellation path retrieves a worker failure it doesn't pass on. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Abel Brown <[email protected]>
…ead is explicitly not a daemon Codex double-blind review of 8a8dc71: the select-alias allowance in the unqualified check was statement-wide, so an alias in one UNION branch excused a column in another (SELECT "X" FROM "t" UNION ALL SELECT 0 AS "X"). It is now the aliases of the column's own SELECT. daemon=False is set explicitly, since a thread otherwise inherits its creator's flag. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Abel Brown <[email protected]>
… stops keep the interrupt interval Codex double-blind review of 3ab54da: - SELECT "X" AS "X" FROM "t" is refused again: the own-SELECT alias allowance leaves out the alias whose definition holds the column. - When repeated cancellation restarts the drain (an AnyIO cancel scope cancels every wait), interrupts stay one retry interval apart instead of running at event-loop speed. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Abel Brown <[email protected]>
… interval Codex double-blind review of 0701aa4 (nothing blocking): after a restart, the next interrupt round now comes one retry interval after the last one, not a full interval after the restart. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Abel Brown <[email protected]>
|
Pushed @dhruvnathawani could you re-review the new head? @ffrujeri could you run |
|
/ok to test 0372a0e |
… coverage) The core test test_birdbench_snowflake_context.py imports setup_bird_snowflake, which imports setup_bird_spark, so both now count toward the combined core coverage gate. The core environment has no duckdb, fakesnow, snowflake-connector-python or pyspark, so most of both files went unmeasured (206 statements missed; 94.87% against 95.00%). These tests replace those packages with fakes in sys.modules and check the statements, parameters and failure handling each setup path sends to its engine. Both files are fully covered by them. Also removes setup_bird_snowflake._db_ids, which nothing called. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Abel Brown <[email protected]>
|
CI missed the combined core coverage gate (94.87% vs 95%). @ffrujeri could you run |
What does this PR do?
Review
prompts/default_snowflake.yaml, the new config fields inbird_sql/app.py, the Snowflake half ofeval_utils.py(snowflake_rejectionand the executor), andsetup_bird_snowflake.py(the stand-in build, the read-only role and the startup visibility check). Skip the tests,snowflake_gold_check.pyandsnowflake_load_account.py. Laid out like the Spark and PostgreSQL dialects (#6063). Push history is in the comments.Adds
--dialect snowflaketo the BIRD benchmark, next tosqlite,sparkandpostgres. By default the model's Snowflake SQL runs on fakesnow, a local stand-in that runs Snowflake SQL on DuckDB, so no account is needed. The gold SQL runs untouched on SQLite and the two results are compared, as for the other dialects. Calibrated on a real Snowflake account (BIRD dev): the stand-in and Snowflake agree on pass or fail for 1,498 of 1,532 translated gold queries (97.8%), and for 1,523 of 1,532 of a model's own answers (99.4%, Nemotron 3.5 Lightning).dialect: snowflake): builds a read-only DuckDB copy of the BIRD databases on first start (dev: about 16 s, 850 MB), keeping BIRD's names, created quoted so they're case-sensitive as on Snowflake. DuckDB's file and network access is off and locked.snowflake_engine: snowflakegrades on an account through a named connector connection; no credentials go in Gym's config. The verifier connects as a read-only role with secondary roles off, and startup fails if that role can't see a table.eval.sh: schema-qualified, double-quoted names and Snowflake column types. The prompt is the PostgreSQL prompt with the engine changed.fakesnow==0.12.1andsnowflake-connector-python<5, locked dependencies ofbird_sqlonly, loaded only fordialect: snowflake. Everything they add to the lock is MIT or Apache-2.0 (licenses in thebird_sqlREADME; one metadata inconsistency in fakesnow is raised in a comment).Open question, identifier case (default: keep BIRD's mixed-case names, quoted). Upper-casing them, as #6063 lower-cased PostgreSQL's columns, would let unquoted names resolve (the check refused 209 of Lightning's 1,532 answers for case; 208 of them write the name unquoted), but it changes the loader,
prepare, the gold check and the account layout: a follow-up.Validation
bird_sqltests at this head: 224 passed, 31 skipped (the PostgreSQL tests; no PostgreSQL server here). With local PostgreSQL 16 and Spark, 255 passed at8a48e65df93bae1b589fbe32498e5e93b73e7acc, before this merge withmain; not rerun since.birdbenchtests: 116 passed, 6 skipped (the BM25 tests, withoutbm25s; with it,test_build_db_values.pypasses 54 of 54). A copy of the Snowflakesql_contexttest runs in CI fromtests/unit_tests/benchmarks/.snowflake_gold_check.pyon dev: 1,413 of 1,534 golds match on the stand-in, 1,439 on the account. A rerun of the same check on a fresh clone with a freshly built stand-in gave the same result, question by question. The 121 that don't match on the stand-in are classed infailures_by_class.json.eval.sh --dialect snowflakeon all of dev with a stub model that answers the translations: the same 1,413 questions pass.main(with feat(birdbench): add BIRD's 2025-11-06 dev and both Mini-Dev releases as dated versions, and a schema-only prompt #6711), and merging cleanly with today'smain:uv lock --check, the component-lock check, the secrets detector and pre-commit pass.Rollouts
Nemotron 3.5 Lightning on all of dev (thinking on for every request, temperature 0, 16,000 max output tokens): pass@1 51.96% on the stand-in, 51.50% on a real account.
Compatibility and benchmark impact
The defaults for
sqlite,sparkandpostgresare unchanged, but two lock changes reach every dialect: fakesnow requiressqlglot~=30.22.0, so thebird_sqllock moves sqlglot from 30.33.0 to 30.22.0, and botocore, through the connector, moves python-dateutil from 4.0.0 to 2.9.0.post0. The Spark and PostgreSQL tests passed on both (the 255 above).A Gym maintainer merges after an approving review, as for #6063.
Checklist
pre-commit run --all-files) (so CI lint/format checks pass).git commit -s) (so the DCO check passes).🤖 Generated with Claude Code