Industry story
BigQuery AI.AGG() enables LLM aggregation over millions of SQL rows
ai-in-adtech engineering measurement
Google just made it possible to run a natural-language summarization across millions of BigQuery rows in a single SQL call — no pipeline, no orchestration layer, no custom batching code. AI.AGG() handles the LLM context-window problem automatically by splitting, summarizing, then re-summarizing, which is elegant but has a real cost: token consumption multiplies at each level, so unfiltered runs on large tables will get expensive fast. The use cases — feature-request mining from reviews, log diagnosis, catalog categorization — are exactly the kind of analyses that currently require a data engineer and a weekend.
Full analysis
Google Cloud has launched a preview of AI.AGG(), a new BigQuery function that lets users write natural-language instructions inside a single SQL query to summarize or synthesize insights across millions of rows of unstructured or multimodal data. Unlike row-level AI functions, AI.AGG() handles scale by automatically splitting data into batches, aggregating each batch, then aggregating those results — managing the LLM (large language model) context window limitation transparently. Use cases include identifying top feature requests from product reviews, diagnosing hidden inefficiencies in system logs, and discovering product categories from image or text catalogs, all without manual data pipelines.
The function supports text and image inputs, returns a string (optionally formatted as JSON for downstream pipeline use), and integrates with other BigQuery AI functions like AI.CLASSIFY() and AI.SCORE(). Google notes that the multi-level aggregation architecture can increase total token consumption relative to the raw data size, so filtering upstream is recommended for cost control. The function defaults to a recent Gemini model (e.g., Gemini 2.5 Flash) but allows fully-qualified model endpoint specification for production pipelines.
Comments