live wire
▸EKOS submits 70.15% on BIRD’s hidden test and 88.33% on Mini-Dev with different Claude models; both entries are pendingBIRD submission PR #270▸MotherDuck rolls out DuckDB 2.0 with async I/O and reports faster cold reads in TPC-H and TPC-DS testsMotherDuck▸ThoughtSpot Spotter starts rolling out answer explanations for token-based results, not AgentQLThoughtSpot▸Snowflake previews Z.ai GLM 5.4 in Cortex Inference, but not in Cortex AgentsSnowflake release notes▸Removing Vietnamese diacritics cut text-to-SQL accuracy by 10.3–37.0 points across four models in an author studyLe Trung et al., Vietnamese MultiSpider artifacts▸Avelis 1.7 adds AI-built dashboards and reruns pinned exploratory SQL under each viewer’s permissionsAvelis release notes▸Aurora MySQL previews cluster groups with one routing endpoint; each query still runs on one clusterAWS What's New▸Rewind-HNSW uses 86.9% less memory than full snapshots in authors’ 20-version testsShea et al., Rewind-HNSW §5.5▸Snowflake previews pausing downstream dynamic table refreshes when data quality checks failSnowflake release notes▸BigQuery previews optional GoogleSQL optimization suggestions in its interactive SQL translatorGoogle Cloud documentation▸Snowflake extends its Tableau and Power BI dashboard migration preview to Azure deploymentsSnowflake release notes▸Google Cloud makes it generally available to unpublish Iceberg data shares from SAP Business Data CloudGoogle Cloud — BigQuery and Lakehouse documentation▸AWS previews organization-wide cost questions in Ops Agent for FinOpsAWS What's New▸Looker updates require API login credentials in the request body, not the URLGoogle Cloud — Looker documentation▸EKOS submits 70.15% on BIRD’s hidden test and 88.33% on Mini-Dev with different Claude models; both entries are pendingBIRD submission PR #270▸MotherDuck rolls out DuckDB 2.0 with async I/O and reports faster cold reads in TPC-H and TPC-DS testsMotherDuck▸ThoughtSpot Spotter starts rolling out answer explanations for token-based results, not AgentQLThoughtSpot▸Snowflake previews Z.ai GLM 5.4 in Cortex Inference, but not in Cortex AgentsSnowflake release notes▸Removing Vietnamese diacritics cut text-to-SQL accuracy by 10.3–37.0 points across four models in an author studyLe Trung et al., Vietnamese MultiSpider artifacts▸Avelis 1.7 adds AI-built dashboards and reruns pinned exploratory SQL under each viewer’s permissionsAvelis release notes▸Aurora MySQL previews cluster groups with one routing endpoint; each query still runs on one clusterAWS What's New▸Rewind-HNSW uses 86.9% less memory than full snapshots in authors’ 20-version testsShea et al., Rewind-HNSW §5.5▸Snowflake previews pausing downstream dynamic table refreshes when data quality checks failSnowflake release notes▸BigQuery previews optional GoogleSQL optimization suggestions in its interactive SQL translatorGoogle Cloud documentation▸Snowflake extends its Tableau and Power BI dashboard migration preview to Azure deploymentsSnowflake release notes▸Google Cloud makes it generally available to unpublish Iceberg data shares from SAP Business Data CloudGoogle Cloud — BigQuery and Lakehouse documentation▸AWS previews organization-wide cost questions in Ops Agent for FinOpsAWS What's New▸Looker updates require API login credentials in the request body, not the URLGoogle Cloud — Looker documentation
nl2sql.ai
guideSQL agent acceptance test

Snowflake MAX_BY can name one top seller even when two tie

A single returned ID does not establish a unique winner. Test whether the generated SQL preserves ties, applies an approved tie-breaker, or picks an unspecified row.

By The News Desk· Nov 28, 2026the quick take — two AI hosts go live when you do

Ask a Snowflake-backed analytics agent, “Which product had the most net sales last week?” and inspect how the SQL handles a tie. MAX_BY(product_id, net_sales) can return a single product ID even when two products share the highest sales total. Snowflake documents that the choice is nondeterministic when multiple rows contain the maximum. The returned product is a leader, but the result does not establish that it was the only leader.

Test what happens at the cutoff

Start with a synthetic weekly summary that already has one row per product: A and B each have net sales of 120, C has 90, and D has a null total. The scalar MAX_BY can return A or B and ignores D's null score. The optional third argument limits the number of rows represented in the returned array; it does not set a tie policy. With a limit of two, this fixture yields A and B in an unspecified order. Add a third product at 120 and the two-element result can no longer show every co-leader. The function reference also specifies that if every score is null, the function returns null, even with the array argument. That fixture should produce “no known leader,” not “all products tied.”

Put the tie rule into the query

If the business question means “show every product tied for first,” filter out null scores and use a rank that gives equal scores the same position. In this example, weekly_product_sales is the already-aggregated weekly summary described above. Snowflake's DENSE_RANK reference documents that equal values share a rank.

WITH ranked AS (
  SELECT product_id, net_sales,
         DENSE_RANK() OVER (ORDER BY net_sales DESC) AS sales_rank
  FROM weekly_product_sales
  WHERE net_sales IS NOT NULL
)
SELECT product_id, net_sales
FROM ranked
WHERE sales_rank = 1
ORDER BY product_id;

The final sort controls how the co-leaders are displayed; it does not break the tie. If a downstream workflow requires exactly one winner, use a business-approved secondary criterion and disclose it in the answer. A stable product ID can order a display, but it should not become a sales tie-breaker by accident. For an acceptance test, assert the returned set and the wording: “A and B tied at 120” passes; “A was the top seller” alone does not. The fixture illustrates documented behavior; it is not a measured warehouse run.

Filed by The News Desk. Corrections: desk@nl2sql.ai · Our standards →

comments · 0

    Comments are moderated before they appear. Your email is used once to confirm it is you — never shown, never sold. Corrections and questions get an answer from the desk when we have one.