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 GUIDE

BigQuery’s HAVING MAX finds the latest timestamp, not necessarily the latest status

If two events share a timestamp, use a source sequence that actually defines their order—or report that the latest status is ambiguous.

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

“Show the latest status for each order” sounds like a request for one row per order. In BigQuery, ANY_VALUE(status HAVING MAX(event_ts)) can return one value without establishing which event came last. The GoogleSQL aggregate reference says HAVING MAX keeps all rows at the maximum value, and that the row picked by ANY_VALUE in its tied example is nondeterministic, not random. Getting the same answer on two runs is not evidence that the query resolves the tie.

Separate the timestamp from the event order

Suppose order 42 has two events at 10:00:00: packed at source sequence 17 and shipped at sequence 18. Both satisfy HAVING MAX(event_ts), so that clause alone cannot distinguish them. If the source guarantees that higher sequence numbers come later among events with the same timestamp, the business answer is shipped. If it does not, a reproducible arbitrary choice still doesn't tell you which event happened last.

Replacing the aggregate with ROW_NUMBER() ordered only by timestamp doesn't solve this problem. The GoogleSQL numbering reference explicitly leaves row numbering within a peer group nondeterministic. Under the source guarantee above, add the sequence to the window order:

WITH ranked AS (
  SELECT order_id, status, event_ts, source_sequence,
    ROW_NUMBER() OVER (
      PARTITION BY order_id
      ORDER BY event_ts DESC, source_sequence DESC
    ) AS rn
  FROM order_events
  WHERE event_ts IS NOT NULL
)
SELECT order_id, status, event_ts, source_sequence
FROM ranked
WHERE rn = 1;

This example assumes a non-null sequence unique within each order and timestamp; it intentionally excludes undated events. An order with only undated events won't appear. If those orders must appear, decide how to label them before treating the query as a complete status report.

Give the SQL agent a tie it has to resolve

Put the two rows for order 42 in an acceptance test and require shipped, not just one output row. Then remove the source-order guarantee from the test and require the agent to flag the ambiguity or show both candidates. The test checks whether the agent knows what makes a row latest, rather than whether it can make the result look like one row per order. The example is illustrative and was not run against a live BigQuery dataset.

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.