Skip to content

Classify SQL statement kind in BigQuery connector tracing spans #897

Description

@hugocorreia90

The Snowflake and Databricks connectors both classify each statement.execute tracing span's statement.kind / rocky.statement.kind attribute as query / dml / ddl, via a classify_statement_kind(sql) matcher. BigQuery is the lone warehouse-adapter holdout: it hardcodes statement.kind = "query" and carries an explicit TODO.

This is a cross-adapter parity / observability-consistency task, not a bug fix: with BigQuery classifying like the others, dashboards can filter ddl/dml/query traffic uniformly across every warehouse adapter. (The existing TODO hedges "if downstream consumers need to filter" — the justification is span-attribute consistency across adapters.)

Mirror the merged Snowflake work in PR #540 (closed issue #481) — it's the template; this issue is the BigQuery twin.

Scope

Port a classify_statement_kind(sql) -> &'static str matcher into rocky-bigquery and use it for both the statement.kind and rocky.statement.kind span attributes in run_query, replacing the hardcoded "query".

Code refs

  • engine/crates/rocky-bigquery/src/connector.rs around line 287 — the // TODO: classify via rocky-sql marker and the hardcoded statement.kind = "query" in run_query
  • engine/crates/rocky-snowflake/src/connector.rs:623fn classify_statement_kind to mirror
  • engine/crates/rocky-snowflake/src/connector.rs:788+ — the query/dml/ddl unit tests to mirror
  • engine/crates/rocky-databricks/src/connector.rs:1211 — second in-repo reference implementation
  • PR fix(engine/rocky-snowflake): classify Snowflake statement spans #540 — the merged Snowflake template

Acceptance criteria

  • Both statement.kind and rocky.statement.kind on the BigQuery statement.execute span reflect the classified kind (query / dml / ddl)
  • Unit tests cover query, dml, and ddl classification (mirror the Snowflake tests)
  • cargo test -p rocky-bigquery is green

Effort

2 hours.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions