Skip to content

bigquery live connector export fix#9400

Merged
k-anshul merged 6 commits into
mainfrom
bigquery_export_fix
May 11, 2026
Merged

bigquery live connector export fix#9400
k-anshul merged 6 commits into
mainfrom
bigquery_export_fix

Conversation

@k-anshul
Copy link
Copy Markdown
Member

@k-anshul k-anshul commented May 6, 2026

closes https://linear.app/rilldata/issue/PLAT-481/fix-exports-for-metrics-on-bigquery

Checklist:

  • Covered by tests
  • Ran it and it works as intended
  • Reviewed the diff before requesting a review
  • Checked for unhandled edge cases
  • Linked the issues it closes
  • Checked if the docs need to be updated. If so, create a separate Linear DOCS issue
  • Intend to cherry-pick into the release branch
  • I'm proud of this work!

@k-anshul k-anshul self-assigned this May 6, 2026
@k-anshul k-anshul requested a review from a team as a code owner May 6, 2026 10:35
@k-anshul k-anshul marked this pull request as draft May 6, 2026 12:47
@k-anshul k-anshul marked this pull request as ready for review May 7, 2026 10:43
@k-anshul k-anshul requested a review from begelundmuller May 7, 2026 10:43
Comment thread runtime/drivers/bigquery/dialect.go Outdated
Comment on lines +38 to +47
func BigQueryEscapeAlias(alias string) string {
return BigQueryEscapeIdentifier(BigQueryAliasName(alias))
}

// BigQueryAliasName returns the column name BigQuery produces when the given string is used as a SELECT alias.
// BigQuery flexible column names disallow certain characters; runs of disallowed characters are collapsed to "__"
// and any trailing underscores are trimmed.
func BigQueryAliasName(alias string) string {
return strings.TrimRight(bqRestrictedRunRegex.ReplaceAllString(alias, "__"), "_")
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand how this is safe – isn't EscapeAlias sometimes called for non-display-name columns? If so, then won't this cause it to fail silently instead of error?

I had expected a dialect.SanitizeDisplayName function or something like that, which would explicitly be called in the places where UseDisplayNames is checked. To ensure that we never rewrite columns unless they are display names (because with display names we know/assume that people are not expecting perfectly correct names)

Comment thread runtime/drivers/bigquery/dialect.go Outdated
Comment on lines +14 to +17
// bqRestrictedRunRegex matches characters that are NOT supported in
// BigQuery flexible column names. See:
// https://cloud.google.com/bigquery/docs/schemas#flexible-column-names
var bqRestrictedRunRegex = regexp.MustCompile(`[!"$()*,./;?@\[\\\]^` + "`" + `{}~\s]+`)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The term "restricted run regex" doesn't feel very informative. What about something like restrictedAliasCharactersRegex? (Btw, when code is inside a package named "bigquery", you don't need to prefix variables with "bq" – it's implied.)

@k-anshul k-anshul requested a review from begelundmuller May 8, 2026 10:27
Copy link
Copy Markdown
Contributor

@begelundmuller begelundmuller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very minor nit, up to you if you want to handle or leave as it is.

Comment thread runtime/metricsview/executor/executor_pivot.go Outdated
@k-anshul k-anshul merged commit 5fc5258 into main May 11, 2026
8 of 10 checks passed
@k-anshul k-anshul deleted the bigquery_export_fix branch May 11, 2026 03:42
k-anshul added a commit that referenced this pull request May 13, 2026
* bigquery live connector export fix

* fix for all display names

* self revie

* review comments

* self review

* review comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants