Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Partitioned DML with statement hints #193

Open
apstndb opened this issue Oct 1, 2024 · 1 comment
Open

Support Partitioned DML with statement hints #193

apstndb opened this issue Oct 1, 2024 · 1 comment

Comments

@apstndb
Copy link
Collaborator

apstndb commented Oct 1, 2024

DMLs can be prefixed by statement hints.

https://cloud.google.com/spanner/docs/reference/standard-sql/dml-syntax#delete-statement

[statement_hint_expr] UPDATE table_name [table_hint_expr] [[AS] alias]

https://cloud.google.com/spanner/docs/reference/standard-sql/dml-syntax#update-statement

[statement_hint_expr] UPDATE table_name [table_hint_expr] [[AS] alias]

It seems that only permitted statement hint is PDML_MAX_PARALLELISM for Partitioned DML, so only we need is relaxing pattern of pdmlRe.

pdmlRe = regexp.MustCompile(`(?is)^PARTITIONED\s+((?:INSERT|UPDATE|DELETE)\s+.+$)`)

@yfuruyama
Copy link
Collaborator

Thank you for catching this.

PARTITIONED statement is a spanner-cli specific statement, so it's a little bit tricky to decide where the statement hint should be placed.

  1. @{hint} PARTITIONED UPDATE ...
  2. PARTITIONED @{hint} UPDATE ...

It's possible that other prefixes will be supported in front of DML syntax, so I think option 2 might be better. Then we can think of the PARTITIONED statement syntax as PARTITIONED [DML statement].

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

No branches or pull requests

2 participants