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 path hint keys #242

Closed
apstndb opened this issue Dec 23, 2024 · 0 comments · Fixed by #250
Closed

Support path hint keys #242

apstndb opened this issue Dec 23, 2024 · 0 comments · Fixed by #250

Comments

@apstndb
Copy link
Contributor

apstndb commented Dec 23, 2024

Keys of Hint record are currently ast.Ident.

type HintRecord struct {
	Key   *Ident
	Value Expr
}

but they must be a path.

@{ hint [, ...] }

hint:
  [engine_name.]hint_name = value

Real example

All known hints have implicit engine name spanner.

spanner> @{spanner.optimizer_version=5} SELECT 1;
+-------+
|       |
| INT64 |
+-------+
| 1     |
+-------+
1 rows in set (1.02 msecs)
timestamp:            2024-12-23T23:55:34.448052+09:00
cpu time:             0.98 msecs
rows scanned:         0 rows
deleted rows scanned: 0 rows
optimizer version:    5
optimizer statistics: auto_20241222_02_16_49UTC

There are some options with spanner_emulator engine name for Spanner Emulator.

https://github.com/GoogleCloudPlatform/cloud-spanner-emulator/blob/7ad3d598613bc6fef5ef9806bb5a3ee343f15586/backend/query/query_validator.cc#L117-L118

Like this.

$ go run github.com/cloudspannerecosystem/memefish/tools/parse@latest --mode query "@{spanner_emulator.disable_query_partitionability_check=true} SELECT * FROM Singers ORDER BY FirstName" 
--- Error
syntax error: :1:19: expected token: =, but: .
  1|  @{spanner_emulator.disable_query_partitionability_check=true} SELECT * FROM Singers ORDER BY FirstName
   |                    ^

Note: To fix it, breaking changes are required. ast.Ident → ast.Path.

makenowjust added a commit to makenowjust/memefish that referenced this issue Jan 1, 2025
Fix cloudspannerecosystem#242

It is a breaking change due to modifying the AST node structure.
makenowjust added a commit to makenowjust/memefish that referenced this issue Jan 1, 2025
Fix cloudspannerecosystem#242

It is a breaking change due to modifying the AST node structure.
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 a pull request may close this issue.

1 participant