Skip to content

fix: support quoted select aliases#198

Open
shurarama wants to merge 1 commit into
GoogleCloudPlatform:mainfrom
shurarama:fix/quoted-select-aliases
Open

fix: support quoted select aliases#198
shurarama wants to merge 1 commit into
GoogleCloudPlatform:mainfrom
shurarama:fix/quoted-select-aliases

Conversation

@shurarama
Copy link
Copy Markdown
Contributor

Summary

  • Normalize quoted SELECT aliases by removing CQL double quotes before storing response metadata.
  • Emit non-bare or reserved aliases as Bigtable SQL backtick identifiers so valid Cassandra aliases like AS "TableBindName" and AS "select" prepare successfully.
  • Add regression coverage for quoted column, aggregate, WRITETIME, GROUP BY, and ORDER BY aliases.

Test plan

  • go test ./translators/select_translator -run TestTranslator_TranslateSelectQuerytoBigtable -count=1
  • go test ./parser ./translators/...
  • Verified the new alias tests fail on the pre-fix code in a clean temporary worktree.

@google-cla
Copy link
Copy Markdown

google-cla Bot commented May 12, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces support for quoted aliases in the CQL-to-Bigtable SQL translation layer, ensuring that aliases in SELECT, GROUP BY, and ORDER BY clauses are correctly formatted with backticks when necessary. Feedback indicates that the alias formatting logic needs to escape backslashes in addition to backticks to prevent syntax errors in GoogleSQL. Additionally, the check for bare identifiers should be updated to use Bigtable SQL reserved keywords rather than CQL keywords to ensure full compatibility with the target environment.

@shurarama shurarama force-pushed the fix/quoted-select-aliases branch 3 times, most recently from dc191ed to 9770cd4 Compare May 12, 2026 14:46
@shurarama shurarama force-pushed the fix/quoted-select-aliases branch from 9770cd4 to 62e6e63 Compare May 12, 2026 14:53
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.

1 participant