live wire
▸AWS Partner Central adds plain-language analytics over MCP and daily dataset delivery to S3AWS What's New▸A real-estate SQL agent study finds nine questions its dbt marts could not answerHerman Chan / GitHub▸QueryHub’s 92 SQL queries all ran, but a 30-day default made 10 answers wrong in its SQLite testQueryHub / GitHub▸Dex v1.18.5 reports unsupported Elementary releases as unchecked; incident CLI is deferredExmergo / GitHub▸BIRD-FanOut study cuts SQL overcount errors from 18.4% to about 13% on 229 selected train questionsAhmed M. Mahran / arXiv▸dbt remote MCP lets read-only users query metrics with a shared warehouse credentialdbt Labs documentation▸SchemaGate drops unqualified BIRD Mini-Dev No. 1 claim after benchmark updateSchemaGate / GitHub▸Databricks previews AI_MASK v2 with built-in classifiers and per-row errors; v1 stays the defaultDatabricks documentation▸FedTriCD reports about 20 rounds vs F3KM’s 1,000 on MNIST; its 50× speedup was a separate centralized testNie et al. / arXiv▸BigQuery previews EmbeddingGemma 2 in AI.EMBED with per-token and query compute chargesGoogle Cloud documentation▸Fabric Warehouse previews on-demand billing with workspace queues and a rolling 24-hour capMicrosoft Fabric Updates Blog▸BigQuery makes TabFM 1.1 the default for AI.PREDICT and TabFM evaluations in AI.EVALUATEGoogle Cloud documentation▸Decision columns matched dense retrieval’s product-matching F1 with a shared verifier, but lagged in standalone searchKannan, Bruckner and Bernstein / arXiv▸BigQuery makes regional controls for reservation overrides and blocking on-demand query billing generally availableGoogle Cloud documentation▸AWS Partner Central adds plain-language analytics over MCP and daily dataset delivery to S3AWS What's New▸A real-estate SQL agent study finds nine questions its dbt marts could not answerHerman Chan / GitHub▸QueryHub’s 92 SQL queries all ran, but a 30-day default made 10 answers wrong in its SQLite testQueryHub / GitHub▸Dex v1.18.5 reports unsupported Elementary releases as unchecked; incident CLI is deferredExmergo / GitHub▸BIRD-FanOut study cuts SQL overcount errors from 18.4% to about 13% on 229 selected train questionsAhmed M. Mahran / arXiv▸dbt remote MCP lets read-only users query metrics with a shared warehouse credentialdbt Labs documentation▸SchemaGate drops unqualified BIRD Mini-Dev No. 1 claim after benchmark updateSchemaGate / GitHub▸Databricks previews AI_MASK v2 with built-in classifiers and per-row errors; v1 stays the defaultDatabricks documentation▸FedTriCD reports about 20 rounds vs F3KM’s 1,000 on MNIST; its 50× speedup was a separate centralized testNie et al. / arXiv▸BigQuery previews EmbeddingGemma 2 in AI.EMBED with per-token and query compute chargesGoogle Cloud documentation▸Fabric Warehouse previews on-demand billing with workspace queues and a rolling 24-hour capMicrosoft Fabric Updates Blog▸BigQuery makes TabFM 1.1 the default for AI.PREDICT and TabFM evaluations in AI.EVALUATEGoogle Cloud documentation▸Decision columns matched dense retrieval’s product-matching F1 with a shared verifier, but lagged in standalone searchKannan, Bruckner and Bernstein / arXiv▸BigQuery makes regional controls for reservation overrides and blocking on-demand query billing generally availableGoogle Cloud documentation
nl2sql.ai
guideSQL AGENT FIELD GUIDE

BigQuery’s LEFT JOIN UNNEST keeps orders with no items. COUNT(*) can make them look nonempty.

Keeping every order and counting actual line items are two different jobs. A three-row test exposes the difference in generated GoogleSQL.

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

A request like “show every order and its line-item count” asks for two things: keep all the orders, and count only the items. In BigQuery, changing an inner UNNEST join to a left join fixes the first problem, but not the second. A generated query that leaves COUNT(*) in place can give an order with no items a count of one.

Why the zero becomes a one

Google’s array guide says flattening with an inner join excludes rows whose arrays are empty or NULL. Use a left join when those rows belong in the report. The GoogleSQL join reference explains what happens next: when the right side supplies no matching row, the join creates a row with NULL values on that side. The order survives, but that row does not represent an item.

The COUNT reference distinguishes COUNT(*), which counts rows, from COUNT(expression), which counts non-NULL expression values. In the example below, sku is the array element and every real element in the fixture is non-NULL. That makes it suitable for the second count.

WITH orders AS (
  SELECT 1 AS order_id, ['A', 'B'] AS skus UNION ALL
  SELECT 2, ARRAY<STRING>[] UNION ALL
  SELECT 3, CAST(NULL AS ARRAY<STRING>)
)
SELECT order_id, COUNT(*) AS joined_rows, COUNT(sku) AS item_count
FROM orders
LEFT JOIN UNNEST(skus) AS sku ON TRUE
GROUP BY order_id
ORDER BY order_id;

The documented rules imply joined_rows of 2, 1, and 1, but item_count of 2, 0, and 0. Those are expected values for this fixture, not results from a live warehouse run. If the business question treats a missing array as unknown rather than empty, specify that separately; this item count deliberately gives both cases zero.

What to test in generated SQL

Assert both the returned order IDs and the per-order counts. Testing only the total can hide a dropped order; testing only that every order appears can miss the phantom item. For arrays of structs, don’t blindly substitute a nullable business field for sku: COUNT(item.some_field) answers how many joined items have that field populated, which can differ from how many items exist. Choose the counted expression to match the question, then add a case where a real item has a missing field.

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.