BigQuery Introduces Enhanced SQL Group By Features for STRUCTs and ARRAYs

May 14, 2025 at 2:57:24 AM

TL;DR Google has announced new SQL features in BigQuery that enhance data grouping and query flexibility. The GROUP BY STRUCT feature allows grouping of STRUCT types if all fields are groupable, applicable only in GROUP BY or SELECT DISTINCT clauses. The GROUP BY ARRAY feature supports ARRAY types under similar conditions. Additionally, the GROUP BY ALL clause infers grouping keys from SELECT items while excluding expressions with aggregate or window functions.

BigQuery Introduces Enhanced SQL Group By Features for STRUCTs and ARRAYs

Google has announced the general availability (GA) of several powerful SQL features in BigQuery, enhancing data grouping capabilities and query flexibility.

GROUP BY STRUCT Feature

The GROUP BY STRUCT feature and the SELECT DISTINCT clause are now fully supported in BigQuery. This implementation follows specific grouping rules:

  • A STRUCT type is groupable if all its field types are groupable
  • STRUCT types can only be grouped in a GROUP BY clause or a SELECT DISTINCT clause
  • Two structs are considered in the same group when either:
  • Both structs are NULL
  • All corresponding field values between the structs belong to the same groups

GROUP BY ARRAY Feature

Similarly, BigQuery now fully supports GROUP BY ARRAY functionality and the SELECT DISTINCT clause with arrays. The grouping behavior follows these principles:

  • An ARRAY type is groupable when its element type is groupable
  • ARRAY types can only be grouped in a GROUP BY clause or a SELECT DISTINCT clause
  • Two arrays are considered in the same group when either:
  • Both arrays are NULL
  • The arrays have identical element counts and all corresponding elements belong to the same groups

GROUP BY ALL Clause

The new GROUP BY ALL clause introduces intelligent grouping by automatically inferring grouping keys from the SELECT items. This feature excludes certain SELECT items from the inference:

  • Expressions containing aggregate functions
  • Expressions containing window functions
  • Expressions that don't reference names from the FROM clause, including:
  • Constants
  • Query parameters
  • Correlated column references
  • Expressions only referencing GROUP BY keys inferred from other SELECT items

Have more questions on this topic? Ask our AI assistant for in-depth insights.

Read more from sources πŸ‘‡

The Only Digital Marketing Feed You'll Ever Need.

Stay informed your way. Tailored updates when and how you want them. 100% Free.

10,000+ Users

500+ Sources

1000+ Tools

Or

Related Posts

Google Enhances BigQuery with New Monitoring Tools and Multimodal Analysis Features

Google Enhances BigQuery with New Monitoring Tools and Multimodal Analysis Features

Google Cloud
Google Cloud

Official Source

Official Source

Google Cloud is a Official Source. The source has been verified by Swipe Insight team.

Official Source
Google Introduces Autosave Feature for BigQuery Saved Queries

Google Introduces Autosave Feature for BigQuery Saved Queries

Google Cloud
Google Cloud

Official Source

Official Source

Google Cloud is a Official Source. The source has been verified by Swipe Insight team.

Official Source
Gemini Assistant Launches in BigQuery Data Canvas for Enhanced Data Analytics

Gemini Assistant Launches in BigQuery Data Canvas for Enhanced Data Analytics

Google Cloud
Google Cloud

Official Source

Official Source

Google Cloud is a Official Source. The source has been verified by Swipe Insight team.

Official Source
Tired of spending too much time creating audits for your clients?

Tired of spending too much time creating audits for your clients?

Featured
BigQuery ML Now Supports Llama and Mistral Models for Advanced Text Generation

BigQuery ML Now Supports Llama and Mistral Models for Advanced Text Generation

Google Cloud
Google Cloud

Official Source

Official Source

Google Cloud is a Official Source. The source has been verified by Swipe Insight team.

Official Source
BigQuery Introduces Metadata Caching for SQL Translation

BigQuery Introduces Metadata Caching for SQL Translation

Google Cloud
Google Cloud

Official Source

Official Source

Google Cloud is a Official Source. The source has been verified by Swipe Insight team.

Official Source
BigQuery Data Transfer Service adds Google Analytics 4 reporting support Trending ️‍πŸ”₯

BigQuery Data Transfer Service adds Google Analytics 4 reporting support

Google Cloud
Google Cloud

Official Source

Official Source

Google Cloud is a Official Source. The source has been verified by Swipe Insight team.

Official Source
Google Updates BigQuery with New Pipelines, Version Control, and Claude AI Integration

Google Updates BigQuery with New Pipelines, Version Control, and Claude AI Integration

Google Cloud
Google Cloud

Official Source

Official Source

Google Cloud is a Official Source. The source has been verified by Swipe Insight team.

Official Source

Related Tools

Markifact logo

Markifact

Verified Tool

Verified Tool

Markifact is a Verified Tool. Want to get this badge? Contact us.

Verified Tool

Marketing Workflows Powered by AI

Featured
Marketing Auditor logo

Marketing Auditor

Verified Tool

Verified Tool

Marketing Auditor is a Verified Tool. Want to get this badge? Contact us.

Verified Tool

Automated audits for Google Ads and Analytics.

Get Featured Here

Showcase your tool in this list.

Contact Us
Databricks logo

Databricks

Generative AI-powered data intelligence platform

Data Engineering
GA4 SQL logo

GA4 SQL

Verified Tool

Verified Tool

GA4 SQL is a Verified Tool. Want to get this badge? Contact us.

Verified Tool

Generate GA4 BigQuery queries easily

Data Analysis
TapClicks logo

TapClicks

Automated marketing solutions powered by your data

Data Engineering
Stitch logo

Stitch

Automated cloud data pipelines, no coding needed

Data Engineering
Akkio logo

Akkio

AI-powered analytics for agencies

Data Analysis
NinjaCat logo

NinjaCat

AI-powered marketing data and analytics platform

Reporting
Funnel logo

Funnel

Aggregate and analyze marketing data seamlessly

Reporting
Fivetran logo

Fivetran

Effortlessly centralize and move data from any source

Data Engineering

Get Featured Here

Showcase your tool in this list.

Contact Us