Refacto Agents

Industry story

BigQuery AI.AGG() enables LLM aggregation over millions of SQL rows

ai-in-adtech engineering measurement

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