News Developer Tools

Google Cloud adds BigQuery AI aggregation for text and images

Google Cloud's AI.AGG function in BigQuery summarizes millions of text and image rows with one SQL query, using Gemini models in batched stages.

Google Cloud has added AI.AGG to BigQuery, a function that summarizes themes across millions of rows of text and images with a single SQL query. Google Cloud says the feature is in preview and runs inside BigQuery's SQL language.

The function addresses a limit of language models: they cannot take millions of rows in one prompt without truncation or failures. Google Cloud says teams previously built external pipelines to split data, handle rate limits, and stitch summaries together. AI.AGG handles that work inside the database.

The process runs in stages. BigQuery first checks that no row exceeds the size limit, with payloads over 10 MiB dropped or returned as errors. It then groups rows into batches that fit a Gemini model's limits and applies the user's instruction to each batch in parallel. The intermediate summaries are batched and sent back with the same instruction, repeating until one result remains for each GROUP BY group. Every stage uses full-weight language models.

AI.AGG accepts images stored in Cloud Storage through BigQuery Object Tables, without moving or converting the files. When a query passes several columns together and one value is NULL, the whole row is silently discarded. Wrapping nullable fields in IFNULL() keeps those rows in the input.

Source: Google Cloud announcement.