From 820ea15b72a71475d36e09e52503c589e536685a Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 14 Oct 2026 17:16:13 +0000 Subject: [PATCH] Parse Spanner-only DDL under a new SPANNER_DDL feature Add SPANNER_DDL, a zetajones-only feature (not in MAXIMUM) that parses the Cloud Spanner syntax the GoogleSQL reference parser rejects: all 150 statements in parser/testdata/spanner/**/*.spanner.sql. Reference nodes are reused where Spanner has a GoogleSQL equivalent: - ", ROW DELETION POLICY (...)" / ", OPTIONS (...)" after PRIMARY KEY produce TtlClause / OptionsList, as without the comma; ", INTERLEAVE IN t" is a SpannerInterleaveClause - NOT NULL before DEFAULT/AS joins the attribute list after it, as in SpannerAlterColumnAction; non-stored ALTER COLUMN AS (...) - ARRAY(vector_length=>N) is a NamedArgument type parameter - ROLE and PLACEMENT become generic entity types, SYNONYM a generic sub-entity type; dashed database ids; trailing comma in OPTIONS - search/vector index ORDER BY and WHERE reuse OrderBy and WhereClause New nodes (ast/spanner.go) cover GRANT/REVOKE ... TO/FROM ROLE and GRANT ROLE, change streams, proto bundles, queues, ALTER LOCALITY GROUP, identity SKIP RANGE / START COUNTER WITH / ALTER IDENTITY, PLACEMENT KEY, AUTO_INCREMENT, ON UPDATE, table synonyms and ALTER INDEX ADD/DROP STORED COLUMN. DROP CHANGE STREAM / LOCALITY GROUP use DropStatement, and RENAME TABLE takes further pairs. Also implement the reference's CREATE LOCALITY GROUP (FEATURE_CREATE_LOCALITY_GROUP) and CREATE TABLE ttl_clause. The corpus generator now enables +TTL,+CREATE_LOCALITY_GROUP, which turns 8 former backlog statements into golden cases. Two backlog entries missing a semicolon in the docs are reclassified as typos. Tests: TestSpannerOnlySyntax checks that every backlog statement parses with SPANNER_DDL and fails without it; hand-reviewed expected trees live in parser/testdata/extensions/spanner (79 cases, run by TestParser); the fuzz target now also runs with SPANNER_DDL. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01FTpNRheE3PdSX5XftfH7Nq --- CLAUDE.md | 29 +- README.md | 20 + ast/ast.go | 84 +- ast/spanner.go | 266 +++++++ cmd/spanner-corpus/main.go | 2 +- cmd/spanner-corpus/triage.txt | 12 +- internal/dump/dump.go | 7 + internal/dump/spanner.go | 87 +++ parser/fuzz_test.go | 9 +- parser/parser.go | 295 ++++++- parser/parser_test.go | 7 + parser/spanner.go | 731 ++++++++++++++++++ parser/spanner_test.go | 89 +++ .../extensions/spanner/change_streams.test | 103 +++ .../testdata/extensions/spanner/columns.test | 190 +++++ .../testdata/extensions/spanner/entities.test | 136 ++++ parser/testdata/extensions/spanner/grant.test | 175 +++++ .../testdata/extensions/spanner/identity.test | 122 +++ .../testdata/extensions/spanner/indexes.test | 120 +++ .../extensions/spanner/locality_groups.test | 47 ++ .../extensions/spanner/proto_bundles.test | 53 ++ .../extensions/spanner/table_options.test | 229 ++++++ .../spanner/aggregate-function-calls.test | 2 +- .../testdata/spanner/aggregate_functions.test | 2 +- parser/testdata/spanner/array_functions.test | 2 +- parser/testdata/spanner/bit_functions.test | 2 +- .../testdata/spanner/collation-concepts.test | 2 +- .../spanner/compression-functions.test | 2 +- .../spanner/conditional_expressions.test | 2 +- .../spanner/conversion_functions.test | 2 +- .../data-definition-language.metadata.json | 1 - .../data-definition-language.spanner.sql | 2 +- .../spanner/data-definition-language.test | 2 +- parser/testdata/spanner/data-types.test | 2 +- parser/testdata/spanner/date_functions.test | 2 +- .../testdata/spanner/debugging_functions.test | 2 +- .../testdata/spanner/dml-syntax.spanner.sql | 2 +- parser/testdata/spanner/dml-syntax.test | 2 +- parser/testdata/spanner/format-elements.test | 2 +- .../testdata/spanner/graph-gql-functions.test | 2 +- parser/testdata/spanner/graph-operators.test | 2 +- parser/testdata/spanner/graph-patterns.test | 2 +- .../spanner/graph-query-statements.test | 2 +- .../graph-schema-statements.metadata.json | 1 - .../spanner/graph-schema-statements.test | 2 +- .../testdata/spanner/graph-sql-queries.test | 2 +- parser/testdata/spanner/graph-subqueries.test | 2 +- .../spanner/guides/backfill-embeddings.test | 2 +- .../best-practices-gaming-database.test | 2 +- .../testdata/spanner/guides/bulk-loading.test | 2 +- .../guides/change-streams.details.test | 2 +- .../guides/change-streams.manage.spanner.sql | 2 +- .../guides/change-streams.use-dataflow.test | 2 +- .../guides/check-constraint.how-to.test | 2 +- .../spanner/guides/commit-timestamp.test | 2 +- .../configure-columnar-engine.spanner.sql | 2 +- .../guides/configure-columnar-engine.test | 2 +- .../spanner/guides/configure-fgac.spanner.sql | 2 +- .../spanner/guides/configure-fgac.test | 2 +- .../create-manage-data-placements.spanner.sql | 2 +- .../guides/create-manage-data-placements.test | 2 +- .../guides/create-manage-databases.test | 2 +- .../create-manage-locality-groups.spanner.sql | 23 +- .../guides/create-manage-locality-groups.test | 52 +- .../guides/create-manage-split-points.test | 2 +- .../guides/create-manage-views.spanner.sql | 2 +- .../spanner/guides/create-manage-views.test | 2 +- .../guides/create-query-database-console.test | 2 +- .../databoost.databoost-run-queries.test | 2 +- .../spanner/guides/dml-best-practices.test | 2 +- .../spanner/guides/fgac-about.spanner.sql | 2 +- .../guides/fgac-privileges.spanner.sql | 2 +- .../spanner/guides/fgac-privileges.test | 2 +- .../spanner/guides/fgac-queues.spanner.sql | 2 +- .../guides/fgac-system-roles.spanner.sql | 2 +- .../find-approximate-nearest-neighbors.test | 2 +- .../guides/find-k-nearest-neighbors.test | 2 +- .../spanner/guides/foreign-keys.how-to.test | 2 +- .../spanner/guides/foreign-keys.overview.test | 2 +- ...xt-search.combine-tokenlists.metadata.json | 1 - .../full-text-search.combine-tokenlists.test | 2 +- .../full-text-search.facets.metadata.json | 1 - .../full-text-search.facets.spanner.sql | 2 +- .../guides/full-text-search.facets.test | 2 +- ...ull-text-search.fuzzy-search.metadata.json | 1 - .../guides/full-text-search.fuzzy-search.test | 2 +- ...ll-text-and-non-text-queries.metadata.json | 1 - ...ch.mix-full-text-and-non-text-queries.test | 2 +- ...-text-search.numeric-indexes.metadata.json | 1 - .../full-text-search.numeric-indexes.test | 2 +- ...l-text-search.paginate-search-results.test | 2 +- ...earch.partition-search-index.metadata.json | 1 - ...ll-text-search.partition-search-index.test | 2 +- ...tching-function-acceleration.metadata.json | 1 - ...attern-matching-function-acceleration.test | 2 +- ...l-text-search.query-overview.metadata.json | 1 - .../full-text-search.query-overview.test | 2 +- .../full-text-search.ranked-search.test | 2 +- ...l-text-search.search-indexes.metadata.json | 1 - ...ull-text-search.search-indexes.spanner.sql | 2 +- .../full-text-search.search-indexes.test | 2 +- ...arch.search-multiple-columns.metadata.json | 1 - ...l-text-search.search-multiple-columns.test | 2 +- ...earch.search-query-enhancement.spanner.sql | 2 +- ...-text-search.search-query-enhancement.test | 2 +- ...text-search.substring-search.metadata.json | 1 - .../full-text-search.substring-search.test | 2 +- ...ull-text-search.tokenization.metadata.json | 1 - .../guides/full-text-search.tokenization.test | 2 +- ...earch.top-k-pattern-matching.metadata.json | 1 - ...-search.top-k-pattern-matching.spanner.sql | 21 - ...ll-text-search.top-k-pattern-matching.test | 2 +- .../generated-column.how-to.spanner.sql | 2 +- .../guides/generated-column.how-to.test | 2 +- .../spanner/guides/getting-started.jdbc.test | 2 +- ...aph.algorithm-best-practices.metadata.json | 1 - .../graph.algorithm-best-practices.test | 2 +- .../spanner/guides/graph.algorithms.test | 2 +- ...est-practices-designing-schema.spanner.sql | 2 +- ...graph.best-practices-designing-schema.test | 2 +- .../graph.best-practices-tuning-queries.test | 2 +- ...ph.create-update-drop-schema.metadata.json | 1 - .../graph.create-update-drop-schema.test | 2 +- ...h.full-text-search-and-graph.metadata.json | 1 - .../graph.full-text-search-and-graph.test | 2 +- .../graph.graph-algorithms-overview.test | 2 +- ...raph.graph-with-views-how-to.metadata.json | 1 - .../graph.graph-with-views-how-to.spanner.sql | 2 +- .../guides/graph.graph-with-views-how-to.test | 2 +- ...ph.graph-with-views-overview.metadata.json | 1 - .../graph.graph-with-views-overview.test | 2 +- .../graph.insert-update-delete-data.test | 2 +- ...graph.manage-schemaless-data.metadata.json | 1 - .../guides/graph.manage-schemaless-data.test | 2 +- ...orm-vector-similarity-search.metadata.json | 1 - ...rform-vector-similarity-search.spanner.sql | 2 +- ...raph.perform-vector-similarity-search.test | 2 +- .../guides/graph.queries-overview.test | 2 +- .../guides/graph.reverse-etl.metadata.json | 1 - .../guides/graph.reverse-etl.spanner.sql | 14 +- .../spanner/guides/graph.reverse-etl.test | 38 +- .../guides/graph.run-algorithms.metadata.json | 1 - .../spanner/guides/graph.run-algorithms.test | 2 +- .../graph.schema-overview.metadata.json | 1 - .../spanner/guides/graph.schema-overview.test | 2 +- .../testdata/spanner/guides/graph.set-up.test | 2 +- .../guides/graph.troubleshoot.metadata.json | 1 - .../spanner/guides/graph.troubleshoot.test | 2 +- .../spanner/guides/graph.work-with-paths.test | 2 +- .../graph.work-with-visualizations.test | 2 +- .../hybrid-full-text-vector-search.test | 2 +- .../guides/implement-multi-tenancy.test | 2 +- .../guides/index-geo-partitioning.spanner.sql | 2 +- .../guides/index-geo-partitioning.test | 2 +- ...introspection.active-partitioned-dmls.test | 2 +- ...spection.column-operations-statistics.test | 2 +- .../introspection.hot-split-statistics.test | 2 +- ...ospection.investigate-cpu-utilization.test | 2 +- .../guides/introspection.lock-statistics.test | 2 +- .../introspection.oldest-active-queries.test | 2 +- .../introspection.query-statistics.test | 2 +- .../guides/introspection.read-statistics.test | 2 +- ...ospection.table-operations-statistics.test | 2 +- .../introspection.transaction-statistics.test | 2 +- ...trospection.troubleshooting-with-tags.test | 2 +- ...introspection.vector-index-statistics.test | 2 +- .../spanner/guides/isolation-levels.test | 2 +- .../guides/migrating-primary-keys.spanner.sql | 2 +- .../guides/migrating-primary-keys.test | 2 +- .../testdata/spanner/guides/ml-emulator.test | 2 +- .../guides/ml-tutorial-embeddings.test | 2 +- .../guides/ml-tutorial-generative-ai.test | 2 +- .../testdata/spanner/guides/ml-tutorial.test | 2 +- .../spanner/guides/named-schemas.spanner.sql | 8 +- .../spanner/guides/named-schemas.test | 2 +- .../guides/pre-splitting-overview.test | 2 +- .../primary-key-default-value.spanner.sql | 2 +- .../guides/primary-key-default-value.test | 2 +- .../spanner/guides/query-columnar-data.test | 2 +- .../spanner/guides/query-execution-plans.test | 2 +- ...uery-optimizer.manage-query-optimizer.test | 2 +- .../guides/query-optimizer.versions.test | 2 +- .../guides/queues.queues-examples.spanner.sql | 2 +- .../guides/queues.queues-examples.test | 2 +- .../guides/queues.queues-using.spanner.sql | 2 +- .../spanner/guides/queues.queues-using.test | 2 +- .../guides/schema-and-data-model.spanner.sql | 2 +- .../spanner/guides/schema-and-data-model.test | 2 +- .../spanner/guides/schema-design.spanner.sql | 2 +- .../spanner/guides/schema-design.test | 2 +- .../guides/schema-updates-best-practices.test | 2 +- .../spanner/guides/schema-updates.spanner.sql | 2 +- .../spanner/guides/schema-updates.test | 2 +- .../guides/secondary-indexes.spanner.sql | 2 +- .../spanner/guides/secondary-indexes.test | 2 +- .../spanner/guides/sequence-tasks.test | 2 +- .../spanner/guides/set-default-time-zone.test | 2 +- .../spanner/guides/sql-best-practices.test | 2 +- .../spanner/guides/storing-numeric-data.test | 2 +- .../guides/table-name-synonym.spanner.sql | 2 +- .../spanner/guides/table-name-synonym.test | 2 +- ...oubleshooting-performance-regressions.test | 2 +- .../guides/ttl.monitoring-and-metrics.test | 2 +- .../guides/ttl.working-with-ttl.spanner.sql | 14 +- .../spanner/guides/ttl.working-with-ttl.test | 30 +- .../spanner/guides/use-pitr.spanner.sql | 2 +- parser/testdata/spanner/guides/use-pitr.test | 2 +- ...use-select-for-update-repeatable-read.test | 2 +- .../use-select-for-update-serializable.test | 2 +- .../vector-index-best-practices.metadata.json | 1 - .../guides/vector-index-best-practices.test | 2 +- .../spanner/guides/vector-indexes.spanner.sql | 2 +- .../spanner/guides/vector-indexes.test | 2 +- .../guides/vector-search-best-practices.test | 2 +- .../guides/vector-search-tutorial.spanner.sql | 2 +- .../guides/vector-search-tutorial.test | 2 +- .../guides/working-with-json.metadata.json | 1 - .../spanner/guides/working-with-json.test | 2 +- .../spanner/guides/write-sql-gemini.test | 2 +- parser/testdata/spanner/hash_functions.test | 2 +- .../testdata/spanner/interval_functions.test | 2 +- parser/testdata/spanner/json_functions.test | 2 +- parser/testdata/spanner/lexical.test | 2 +- .../spanner/mathematical_functions.test | 2 +- parser/testdata/spanner/ml-functions.test | 2 +- parser/testdata/spanner/net_functions.test | 2 +- parser/testdata/spanner/operators.test | 2 +- parser/testdata/spanner/pipe-syntax.test | 2 +- .../testdata/spanner/procedural-language.test | 2 +- .../spanner/protocol-buffers.spanner.sql | 2 +- parser/testdata/spanner/protocol-buffers.test | 2 +- parser/testdata/spanner/query-syntax.test | 2 +- .../spanner/search_functions.metadata.json | 1 - parser/testdata/spanner/search_functions.test | 2 +- .../testdata/spanner/security_functions.test | 2 +- .../testdata/spanner/sequence_functions.test | 2 +- .../statistical_aggregate_functions.test | 2 +- .../testdata/spanner/stored-procedures.test | 2 +- parser/testdata/spanner/string_functions.test | 2 +- parser/testdata/spanner/subqueries.test | 2 +- .../spanner/timestamp_functions.spanner.sql | 2 +- .../testdata/spanner/timestamp_functions.test | 2 +- .../testdata/spanner/utility-functions.test | 2 +- 243 files changed, 3062 insertions(+), 348 deletions(-) create mode 100644 ast/spanner.go create mode 100644 internal/dump/spanner.go create mode 100644 parser/spanner.go create mode 100644 parser/spanner_test.go create mode 100644 parser/testdata/extensions/spanner/change_streams.test create mode 100644 parser/testdata/extensions/spanner/columns.test create mode 100644 parser/testdata/extensions/spanner/entities.test create mode 100644 parser/testdata/extensions/spanner/grant.test create mode 100644 parser/testdata/extensions/spanner/identity.test create mode 100644 parser/testdata/extensions/spanner/indexes.test create mode 100644 parser/testdata/extensions/spanner/locality_groups.test create mode 100644 parser/testdata/extensions/spanner/proto_bundles.test create mode 100644 parser/testdata/extensions/spanner/table_options.test delete mode 100644 parser/testdata/spanner/data-definition-language.metadata.json delete mode 100644 parser/testdata/spanner/graph-schema-statements.metadata.json delete mode 100644 parser/testdata/spanner/guides/full-text-search.combine-tokenlists.metadata.json delete mode 100644 parser/testdata/spanner/guides/full-text-search.facets.metadata.json delete mode 100644 parser/testdata/spanner/guides/full-text-search.fuzzy-search.metadata.json delete mode 100644 parser/testdata/spanner/guides/full-text-search.mix-full-text-and-non-text-queries.metadata.json delete mode 100644 parser/testdata/spanner/guides/full-text-search.numeric-indexes.metadata.json delete mode 100644 parser/testdata/spanner/guides/full-text-search.partition-search-index.metadata.json delete mode 100644 parser/testdata/spanner/guides/full-text-search.pattern-matching-function-acceleration.metadata.json delete mode 100644 parser/testdata/spanner/guides/full-text-search.query-overview.metadata.json delete mode 100644 parser/testdata/spanner/guides/full-text-search.search-indexes.metadata.json delete mode 100644 parser/testdata/spanner/guides/full-text-search.search-multiple-columns.metadata.json delete mode 100644 parser/testdata/spanner/guides/full-text-search.substring-search.metadata.json delete mode 100644 parser/testdata/spanner/guides/full-text-search.tokenization.metadata.json delete mode 100644 parser/testdata/spanner/guides/full-text-search.top-k-pattern-matching.metadata.json delete mode 100644 parser/testdata/spanner/guides/full-text-search.top-k-pattern-matching.spanner.sql delete mode 100644 parser/testdata/spanner/guides/graph.algorithm-best-practices.metadata.json delete mode 100644 parser/testdata/spanner/guides/graph.create-update-drop-schema.metadata.json delete mode 100644 parser/testdata/spanner/guides/graph.full-text-search-and-graph.metadata.json delete mode 100644 parser/testdata/spanner/guides/graph.graph-with-views-how-to.metadata.json delete mode 100644 parser/testdata/spanner/guides/graph.graph-with-views-overview.metadata.json delete mode 100644 parser/testdata/spanner/guides/graph.manage-schemaless-data.metadata.json delete mode 100644 parser/testdata/spanner/guides/graph.perform-vector-similarity-search.metadata.json delete mode 100644 parser/testdata/spanner/guides/graph.reverse-etl.metadata.json delete mode 100644 parser/testdata/spanner/guides/graph.run-algorithms.metadata.json delete mode 100644 parser/testdata/spanner/guides/graph.schema-overview.metadata.json delete mode 100644 parser/testdata/spanner/guides/graph.troubleshoot.metadata.json delete mode 100644 parser/testdata/spanner/guides/vector-index-best-practices.metadata.json delete mode 100644 parser/testdata/spanner/guides/working-with-json.metadata.json delete mode 100644 parser/testdata/spanner/search_functions.metadata.json diff --git a/CLAUDE.md b/CLAUDE.md index 4e6182e..0c39db4 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -74,8 +74,9 @@ The parser tests run them alongside the vendored files, as subtests named or expression mode), with its output as the golden tree. - `.spanner.sql` — Spanner-only syntax the reference parser rejects (e.g. `GRANT ... TO ROLE`, change streams, `CREATE PROTO BUNDLE`, - `vector_length`). No golden output: this is the backlog of syntax that - needs a design decision before zetajones can parse it. + `vector_length`), which zetajones parses under `SPANNER_DDL` (see Spanner + Extensions below). No golden output; `TestSpannerOnlySyntax` checks that + every statement parses with `SPANNER_DDL` and is rejected without it. - `.rejected.sql` — rejected examples not yet triaged. Classify each by id in `cmd/spanner-corpus/triage.txt` as `spanner`, `typo` (broken in the docs) or `fragment`, then regenerate; this file should not exist after. @@ -97,6 +98,26 @@ go test ./parser -check-parse examples that `pages.go` does not include yet. Do not hand-edit generated files; change `cmd/spanner-corpus` instead. +## Spanner Extensions + +`SPANNER_DDL` is a zetajones-only feature (not a GoogleSQL LanguageFeature, +not in `MAXIMUM`) gating the Spanner syntax in `*.spanner.sql`. It also makes +ROLE and PLACEMENT generic entity types and SYNONYM a generic sub-entity type. +Parsing lives in `parser/spanner.go` (plus small hooks in `parser.go`), the +new nodes in `ast/spanner.go`, and their debug strings in +`internal/dump/spanner.go`. Reuse a reference node whenever the Spanner syntax +has a GoogleSQL equivalent, and check its shape against the reference output +for that equivalent spelling (e.g. `, OPTIONS (...)` after `PRIMARY KEY` vs +the reference's `OPTIONS (...)` without the comma). + +Expected trees for this syntax are hand-written in +`parser/testdata/extensions/spanner/*.test` (same format; run by `TestParser` +as `extensions/...`). There is no reference output, so draft a tree with +`go run ./cmd/debug-parse -features MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SPANNER_DDL ""`, +review it node by node, and include a case showing the error without +`SPANNER_DDL`. When a Spanner example becomes reference syntax (a new feature +flag or release), move it to the generated corpus instead. + ## Alternation Groups Cases whose SQL or option lines contain `{{a|b|c}}` groups expand into the @@ -113,7 +134,9 @@ ones that now pass and recording ones that still fail). ## Important Rules - **NEVER modify `.test` files** — they are vendored golden files from the - reference implementation. If output doesn't match, fix the Go code. + reference implementation. If output doesn't match, fix the Go code. (The + hand-written `parser/testdata/extensions/` files are the exception; see + Spanner Extensions.) - **NEVER hand-edit expected output into metadata** — metadata only marks what is not implemented yet. - The dump format must match ZetaSQL's `ASTNode::DebugString` diff --git a/README.md b/README.md index bdf01e8..b7481ca 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,26 @@ func main() { Every AST node records the byte offsets of the source text it was parsed from, matching the reference implementation's parse locations exactly. +## Spanner DDL + +Cloud Spanner accepts DDL that the GoogleSQL reference parser does not: +fine-grained access control (`GRANT ... TO ROLE`), change streams, proto +bundles, queues, locality groups, row deletion policies after `PRIMARY KEY`, +identity columns, table synonyms, search and vector index clauses, and more. +zetajones parses it under the `SPANNER_DDL` feature, which is on by default in +`ParseStatement` and friends (they enable every feature) and can be enabled +explicitly: + +```go +opts := parser.Options{ + Features: parser.ParseFeatureSet("MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SPANNER_DDL"), +} +stmt, err := parser.ParseStatementWithOptions(`GRANT SELECT ON TABLE t TO ROLE r`, opts) +``` + +Where Spanner syntax has a GoogleSQL equivalent, the reference nodes are +reused; the remaining nodes are defined in `ast/spanner.go`. + ## How it is tested The test corpus in `parser/testdata/` is vendored directly from diff --git a/ast/ast.go b/ast/ast.go index f5e7bcb..e03148c 100644 --- a/ast/ast.go +++ b/ast/ast.go @@ -113,11 +113,25 @@ type RenameStatement struct { Identifier *Identifier `json:"identifier"` OldName *PathExpression `json:"old_name"` NewName *PathExpression `json:"new_name"` + // MoreRenames holds the further "old TO new" pairs of a Spanner "RENAME + // TABLE a TO b, c TO d" statement (SPANNER_DDL); their paths follow + // NewName in the debug output. + MoreRenames []RenamePair `json:"more_renames,omitempty"` +} + +// RenamePair is one additional "old TO new" pair of a RenameStatement. +type RenamePair struct { + OldName *PathExpression `json:"old_name"` + NewName *PathExpression `json:"new_name"` } func (n *RenameStatement) statementNode() {} func (n *RenameStatement) Children() []Node { - return children(n.Identifier, n.OldName, n.NewName) + out := children(n.Identifier, n.OldName, n.NewName) + for _, r := range n.MoreRenames { + out = append(out, r.OldName, r.NewName) + } + return out } // SingleAssignment is "SET identifier = expression"; see ASTSingleAssignment @@ -3468,14 +3482,19 @@ func (n *GeneratedColumnInfo) Children() []Node { // not represented as a child. type IdentityColumnInfo struct { Span - StartWith *IdentityColumnStartWith `json:"start_with,omitempty"` - IncrementBy *IdentityColumnIncrementBy `json:"increment_by,omitempty"` - MaxValue *IdentityColumnMaxValue `json:"max_value,omitempty"` - MinValue *IdentityColumnMinValue `json:"min_value,omitempty"` + // SequenceKind is the Spanner sequence kind (e.g. BIT_REVERSED_POSITIVE) + // inside the parentheses (SPANNER_DDL). + SequenceKind *Identifier `json:"sequence_kind,omitempty"` + StartWith *IdentityColumnStartWith `json:"start_with,omitempty"` + IncrementBy *IdentityColumnIncrementBy `json:"increment_by,omitempty"` + MaxValue *IdentityColumnMaxValue `json:"max_value,omitempty"` + MinValue *IdentityColumnMinValue `json:"min_value,omitempty"` + // SkipRange is the Spanner "SKIP RANGE min, max" option (SPANNER_DDL). + SkipRange *IdentityColumnSkipRange `json:"skip_range,omitempty"` } func (n *IdentityColumnInfo) Children() []Node { - return children(n.StartWith, n.IncrementBy, n.MaxValue, n.MinValue) + return children(n.SequenceKind, n.StartWith, n.IncrementBy, n.MaxValue, n.MinValue, n.SkipRange) } // IdentityColumnStartWith is the "START WITH value" clause of an identity @@ -3547,6 +3566,29 @@ type DropTtlAction struct { func (n *DropTtlAction) Children() []Node { return nil } +// TtlClause is a CREATE TABLE "ROW DELETION POLICY (expression)" clause; see +// ASTTtlClause in googlesql/parser/parse_tree.h. Under SPANNER_DDL it may also +// follow the Spanner table options after a comma. +type TtlClause struct { + Span + Expression Node `json:"expression"` +} + +func (n *TtlClause) Children() []Node { return children(n.Expression) } + +// CreateLocalityGroupStatement is "CREATE LOCALITY GROUP path [OPTIONS(...)]"; +// see ASTCreateLocalityGroupStatement in googlesql/parser/parse_tree.h. +type CreateLocalityGroupStatement struct { + Span + Name *PathExpression `json:"name"` + Options *OptionsList `json:"options,omitempty"` +} + +func (n *CreateLocalityGroupStatement) statementNode() {} +func (n *CreateLocalityGroupStatement) Children() []Node { + return children(n.Name, n.Options) +} + // OptionsList is a parenthesized list of name = value options. type OptionsList struct { Span @@ -3755,6 +3797,7 @@ type CreateTableStatement struct { Clone *CloneDataSource `json:"clone,omitempty"` PartitionBy *PartitionBy `json:"partition_by,omitempty"` ClusterBy *ClusterBy `json:"cluster_by,omitempty"` + Ttl *TtlClause `json:"ttl,omitempty"` WithConnection *WithConnectionClause `json:"with_connection,omitempty"` Options *OptionsList `json:"options,omitempty"` Query *Query `json:"query,omitempty"` @@ -3763,7 +3806,7 @@ type CreateTableStatement struct { func (n *CreateTableStatement) statementNode() {} func (n *CreateTableStatement) Children() []Node { return children(n.Name, n.TableElementList, n.LikeName, n.SpannerOptions, n.Clone, - n.PartitionBy, n.ClusterBy, n.WithConnection, n.Options, n.Query) + n.PartitionBy, n.ClusterBy, n.Ttl, n.WithConnection, n.Options, n.Query) } // SpannerTableOptions holds the Cloud Spanner "PRIMARY KEY (...) [, INTERLEAVE @@ -3877,16 +3920,18 @@ func (n *ColumnDefinition) Children() []Node { // optional ColumnAttributeList holds trailing attributes such as NOT NULL. type SimpleColumnSchema struct { Span - Type *PathExpression `json:"type"` - TypeParameters *TypeParameterList `json:"type_parameters,omitempty"` - Collate *Collate `json:"collate,omitempty"` - DefaultExpression Node `json:"default_expression,omitempty"` - Attributes *ColumnAttributeList `json:"attributes,omitempty"` - Options *OptionsList `json:"options,omitempty"` + Type *PathExpression `json:"type"` + TypeParameters *TypeParameterList `json:"type_parameters,omitempty"` + Collate *Collate `json:"collate,omitempty"` + DefaultExpression Node `json:"default_expression,omitempty"` + // OnUpdate is the Spanner "ON UPDATE (expression)" clause (SPANNER_DDL). + OnUpdate *ColumnOnUpdateClause `json:"on_update,omitempty"` + Attributes *ColumnAttributeList `json:"attributes,omitempty"` + Options *OptionsList `json:"options,omitempty"` } func (n *SimpleColumnSchema) Children() []Node { - return children(n.Type, n.TypeParameters, n.Collate, n.DefaultExpression, n.Attributes, n.Options) + return children(n.Type, n.TypeParameters, n.Collate, n.DefaultExpression, n.OnUpdate, n.Attributes, n.Options) } // ArrayColumnSchema is an "ARRAY" column schema; see @@ -4342,11 +4387,15 @@ type CreateIndexStatement struct { Options *OptionsList `json:"options,omitempty"` IsNullFiltered bool `json:"is_null_filtered,omitempty"` SpannerInterleave *SpannerInterleaveClause `json:"spanner_interleave,omitempty"` + // OrderBy and Where are the Spanner search/vector index "ORDER BY ..." and + // "WHERE ..." clauses (SPANNER_DDL). + OrderBy *OrderBy `json:"order_by,omitempty"` + Where *WhereClause `json:"where,omitempty"` } func (n *CreateIndexStatement) statementNode() {} func (n *CreateIndexStatement) Children() []Node { - return children(n.Name, n.TableName, n.Alias, n.UnnestExpressionList, n.IndexItemList, n.Storing, n.PartitionBy, n.Options, n.SpannerInterleave) + return children(n.Name, n.TableName, n.Alias, n.UnnestExpressionList, n.IndexItemList, n.Storing, n.PartitionBy, n.OrderBy, n.Where, n.Options, n.SpannerInterleave) } // IndexItemList is the parenthesized list of ordering expressions in a @@ -6194,7 +6243,10 @@ func (n *GraphDynamicProperties) Children() []Node { return children(n.Expressio // the debug string). type AlterIndexStatement struct { Span - Vector bool `json:"vector,omitempty"` + Vector bool `json:"vector,omitempty"` + // Plain marks a Spanner "ALTER INDEX" (SPANNER_DDL) as opposed to ALTER + // SEARCH INDEX; neither is shown in the debug string. + Plain bool `json:"plain,omitempty"` IsIfExists bool `json:"is_if_exists,omitempty"` Name *PathExpression `json:"name"` Table *PathExpression `json:"table,omitempty"` diff --git a/ast/spanner.go b/ast/spanner.go new file mode 100644 index 0000000..1684824 --- /dev/null +++ b/ast/spanner.go @@ -0,0 +1,266 @@ +package ast + +// This file holds nodes for Cloud Spanner DDL that GoogleSQL's reference +// parser does not accept (zetajones's SPANNER_DDL feature). They have no +// counterpart in googlesql/parser/parse_tree.h; their debug strings follow the +// same conventions as the reference nodes (see internal/dump/spanner.go). + +// PlacementKeyColumnAttribute is the Spanner "PLACEMENT KEY" column attribute. +type PlacementKeyColumnAttribute struct { + Span +} + +func (n *PlacementKeyColumnAttribute) Children() []Node { return nil } + +// AutoIncrementColumnAttribute is the Spanner "AUTO_INCREMENT" column +// attribute, shorthand for GENERATED BY DEFAULT AS IDENTITY. +type AutoIncrementColumnAttribute struct { + Span +} + +func (n *AutoIncrementColumnAttribute) Children() []Node { return nil } + +// ColumnOnUpdateClause is a Spanner column's "ON UPDATE (expression)" clause. +type ColumnOnUpdateClause struct { + Span + Expression Node `json:"expression"` +} + +func (n *ColumnOnUpdateClause) Children() []Node { return children(n.Expression) } + +// IdentityColumnSkipRange is the Spanner identity/sequence option "SKIP RANGE +// min, max". +type IdentityColumnSkipRange struct { + Span + Min Node `json:"min"` + Max Node `json:"max"` +} + +func (n *IdentityColumnSkipRange) Children() []Node { return children(n.Min, n.Max) } + +// IdentityColumnRestartCounterWith is "RESTART COUNTER WITH value" in a +// Spanner ALTER IDENTITY action. +type IdentityColumnRestartCounterWith struct { + Span + Value Node `json:"value"` +} + +func (n *IdentityColumnRestartCounterWith) Children() []Node { return children(n.Value) } + +// AlterColumnIdentityAction is the Spanner alter action "ALTER COLUMN c ALTER +// IDENTITY {SET SKIP RANGE min, max | SET NO SKIP RANGE | RESTART COUNTER WITH +// n}". Exactly one of SkipRange, NoSkipRange and RestartCounterWith is set. +type AlterColumnIdentityAction struct { + Span + Column *Identifier `json:"column"` + SkipRange *IdentityColumnSkipRange `json:"skip_range,omitempty"` + NoSkipRange bool `json:"no_skip_range,omitempty"` + RestartCounterWith *IdentityColumnRestartCounterWith `json:"restart_counter_with,omitempty"` +} + +func (n *AlterColumnIdentityAction) Children() []Node { + return children(n.Column, n.SkipRange, n.RestartCounterWith) +} + +// TableSynonym is the Spanner "SYNONYM (name)" table element of a CREATE +// TABLE statement. +type TableSynonym struct { + Span + Name *Identifier `json:"name"` +} + +func (n *TableSynonym) Children() []Node { return children(n.Name) } + +// AddStoredColumnAction is the Spanner ALTER [VECTOR] INDEX action "ADD STORED +// COLUMN column". +type AddStoredColumnAction struct { + Span + Column *Identifier `json:"column"` +} + +func (n *AddStoredColumnAction) Children() []Node { return children(n.Column) } + +// DropStoredColumnAction is the Spanner ALTER [VECTOR] INDEX action "DROP +// STORED COLUMN column". +type DropStoredColumnAction struct { + Span + Column *Identifier `json:"column"` +} + +func (n *DropStoredColumnAction) Children() []Node { return children(n.Column) } + +// CreateQueueStatement is the Spanner "CREATE QUEUE name (elements) PRIMARY +// KEY (...) [, INTERLEAVE IN PARENT ...] [, OPTIONS (...)]" statement. +type CreateQueueStatement struct { + Span + IsIfNotExists bool `json:"is_if_not_exists,omitempty"` + Name *PathExpression `json:"name"` + TableElementList *TableElementList `json:"table_element_list"` + SpannerOptions *SpannerTableOptions `json:"spanner_options,omitempty"` + Options *OptionsList `json:"options,omitempty"` +} + +func (n *CreateQueueStatement) statementNode() {} +func (n *CreateQueueStatement) Children() []Node { + return children(n.Name, n.TableElementList, n.SpannerOptions, n.Options) +} + +// CreateChangeStreamStatement is the Spanner "CREATE CHANGE STREAM name [FOR +// ...] [OPTIONS (...)]" statement. +type CreateChangeStreamStatement struct { + Span + IsIfNotExists bool `json:"is_if_not_exists,omitempty"` + Name *PathExpression `json:"name"` + For *ChangeStreamForClause `json:"for,omitempty"` + Options *OptionsList `json:"options,omitempty"` +} + +func (n *CreateChangeStreamStatement) statementNode() {} +func (n *CreateChangeStreamStatement) Children() []Node { + return children(n.Name, n.For, n.Options) +} + +// ChangeStreamForClause is a change stream's "FOR ALL" or "FOR table[(cols)], +// ..." clause. All is set for FOR ALL, which has no tables. +type ChangeStreamForClause struct { + Span + All bool `json:"all,omitempty"` + Tables []*ChangeStreamTrackedTable `json:"tables,omitempty"` +} + +func (n *ChangeStreamForClause) Children() []Node { + out := make([]Node, 0, len(n.Tables)) + for _, t := range n.Tables { + out = append(out, t) + } + return out +} + +// ChangeStreamTrackedTable is one "table [(column, ...)]" entry of a change +// stream's FOR clause. Columns is nil when no column list is given and an +// empty list for "()" (key columns only). +type ChangeStreamTrackedTable struct { + Span + Table *PathExpression `json:"table"` + Columns *ColumnList `json:"columns,omitempty"` +} + +func (n *ChangeStreamTrackedTable) Children() []Node { return children(n.Table, n.Columns) } + +// AlterChangeStreamStatement is the Spanner "ALTER CHANGE STREAM name action" +// statement. +type AlterChangeStreamStatement struct { + Span + IsIfExists bool `json:"is_if_exists,omitempty"` + Name *PathExpression `json:"name"` + Actions *AlterActionList `json:"actions"` +} + +func (n *AlterChangeStreamStatement) statementNode() {} +func (n *AlterChangeStreamStatement) Children() []Node { + return children(n.Name, n.Actions) +} + +// SetChangeStreamForAction is the ALTER CHANGE STREAM action "SET FOR ...". +type SetChangeStreamForAction struct { + Span + For *ChangeStreamForClause `json:"for"` +} + +func (n *SetChangeStreamForAction) Children() []Node { return children(n.For) } + +// DropChangeStreamForAllAction is the ALTER CHANGE STREAM action "DROP FOR +// ALL". +type DropChangeStreamForAllAction struct { + Span +} + +func (n *DropChangeStreamForAllAction) Children() []Node { return nil } + +// AlterLocalityGroupStatement is the Spanner "ALTER LOCALITY GROUP name SET +// OPTIONS (...)" statement. +type AlterLocalityGroupStatement struct { + Span + IsIfExists bool `json:"is_if_exists,omitempty"` + Name *PathExpression `json:"name"` + Actions *AlterActionList `json:"actions"` +} + +func (n *AlterLocalityGroupStatement) statementNode() {} +func (n *AlterLocalityGroupStatement) Children() []Node { + return children(n.Name, n.Actions) +} + +// CreateProtoBundleStatement is the Spanner "CREATE PROTO BUNDLE (type, ...)" +// statement. +type CreateProtoBundleStatement struct { + Span + Types *PathExpressionList `json:"types"` +} + +func (n *CreateProtoBundleStatement) statementNode() {} +func (n *CreateProtoBundleStatement) Children() []Node { return children(n.Types) } + +// AlterProtoBundleStatement is the Spanner "ALTER PROTO BUNDLE {INSERT | +// UPDATE | DELETE} (type, ...) ..." statement. +type AlterProtoBundleStatement struct { + Span + Actions *AlterActionList `json:"actions"` +} + +func (n *AlterProtoBundleStatement) statementNode() {} +func (n *AlterProtoBundleStatement) Children() []Node { return children(n.Actions) } + +// ProtoBundleAction is one "INSERT|UPDATE|DELETE (type, ...)" action of an +// ALTER PROTO BUNDLE statement. Op is "INSERT", "UPDATE" or "DELETE". +type ProtoBundleAction struct { + Span + Op string `json:"op"` + Types *PathExpressionList `json:"types"` +} + +func (n *ProtoBundleAction) Children() []Node { return children(n.Types) } + +// DropProtoBundleStatement is the Spanner "DROP PROTO BUNDLE" statement. +type DropProtoBundleStatement struct { + Span +} + +func (n *DropProtoBundleStatement) statementNode() {} +func (n *DropProtoBundleStatement) Children() []Node { return nil } + +// GrantToRoleStatement is a Spanner fine-grained access control "GRANT +// privileges ON [object_type] objects TO ROLE roles" statement, or REVOKE +// ... FROM ROLE when IsRevoke is set. AllInSchema marks "ON ALL {TABLES | +// VIEWS | SEQUENCES ...} IN SCHEMA schema", where ObjectTypes holds the plural +// kind and Objects the schema names. +type GrantToRoleStatement struct { + Span + IsRevoke bool `json:"is_revoke,omitempty"` + Privileges *Privileges `json:"privileges"` + ObjectTypes []*Identifier `json:"object_types,omitempty"` + AllInSchema bool `json:"all_in_schema,omitempty"` + Objects *PathExpressionList `json:"objects"` + Roles *IdentifierList `json:"roles"` +} + +func (n *GrantToRoleStatement) statementNode() {} +func (n *GrantToRoleStatement) Children() []Node { + out := children(n.Privileges) + for _, id := range n.ObjectTypes { + out = append(out, id) + } + return append(out, children(n.Objects, n.Roles)...) +} + +// GrantRoleStatement is the Spanner "GRANT ROLE roles TO ROLE grantees" +// statement, or "REVOKE ROLE roles FROM ROLE grantees" when IsRevoke is set. +type GrantRoleStatement struct { + Span + IsRevoke bool `json:"is_revoke,omitempty"` + Roles *IdentifierList `json:"roles"` + Grantees *IdentifierList `json:"grantees"` +} + +func (n *GrantRoleStatement) statementNode() {} +func (n *GrantRoleStatement) Children() []Node { return children(n.Roles, n.Grantees) } diff --git a/cmd/spanner-corpus/main.go b/cmd/spanner-corpus/main.go index 4d879fc..887dd93 100644 --- a/cmd/spanner-corpus/main.go +++ b/cmd/spanner-corpus/main.go @@ -59,7 +59,7 @@ const docsURL = "https://docs.cloud.google.com/spanner/docs/" // features are the language features Spanner's dialect needs from the // reference parser, including the SQL graph features. -const features = "MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE" +const features = "MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE" // page is a Spanner docs page, by its path under docsURL. type page struct { diff --git a/cmd/spanner-corpus/triage.txt b/cmd/spanner-corpus/triage.txt index a492bb8..2614f9d 100644 --- a/cmd/spanner-corpus/triage.txt +++ b/cmd/spanner-corpus/triage.txt @@ -19,7 +19,6 @@ cbdc2fb90b11 spanner AUTO_INCREMENT columns (primary-key-default-value) 5b54ac5fbc37 spanner CREATE ROLE (fgac-queues) fa3fd655dd8d spanner CREATE ROLE (fgac-queues) bfb46504a7f2 spanner CREATE ROLE (graph.graph-with-views-how-to) -5f1bb1f70bc6 spanner CREATE ROLE (named-schemas) d4c050bd9942 spanner DEFAULT after NOT NULL (timestamp_functions) 43c581426688 spanner GRANT/REVOKE for fine-grained access control (configure-fgac) 6d9c8bec9783 spanner GRANT/REVOKE for fine-grained access control (configure-fgac) @@ -110,11 +109,7 @@ a2561c1baafc spanner identity columns (migrating-primary-keys) 57c70c72e944 spanner identity columns (primary-key-default-value) e19b178d0d2e spanner identity columns (primary-key-default-value) f19adcb13ef5 spanner identity columns (primary-key-default-value) -01a0dff9e706 spanner locality groups (create-manage-locality-groups) -285931116d26 spanner locality groups (create-manage-locality-groups) -2a925ceede24 spanner locality groups (create-manage-locality-groups) 32396e1bf247 spanner locality groups (create-manage-locality-groups) -999a3d5dfef6 spanner locality groups (create-manage-locality-groups) b2707791e64d spanner locality groups (create-manage-locality-groups) bd3d36a38974 spanner locality groups (create-manage-locality-groups) c8f11334b5a8 spanner locality groups (create-manage-locality-groups) @@ -131,19 +126,14 @@ fe13330c8cf7 spanner proto bundles (secondary-indexes) aef3cbd9ca49 spanner queues (queues.queues-using) 9c7464fea28c spanner row deletion policy (TTL) (graph.best-practices-designing-schema) af7e3c0e2324 spanner row deletion policy (TTL) (graph.best-practices-designing-schema) -27727b8671c2 spanner row deletion policy (TTL) (graph.reverse-etl) -c2e5bc718928 spanner row deletion policy (TTL) (graph.reverse-etl) 14c9930fca7c spanner row deletion policy (TTL) (ttl.working-with-ttl) -1de829b56fcf spanner row deletion policy (TTL) (ttl.working-with-ttl) 278715e1de63 spanner row deletion policy (TTL) (ttl.working-with-ttl) 9fabc8cd139c spanner row deletion policy (TTL) (ttl.working-with-ttl) -ebe181a95224 spanner row deletion policy (TTL) (ttl.working-with-ttl) 4a2243fb3317 spanner search index clauses (ORDER BY, WHERE, INTERLEAVE IN) (full-text-search.facets) 497af036fbe9 spanner search index clauses (ORDER BY, WHERE, INTERLEAVE IN) (full-text-search.search-indexes) 866fcf6e1c19 spanner search index clauses (ORDER BY, WHERE, INTERLEAVE IN) (full-text-search.search-indexes) 9897bb972a57 spanner search index clauses (ORDER BY, WHERE, INTERLEAVE IN) (full-text-search.search-indexes) eef67d96745a spanner search index clauses (ORDER BY, WHERE, INTERLEAVE IN) (full-text-search.search-indexes) -f7df4248d043 spanner search index clauses (ORDER BY, WHERE, INTERLEAVE IN) (full-text-search.top-k-pattern-matching) 51eb77fd9a06 spanner table OPTIONS after PRIMARY KEY (configure-columnar-engine) 440625a3c44c spanner table OPTIONS after PRIMARY KEY (create-manage-locality-groups) d135863ff683 spanner table OPTIONS after PRIMARY KEY (create-manage-locality-groups) @@ -166,6 +156,8 @@ c2a8b55f1e16 spanner vector index clauses (vector-indexes) d2267b14470f spanner vector index clauses (vector-search-tutorial) # Examples broken in the docs. +5f1bb1f70bc6 typo two CREATE ROLE statements without a separating semicolon (named-schemas) +f7df4248d043 typo two CREATE SEARCH INDEX statements without a separating semicolon (full-text-search.top-k-pattern-matching) 05bdd1196cbe typo "," before PRIMARY KEY (table-name-synonym) 77a2c9b8cd37 typo "," before PRIMARY KEY (table-name-synonym) 794497e99af5 typo "," before PRIMARY KEY (table-name-synonym) diff --git a/internal/dump/dump.go b/internal/dump/dump.go index 2cef58a..fd349d2 100644 --- a/internal/dump/dump.go +++ b/internal/dump/dump.go @@ -1511,7 +1511,14 @@ func nodeString(n ast.Node) string { return "GraphPropertyNameAndValue" case *ast.GraphPathMode: return "GraphPathMode" + case *ast.TtlClause: + return "TtlClause" + case *ast.CreateLocalityGroupStatement: + return "CreateLocalityGroupStatement" default: + if name, ok := spannerNodeString(n); ok { + return name + } return fmt.Sprintf("UNKNOWN_NODE(%T)", n) } } diff --git a/internal/dump/spanner.go b/internal/dump/spanner.go new file mode 100644 index 0000000..7945239 --- /dev/null +++ b/internal/dump/spanner.go @@ -0,0 +1,87 @@ +package dump + +import "github.com/sqlc-dev/zetajones/ast" + +// spannerNodeString returns the debug string for the zetajones-only Spanner +// DDL nodes in ast/spanner.go, which have no SingleNodeDebugString in the +// reference. Like the reference nodes, they print the node kind name followed +// by any modifiers in parentheses. +func spannerNodeString(n ast.Node) (string, bool) { + switch t := n.(type) { + case *ast.PlacementKeyColumnAttribute: + return "PlacementKeyColumnAttribute", true + case *ast.AutoIncrementColumnAttribute: + return "AutoIncrementColumnAttribute", true + case *ast.ColumnOnUpdateClause: + return "ColumnOnUpdateClause", true + case *ast.IdentityColumnSkipRange: + return "IdentityColumnSkipRange", true + case *ast.IdentityColumnRestartCounterWith: + return "IdentityColumnRestartCounterWith", true + case *ast.AlterColumnIdentityAction: + if t.NoSkipRange { + return "AlterColumnIdentityAction(no_skip_range)", true + } + return "AlterColumnIdentityAction", true + case *ast.TableSynonym: + return "TableSynonym", true + case *ast.AddStoredColumnAction: + return "AddStoredColumnAction", true + case *ast.DropStoredColumnAction: + return "DropStoredColumnAction", true + case *ast.CreateQueueStatement: + if t.IsIfNotExists { + return "CreateQueueStatement(is_if_not_exists)", true + } + return "CreateQueueStatement", true + case *ast.CreateChangeStreamStatement: + if t.IsIfNotExists { + return "CreateChangeStreamStatement(is_if_not_exists)", true + } + return "CreateChangeStreamStatement", true + case *ast.ChangeStreamForClause: + if t.All { + return "ChangeStreamForClause(all)", true + } + return "ChangeStreamForClause", true + case *ast.ChangeStreamTrackedTable: + return "ChangeStreamTrackedTable", true + case *ast.AlterChangeStreamStatement: + if t.IsIfExists { + return "AlterChangeStreamStatement(is_if_exists)", true + } + return "AlterChangeStreamStatement", true + case *ast.SetChangeStreamForAction: + return "SetChangeStreamForAction", true + case *ast.DropChangeStreamForAllAction: + return "DropChangeStreamForAllAction", true + case *ast.AlterLocalityGroupStatement: + if t.IsIfExists { + return "AlterLocalityGroupStatement(is_if_exists)", true + } + return "AlterLocalityGroupStatement", true + case *ast.CreateProtoBundleStatement: + return "CreateProtoBundleStatement", true + case *ast.AlterProtoBundleStatement: + return "AlterProtoBundleStatement", true + case *ast.ProtoBundleAction: + return "ProtoBundleAction(" + t.Op + ")", true + case *ast.DropProtoBundleStatement: + return "DropProtoBundleStatement", true + case *ast.GrantToRoleStatement: + name := "GrantToRoleStatement" + if t.IsRevoke { + name = "RevokeFromRoleStatement" + } + if t.AllInSchema { + name += "(all_in_schema)" + } + return name, true + case *ast.GrantRoleStatement: + if t.IsRevoke { + return "RevokeRoleStatement", true + } + return "GrantRoleStatement", true + } + return "", false +} diff --git a/parser/fuzz_test.go b/parser/fuzz_test.go index 9510611..4e8359b 100644 --- a/parser/fuzz_test.go +++ b/parser/fuzz_test.go @@ -11,11 +11,15 @@ import ( // FuzzParse feeds arbitrary input through every parse mode. The parser must // never panic: invalid input is expected to produce an error, valid input a // tree. Both feature extremes are exercised (NONE and MAXIMUM with -// reserve_graph_table) since feature gating selects different code paths. +// reserve_graph_table), plus the Spanner DDL extensions, since feature gating +// selects different code paths. func FuzzParse(f *testing.F) { // Seed with the golden corpus so the fuzzer starts from inputs that reach // deep into the grammar. files, _ := filepath.Glob(filepath.Join("testdata", "*.test")) + extensions, _ := testfile.FindFiles(filepath.Join("testdata", "extensions")) + // Extension cases first, so the seed cap does not drop them. + files = append(extensions, files...) seeded := 0 for _, path := range files { cases, err := testfile.ParseFile(path) @@ -44,9 +48,10 @@ func FuzzParse(f *testing.F) { } var noneOpts parser.Options noneOpts.Features = parser.ParseFeatureSet("NONE") + spannerOpts := parser.Options{Features: parser.ParseFeatureSet("MAXIMUM,+SPANNER_LEGACY_DDL,+CREATE_LOCALITY_GROUP,+SPANNER_DDL")} f.Fuzz(func(t *testing.T, sql string) { - for _, opts := range []parser.Options{noneOpts, maxOpts} { + for _, opts := range []parser.Options{noneOpts, maxOpts, spannerOpts} { _, _ = parser.ParseStatementWithOptions(sql, opts) _, _ = parser.ParseScriptWithOptions(sql, opts) _, _ = parser.ParseExpressionWithOptions(sql, opts) diff --git a/parser/parser.go b/parser/parser.go index 2e7ede8..c612a69 100644 --- a/parser/parser.go +++ b/parser/parser.go @@ -303,6 +303,23 @@ const FeatureSpannerLegacyDDL Feature = "SPANNER_LEGACY_DDL" // enable it explicitly via language_features). const FeatureSQLGraph Feature = "SQL_GRAPH" +// FeatureCreateLocalityGroup gates "CREATE LOCALITY GROUP path +// [OPTIONS(...)]" (FEATURE_CREATE_LOCALITY_GROUP); see +// create_locality_group_statement in googlesql.tm. It is not enabled by +// MAXIMUM. +const FeatureCreateLocalityGroup Feature = "CREATE_LOCALITY_GROUP" + +// FeatureSpannerDDL gates Cloud Spanner DDL that GoogleSQL's reference parser +// does not accept: fine-grained access control GRANT/REVOKE ... TO/FROM ROLE, +// change streams, proto bundles, queues, ALTER/DROP LOCALITY GROUP, Spanner +// column and identity syntax, table synonyms, search and vector index clauses +// and the comma-separated Spanner table options. It also accepts ROLE and +// PLACEMENT as generic entity types and SYNONYM as a generic sub-entity type. +// It is a zetajones extension, not a GoogleSQL LanguageFeature, is meant to be +// used with SPANNER_LEGACY_DDL, and is not enabled by MAXIMUM. The node shapes +// are described in ast/spanner.go. +const FeatureSpannerDDL Feature = "SPANNER_DDL" + // featureInMaximum records whether each gated feature is enabled by // language_features=MAXIMUM, i.e. whether it is ideally enabled and not in // development; see LanguageOptions::EnableMaximumLanguageFeatures and the @@ -324,6 +341,8 @@ var featureInMaximum = map[Feature]bool{ FeatureRepeat: true, FeatureForIn: true, FeatureEnableAlterArrayOptions: true, + FeatureCreateLocalityGroup: false, // in_development + FeatureSpannerDDL: false, // zetajones extension } // FeatureSet is a set of enabled language features. The zero value has no @@ -423,7 +442,18 @@ func newParser(sql string, opts Options, eofImage string) (*parser, error) { toks[n-1].Image = eofImage } } - return &parser{sql: sql, toks: toks, features: opts.Features, entityTypes: stringSet(opts.SupportedGenericEntityTypes), subEntityTypes: stringSet(opts.SupportedGenericSubEntityTypes), macroMode: opts.MacroExpansionMode, reserveGraphTable: opts.ReserveGraphTable}, nil + p := &parser{sql: sql, toks: toks, features: opts.Features, entityTypes: stringSet(opts.SupportedGenericEntityTypes), subEntityTypes: stringSet(opts.SupportedGenericSubEntityTypes), macroMode: opts.MacroExpansionMode, reserveGraphTable: opts.ReserveGraphTable} + if p.spanner() { + // Spanner roles and placements are plain named objects, and table + // synonyms plain named sub-objects; see FeatureSpannerDDL. + for _, t := range spannerEntityTypes { + p.entityTypes[t] = true + } + for _, t := range spannerSubEntityTypes { + p.subEntityTypes[t] = true + } + } + return p, nil } // trailing semicolon. All language features are enabled. @@ -1533,12 +1563,25 @@ func (p *parser) parseRenameStatement() (ast.Statement, error) { if err != nil { return nil, err } - return &ast.RenameStatement{ - Span: span(renameTok.Pos, p.prevEnd()), - Identifier: ident, - OldName: oldName, - NewName: newName, - }, nil + stmt := &ast.RenameStatement{Identifier: ident, OldName: oldName, NewName: newName} + // Spanner "RENAME TABLE a TO b, c TO d, ...". + for p.spanner() && strings.EqualFold(ident.Name, "TABLE") && p.peek().Kind == token.COMMA { + p.advance() // , + from, err := p.parsePathExpression() + if err != nil { + return nil, err + } + if _, err := p.expectKeyword("TO"); err != nil { + return nil, err + } + to, err := p.parsePathExpression() + if err != nil { + return nil, err + } + stmt.MoreRenames = append(stmt.MoreRenames, ast.RenamePair{OldName: from, NewName: to}) + } + stmt.Span = span(renameTok.Pos, p.prevEnd()) + return stmt, nil } // parseModuleStatement parses "MODULE path_expression [OPTIONS(...)]"; see @@ -2888,6 +2931,17 @@ func (p *parser) parseCreateStatement() (ast.Statement, error) { if p.peek().Kind == token.QUOTED_IDENT { return nil, p.errorf(p.peek().Pos, "%s is not a supported object type", p.peek().Image) } + // CREATE LOCALITY GROUP path [OPTIONS(...)]; see + // create_locality_group_statement in googlesql.tm. + if !isOrReplace && scope == "" && isKeyword(p.peek(), "LOCALITY") && isKeyword(p.peekAt(1), "GROUP") { + return p.parseCreateLocalityGroupStatement(createTok) + } + // Spanner-only CREATE CHANGE STREAM / PROTO BUNDLE / QUEUE. + if p.spanner() && !isOrReplace && scope == "" { + if stmt, ok, err := p.parseSpannerCreateStatement(createTok); ok { + return stmt, err + } + } // CREATE [OR REPLACE] generic_entity_type [IF NOT EXISTS] path ...; see // create_entity_statement in googlesql.tm. A generic entity type is a bare // identifier or the PROJECT keyword, and takes no scope modifier. When the @@ -2937,6 +2991,16 @@ func (p *parser) parseCreateStatement() (ast.Statement, error) { } stmt.SpannerOptions = opts stmt.Stop = opts.End() + // Spanner also accepts ", INTERLEAVE IN path", ", ROW DELETION POLICY + // (...)" and ", OPTIONS (...)" after the primary key. + if p.spanner() { + ttl, options, err := p.parseSpannerTableTrailers(opts) + if err != nil { + return nil, err + } + stmt.Ttl, stmt.Options = ttl, options + stmt.Stop = p.prevEnd() + } } // opt_like_path_expression: "LIKE table_name". @@ -2981,6 +3045,16 @@ func (p *parser) parseCreateStatement() (ast.Statement, error) { stmt.Stop = cb.End() } + // opt_ttl_clause: "ROW DELETION POLICY (expression)". + if stmt.Ttl == nil && isKeyword(p.peek(), "ROW") && isKeyword(p.peekAt(1), "DELETION") { + ttl, err := p.parseTtlClause() + if err != nil { + return nil, err + } + stmt.Ttl = ttl + stmt.Stop = ttl.End() + } + // opt_with_connection_clause: "WITH CONNECTION connection". if isKeyword(p.peek(), "WITH") { wc, err := p.parseWithConnectionClause() @@ -2992,7 +3066,7 @@ func (p *parser) parseCreateStatement() (ast.Statement, error) { } // opt_options_list: "OPTIONS(...)". - if isKeyword(p.peek(), "OPTIONS") { + if stmt.Options == nil && isKeyword(p.peek(), "OPTIONS") { p.advance() opts, err := p.parseOptionsList() if err != nil { @@ -3425,6 +3499,9 @@ func (p *parser) parseTableElementList() (*ast.TableElementList, error) { // parseTableElement parses a single column definition or table constraint; see // table_element in googlesql.tm. func (p *parser) parseTableElement() (ast.Node, error) { + if p.spanner() && isKeyword(p.peek(), "SYNONYM") && p.peekAt(1).Kind == token.LPAREN { + return p.parseTableSynonym() + } if isKeyword(p.peek(), "PRIMARY") && isKeyword(p.peekAt(1), "KEY") { return p.parsePrimaryKey() } @@ -3547,6 +3624,15 @@ func (p *parser) parseTableColumnSchema() (ast.Node, error) { collate = c end = c.End() } + // Spanner accepts column attributes (in practice NOT NULL) before the + // DEFAULT or generated clause too. They join the attribute list after it, + // as in spanner_alter_column_action. + var preAttrs *ast.ColumnAttributeList + if p.spanner() { + if preAttrs = p.tryParseColumnAttributes(); preAttrs != nil { + end = preAttrs.End() + } + } // opt_column_info: generated_column_info or default_column_info. genOrDefault, giEnd, err := p.parseOptColumnInfo() if err != nil { @@ -3555,14 +3641,29 @@ func (p *parser) parseTableColumnSchema() (ast.Node, error) { if genOrDefault != nil { end = giEnd } + // Spanner "ON UPDATE (expression)". + var onUpdate *ast.ColumnOnUpdateClause + if p.spanner() && isKeyword(p.peek(), "ON") && isKeyword(p.peekAt(1), "UPDATE") { + if onUpdate, err = p.parseColumnOnUpdate(); err != nil { + return nil, err + } + end = onUpdate.End() + } // column_attributes (from table_column_definition): NOT NULL, PRIMARY KEY. attrs := p.tryParseColumnAttributes() if attrs != nil { end = attrs.End() } + if preAttrs != nil { + if attrs != nil { + preAttrs.Attributes = append(preAttrs.Attributes, attrs.Attributes...) + preAttrs.Stop = attrs.Stop + } + attrs = preAttrs + } switch s := schema.(type) { case *ast.SimpleColumnSchema: - s.Collate, s.DefaultExpression, s.Attributes, s.Stop = collate, genOrDefault, attrs, end + s.Collate, s.DefaultExpression, s.OnUpdate, s.Attributes, s.Stop = collate, genOrDefault, onUpdate, attrs, end case *ast.ArrayColumnSchema: s.Collate, s.Attributes, s.Stop = collate, attrs, end case *ast.StructColumnSchema: @@ -3875,16 +3976,38 @@ func (p *parser) parseStructColumnField() (*ast.StructColumnField, error) { // schema; see column_attributes in googlesql.tm. NOT NULL, PRIMARY KEY and // HIDDEN are implemented. It returns nil when no attribute is present. func (p *parser) tryParseColumnAttributes() *ast.ColumnAttributeList { + // Spanner adds the PLACEMENT KEY and AUTO_INCREMENT attributes. + spannerAttr := func() bool { + return p.spanner() && ((isKeyword(p.peek(), "PLACEMENT") && isKeyword(p.peekAt(1), "KEY")) || + isKeyword(p.peek(), "AUTO_INCREMENT")) + } startsAttr := func() bool { return (isKeyword(p.peek(), "NOT") && isKeyword(p.peekAt(1), "NULL")) || (isKeyword(p.peek(), "PRIMARY") && isKeyword(p.peekAt(1), "KEY")) || - isKeyword(p.peek(), "HIDDEN") + isKeyword(p.peek(), "HIDDEN") || spannerAttr() } if !startsAttr() { return nil } list := &ast.ColumnAttributeList{} for startsAttr() { + if spannerAttr() { + first := p.advance() + last := first + var attr ast.Node + if isKeyword(first, "PLACEMENT") { + last = p.advance() // KEY + attr = &ast.PlacementKeyColumnAttribute{Span: span(first.Pos, last.End)} + } else { + attr = &ast.AutoIncrementColumnAttribute{Span: span(first.Pos, last.End)} + } + if len(list.Attributes) == 0 { + list.Start = first.Pos + } + list.Stop = last.End + list.Attributes = append(list.Attributes, attr) + continue + } if isKeyword(p.peek(), "HIDDEN") { hiddenTok := p.advance() // HIDDEN if len(list.Attributes) == 0 { @@ -4782,6 +4905,9 @@ func (p *parser) parseCreateIndexStatement(createTok token.Token, isOrReplace bo stmt.Storing = storing stmt.Stop = storing.End() } + if p.spanner() { + return p.parseSpannerIndexSuffix(stmt) + } // Optional suffix: PARTITION BY [OPTIONS] or OPTIONS. if isKeyword(p.peek(), "PARTITION") { pb, err := p.parseIndexPartitionBy() @@ -4980,7 +5106,8 @@ func (p *parser) parseIndexPartitionBy() (*ast.PartitionBy, error) { } pb.Expressions = append(pb.Expressions, expr) pb.Stop = p.extEnd(expr) - if p.peek().Kind == token.COMMA { + // Under Spanner, ", INTERLEAVE IN" ends the list. + if p.peek().Kind == token.COMMA && !(p.spanner() && isKeyword(p.peekAt(1), "INTERLEAVE")) { p.advance() continue } @@ -6331,6 +6458,16 @@ func (p *parser) parseDropStatement() (ast.Statement, error) { dashedName := false switch { + case p.spanner() && isKeyword(kindTok, "CHANGE") && isKeyword(second, "STREAM"): + consumeSecond() + objectKind = "CHANGE STREAM" + parsesDropMode = false + case p.spanner() && isKeyword(kindTok, "LOCALITY") && isKeyword(second, "GROUP"): + consumeSecond() + objectKind = "LOCALITY GROUP" + parsesDropMode = false + case p.spanner() && isKeyword(kindTok, "PROTO") && isKeyword(second, "BUNDLE"): + return p.parseDropProtoBundleStatement(dropTok) case isKeyword(kindTok, "ROW"): // DROP ROW ACCESS POLICY ...; see drop_statement in googlesql.tm. Only // the unquoted keyword ROW triggers this; a quoted `row` object type @@ -6557,11 +6694,13 @@ func (p *parser) parseDropIndexStatement(dropTok token.Token) (ast.Statement, er // googlesql.tm. The ALTER keyword is already consumed; the parser is at // SEARCH or VECTOR. func (p *parser) parseAlterIndexStatement(alterTok token.Token) (ast.Statement, error) { - kindTok := p.advance() // SEARCH or VECTOR - if _, err := p.expectKeyword("INDEX"); err != nil { - return nil, err + kindTok := p.advance() // SEARCH, VECTOR, or (Spanner) INDEX + if !isKeyword(kindTok, "INDEX") { + if _, err := p.expectKeyword("INDEX"); err != nil { + return nil, err + } } - stmt := &ast.AlterIndexStatement{Vector: isKeyword(kindTok, "VECTOR"), IsIfExists: p.tryParseIfExists()} + stmt := &ast.AlterIndexStatement{Vector: isKeyword(kindTok, "VECTOR"), Plain: isKeyword(kindTok, "INDEX"), IsIfExists: p.tryParseIfExists()} var err error if stmt.Name, err = p.parsePathExpression(); err != nil { return nil, err @@ -6595,6 +6734,22 @@ func (p *parser) parseAlterIndexStatement(alterTok token.Token) (ast.Statement, // ALTER COLUMN [IF EXISTS] c SET OPTIONS (...), or REBUILD. func (p *parser) parseAlterIndexAction() (ast.Node, error) { tok := p.peek() + // Spanner "ADD STORED COLUMN c" / "DROP STORED COLUMN c". + if p.spanner() && (isKeyword(tok, "ADD") || isKeyword(tok, "DROP")) && isKeyword(p.peekAt(1), "STORED") { + p.advance() // ADD or DROP + p.advance() // STORED + if _, err := p.expectKeyword("COLUMN"); err != nil { + return nil, err + } + col, err := p.parseIdentifier() + if err != nil { + return nil, err + } + if isKeyword(tok, "ADD") { + return &ast.AddStoredColumnAction{Span: span(tok.Pos, col.End()), Column: col}, nil + } + return &ast.DropStoredColumnAction{Span: span(tok.Pos, col.End()), Column: col}, nil + } switch { case isKeyword(tok, "REBUILD"): p.advance() @@ -6711,6 +6866,10 @@ func (p *parser) parseDropAllRowAccessPoliciesStatement(dropTok token.Token) (as // "materialized view"), then the grantee list. func (p *parser) parseGrantOrRevokeStatement(isRevoke bool) (ast.Statement, error) { startTok := p.advance() // GRANT or REVOKE + // Spanner "GRANT ROLE role, ... TO ROLE grantee, ...". + if p.startsSpannerRoleList() { + return p.parseGrantRoleStatement(startTok, isRevoke) + } privs, err := p.parsePrivileges() if err != nil { return nil, err @@ -6718,6 +6877,28 @@ func (p *parser) parseGrantOrRevokeStatement(isRevoke bool) (ast.Statement, erro if _, err := p.expectKeyword("ON"); err != nil { return nil, err } + term := "TO" + if isRevoke { + term = "FROM" + } + // Spanner "ON ALL TABLES IN SCHEMA schema, ... TO ROLE role, ...". + if p.spanner() && isKeyword(p.peek(), "ALL") { + kind, objects, err := p.parseGrantOnAllInSchema() + if err != nil { + return nil, err + } + if _, err := p.expectKeyword(term); err != nil { + return nil, err + } + if _, err := p.expectKeyword("ROLE"); err != nil { + return nil, err + } + roles, err := p.parseIdentifierList() + if err != nil { + return nil, err + } + return &ast.GrantToRoleStatement{Span: span(startTok.Pos, roles.End()), IsRevoke: isRevoke, Privileges: privs, ObjectTypes: []*ast.Identifier{kind}, AllInSchema: true, Objects: objects, Roles: roles}, nil + } // The object name is preceded by up to two object-type identifiers. An // identifier is a leading type word only when it is followed by another @@ -6727,15 +6908,39 @@ func (p *parser) parseGrantOrRevokeStatement(isRevoke bool) (ast.Statement, erro var objectTypes []*ast.Identifier for { tok := p.peek() - if !beginsObjectIdentifier(tok) { + if !p.grantObjectToken(tok) { return nil, p.errorf(tok.Pos, "Syntax error: Unexpected %s", describeToken(tok)) } - if len(objectTypes) < 2 && beginsObjectIdentifier(p.peekAt(1)) { + if len(objectTypes) < 2 && p.grantObjectToken(p.peekAt(1)) { objectTypes = append(objectTypes, p.parseIdentifierToken(p.advance())) continue } break } + // Spanner accepts several objects ("ON TABLE a, b") and grants them TO + // ROLE; see GrantToRoleStatement. + if p.spanner() { + save := p.pos + objects, err := p.parseGrantObjectList() + if err != nil { + return nil, err + } + if isKeyword(p.peek(), term) && isKeyword(p.peekAt(1), "ROLE") && beginsObjectIdentifier(p.peekAt(2)) { + p.advance() // TO / FROM + p.advance() // ROLE + roles, err := p.parseIdentifierList() + if err != nil { + return nil, err + } + return &ast.GrantToRoleStatement{Span: span(startTok.Pos, roles.End()), IsRevoke: isRevoke, Privileges: privs, ObjectTypes: objectTypes, Objects: objects, Roles: roles}, nil + } + if len(objects.Paths) > 1 { + return nil, p.errorf(p.peek().Pos, "Syntax error: Expected keyword %s ROLE but got %s", term, describeToken(p.peek())) + } + // A single object granted to string or parameter grantees is the + // GoogleSQL GRANT/REVOKE, continued below. + p.pos = save + } path, err := p.parsePathExpression() if err != nil { return nil, err @@ -6745,10 +6950,6 @@ func (p *parser) parseGrantOrRevokeStatement(isRevoke bool) (ast.Statement, erro // with ".", so the error's expected-token set includes "."; the terminator // keyword is only listed when there were no leading object-type identifiers, // matching the reference's LALR state. - term := "TO" - if isRevoke { - term = "FROM" - } if !isKeyword(p.peek(), term) { expected := `"."` if len(objectTypes) == 0 { @@ -6946,6 +7147,14 @@ func (p *parser) parseAlterStatement() (ast.Statement, error) { consumeSecond := func() { p.advance(); p.advance() } second := p.peekAt(1) switch { + case p.spanner() && isKeyword(kindTok, "CHANGE") && isKeyword(second, "STREAM"): + return p.parseAlterChangeStreamStatement(alterTok) + case p.spanner() && isKeyword(kindTok, "LOCALITY") && isKeyword(second, "GROUP"): + return p.parseAlterLocalityGroupStatement(alterTok) + case p.spanner() && isKeyword(kindTok, "PROTO") && isKeyword(second, "BUNDLE"): + return p.parseAlterProtoBundleStatement(alterTok) + case p.spanner() && isKeyword(kindTok, "INDEX"): + return p.parseAlterIndexStatement(alterTok) case isKeyword(kindTok, "ROW"): return p.parseAlterRowAccessPolicyStatement(alterTok) case isKeyword(kindTok, "ALL"): @@ -7031,9 +7240,10 @@ func (p *parser) parseAlterStatement() (ast.Statement, error) { } var path *ast.PathExpression var err error - if nodeName == "AlterTableStatement" { + if nodeName == "AlterTableStatement" || (p.spanner() && nodeName == "AlterDatabaseStatement") { // Only ALTER TABLE uses a maybe-dashed table name; see - // alter_statement in googlesql.tm. + // alter_statement in googlesql.tm. Spanner database ids may contain + // dashes too. path, err = p.parseMaybeDashedPathExpression() } else { path, err = p.parsePathExpression() @@ -7968,6 +8178,9 @@ func (p *parser) parseAlterColumnAction() (ast.Node, error) { return nil, err } next := p.peek() + if p.spanner() && isKeyword(next, "ALTER") && isKeyword(p.peekAt(1), "IDENTITY") { + return p.parseAlterColumnIdentityAction(alterTok, name) + } // spanner_alter_column_action: "ALTER" "COLUMN" opt_if_exists identifier // column_schema_inner ...; when the token after the column name is neither // SET nor DROP, this is the Spanner form (an inline column redefinition). @@ -8075,6 +8288,12 @@ func (p *parser) parseSpannerAlterColumnAction(alterTok token.Token, ifPos int, if _, err := p.expect(token.RPAREN, `")"`); err != nil { return nil, err } + // Spanner also accepts a non-stored generated column here. + if p.spanner() && !isKeyword(p.peek(), "STORED") { + genOrDefault = &ast.GeneratedColumnInfo{Span: span(asTok.Pos, p.prevEnd()), GeneratedMode: "ALWAYS", Expression: expr} + end = p.prevEnd() + break + } storedTok, err := p.expectKeyword("STORED") if err != nil { return nil, err @@ -8168,6 +8387,19 @@ func (p *parser) parseIdentityColumnInfo() (*ast.IdentityColumnInfo, error) { if err != nil { return nil, err } + // Spanner allows a bare IDENTITY and its own option syntax. + if p.spanner() { + info := &ast.IdentityColumnInfo{Span: span(identityTok.Pos, identityTok.End)} + if p.peek().Kind != token.LPAREN { + return info, nil + } + p.advance() // ( + if err := p.parseSpannerIdentityOptions(info); err != nil { + return nil, err + } + info.Stop = p.advance().End // ) + return info, nil + } if _, err := p.expect(token.LPAREN, `"("`); err != nil { return nil, err } @@ -8309,6 +8541,10 @@ func (p *parser) parseOptionsList() (*ast.OptionsList, error) { break } p.advance() + // Spanner accepts a trailing comma. + if p.spanner() && p.peek().Kind == token.RPAREN { + break + } } } rparen, err := p.expect(token.RPAREN, `")"`) @@ -15395,6 +15631,19 @@ func (p *parser) parseTypeParameterList() (*ast.TypeParameterList, error) { // in googlesql.tm. func (p *parser) parseTypeParameter() (ast.Node, error) { tok := p.peek() + // Spanner named type parameters, e.g. ARRAY(vector_length=>128). + if p.spanner() && isIdentToken(tok) && p.peekAt(1).Kind == token.LAMBDA { + name, err := p.parseIdentifier() + if err != nil { + return nil, err + } + p.advance() // => + value, err := p.parseTypeParameter() + if err != nil { + return nil, err + } + return &ast.NamedArgument{Span: span(name.Pos(), value.End()), Name: name, Value: value}, nil + } switch tok.Kind { case token.INT: p.advance() diff --git a/parser/parser_test.go b/parser/parser_test.go index 683d1f1..301e9b5 100644 --- a/parser/parser_test.go +++ b/parser/parser_test.go @@ -178,6 +178,13 @@ func TestParser(t *testing.T) { t.Fatal(err) } files = append(files, spanner...) + // Hand-written cases for zetajones extensions such as SPANNER_DDL, which + // have no reference output; run as "extensions/...". + extensions, err := testfile.FindFiles(filepath.Join("testdata", "extensions")) + if err != nil { + t.Fatal(err) + } + files = append(files, extensions...) for _, path := range files { name, _ := filepath.Rel("testdata", path) diff --git a/parser/spanner.go b/parser/spanner.go new file mode 100644 index 0000000..a0e7755 --- /dev/null +++ b/parser/spanner.go @@ -0,0 +1,731 @@ +package parser + +import ( + "strings" + + "github.com/sqlc-dev/zetajones/ast" + "github.com/sqlc-dev/zetajones/token" +) + +// Cloud Spanner DDL that GoogleSQL's reference parser does not accept, gated +// by FeatureSpannerDDL. The nodes are defined in ast/spanner.go; reference +// nodes are reused wherever the Spanner syntax has a GoogleSQL equivalent. + +// spannerEntityTypes and spannerSubEntityTypes are the generic entity and +// sub-entity types FeatureSpannerDDL accepts: CREATE/DROP ROLE and PLACEMENT +// parse as CreateEntityStatement/DropEntityStatement, and ALTER TABLE ADD/DROP +// SYNONYM as AddSubEntityAction/DropSubEntityAction. +var ( + spannerEntityTypes = []string{"ROLE", "PLACEMENT"} + spannerSubEntityTypes = []string{"SYNONYM"} +) + +// spanner reports whether FeatureSpannerDDL is enabled. +func (p *parser) spanner() bool { + return p.features.Enabled(FeatureSpannerDDL) +} + +// parseCreateLocalityGroupStatement parses "CREATE LOCALITY GROUP path +// [OPTIONS(...)]"; see create_locality_group_statement in googlesql.tm. The +// next token is LOCALITY. Requires FEATURE_CREATE_LOCALITY_GROUP. +func (p *parser) parseCreateLocalityGroupStatement(createTok token.Token) (ast.Statement, error) { + localityTok := p.advance() // LOCALITY + if _, err := p.expectKeyword("GROUP"); err != nil { + return nil, err + } + name, err := p.parsePathExpression() + if err != nil { + return nil, err + } + stmt := &ast.CreateLocalityGroupStatement{Span: span(createTok.Pos, name.End()), Name: name} + if isKeyword(p.peek(), "OPTIONS") { + p.advance() // OPTIONS + if stmt.Options, err = p.parseOptionsList(); err != nil { + return nil, err + } + stmt.Stop = stmt.Options.End() + } + if !p.features.Enabled(FeatureCreateLocalityGroup) { + // No "Syntax error: " prefix, matching the reference rule action. + return nil, p.errorf(localityTok.Pos, "CREATE LOCALITY GROUP is not supported") + } + return stmt, nil +} + +// parseSpannerCreateStatement parses the Spanner-only CREATE statements +// (CHANGE STREAM, PROTO BUNDLE, QUEUE) when the tokens after CREATE start one, +// reporting ok=false otherwise. +func (p *parser) parseSpannerCreateStatement(createTok token.Token) (stmt ast.Statement, ok bool, err error) { + switch tok, next := p.peek(), p.peekAt(1); { + case isKeyword(tok, "CHANGE") && isKeyword(next, "STREAM"): + stmt, err = p.parseCreateChangeStreamStatement(createTok) + case isKeyword(tok, "PROTO") && isKeyword(next, "BUNDLE"): + stmt, err = p.parseCreateProtoBundleStatement(createTok) + case isKeyword(tok, "QUEUE") && next.Kind != token.LPAREN: + stmt, err = p.parseCreateQueueStatement(createTok) + default: + return nil, false, nil + } + return stmt, true, err +} + +// parseCreateChangeStreamStatement parses "CREATE CHANGE STREAM [IF NOT +// EXISTS] name [FOR ...] [OPTIONS (...)]". CHANGE is the next token. +func (p *parser) parseCreateChangeStreamStatement(createTok token.Token) (ast.Statement, error) { + p.advance() // CHANGE + p.advance() // STREAM + ifNotExists, err := p.parseOptIfNotExists() + if err != nil { + return nil, err + } + name, err := p.parsePathExpression() + if err != nil { + return nil, err + } + stmt := &ast.CreateChangeStreamStatement{Span: span(createTok.Pos, name.End()), IsIfNotExists: ifNotExists, Name: name} + if isKeyword(p.peek(), "FOR") { + if stmt.For, err = p.parseChangeStreamForClause(); err != nil { + return nil, err + } + stmt.Stop = stmt.For.End() + } + if isKeyword(p.peek(), "OPTIONS") { + p.advance() // OPTIONS + if stmt.Options, err = p.parseOptionsList(); err != nil { + return nil, err + } + stmt.Stop = stmt.Options.End() + } + return stmt, nil +} + +// parseChangeStreamForClause parses "FOR ALL" or "FOR table [(column, ...)], +// ...". FOR is the next token. +func (p *parser) parseChangeStreamForClause() (*ast.ChangeStreamForClause, error) { + forTok := p.advance() // FOR + if isKeyword(p.peek(), "ALL") { + allTok := p.advance() + return &ast.ChangeStreamForClause{Span: span(forTok.Pos, allTok.End), All: true}, nil + } + clause := &ast.ChangeStreamForClause{Span: span(forTok.Pos, 0)} + for { + table, err := p.parsePathExpression() + if err != nil { + return nil, err + } + tracked := &ast.ChangeStreamTrackedTable{Span: span(table.Pos(), table.End()), Table: table} + if p.peek().Kind == token.LPAREN { + if tracked.Columns, err = p.parseParenColumnList(); err != nil { + return nil, err + } + tracked.Stop = tracked.Columns.End() + } + clause.Tables = append(clause.Tables, tracked) + clause.Stop = tracked.End() + if p.peek().Kind != token.COMMA { + return clause, nil + } + p.advance() // , + } +} + +// parseParenColumnList parses "( [identifier, ...] )", allowing an empty +// list. The list's location includes the parentheses. +func (p *parser) parseParenColumnList() (*ast.ColumnList, error) { + lparen, err := p.expect(token.LPAREN, `"("`) + if err != nil { + return nil, err + } + list := &ast.ColumnList{Span: span(lparen.Pos, 0)} + for p.peek().Kind != token.RPAREN { + id, err := p.parseIdentifier() + if err != nil { + return nil, err + } + list.Identifiers = append(list.Identifiers, id) + if p.peek().Kind != token.COMMA { + break + } + p.advance() // , + } + rparen, err := p.expect(token.RPAREN, `")"`) + if err != nil { + return nil, err + } + list.Stop = rparen.End + return list, nil +} + +// parseAlterChangeStreamStatement parses "ALTER CHANGE STREAM [IF EXISTS] +// name {SET FOR ... | DROP FOR ALL | SET OPTIONS (...)}". CHANGE is the next +// token. +func (p *parser) parseAlterChangeStreamStatement(alterTok token.Token) (ast.Statement, error) { + p.advance() // CHANGE + p.advance() // STREAM + stmt := &ast.AlterChangeStreamStatement{IsIfExists: p.tryParseIfExists()} + var err error + if stmt.Name, err = p.parsePathExpression(); err != nil { + return nil, err + } + list := &ast.AlterActionList{} + for { + tok := p.peek() + var action ast.Node + switch { + case isKeyword(tok, "SET") && isKeyword(p.peekAt(1), "FOR"): + p.advance() // SET + forClause, err := p.parseChangeStreamForClause() + if err != nil { + return nil, err + } + action = &ast.SetChangeStreamForAction{Span: span(tok.Pos, forClause.End()), For: forClause} + case isKeyword(tok, "SET") && isKeyword(p.peekAt(1), "OPTIONS"): + p.advance() // SET + p.advance() // OPTIONS + opts, err := p.parseOptionsList() + if err != nil { + return nil, err + } + action = &ast.SetOptionsAction{Span: span(tok.Pos, opts.End()), Options: opts} + case isKeyword(tok, "DROP"): + p.advance() // DROP + if _, err := p.expectKeyword("FOR"); err != nil { + return nil, err + } + allTok, err := p.expectKeyword("ALL") + if err != nil { + return nil, err + } + action = &ast.DropChangeStreamForAllAction{Span: span(tok.Pos, allTok.End)} + default: + return nil, p.errorf(tok.Pos, "Syntax error: Expected keyword DROP or keyword SET but got %s", describeToken(tok)) + } + list.Actions = append(list.Actions, action) + if p.peek().Kind != token.COMMA { + break + } + p.advance() // , + } + list.Span = span(list.Actions[0].Pos(), p.prevEnd()) + stmt.Actions = list + stmt.Span = span(alterTok.Pos, p.prevEnd()) + return stmt, nil +} + +// parseAlterLocalityGroupStatement parses "ALTER LOCALITY GROUP [IF EXISTS] +// name alter_action_list" (in practice SET OPTIONS (...)). LOCALITY is the +// next token. +func (p *parser) parseAlterLocalityGroupStatement(alterTok token.Token) (ast.Statement, error) { + p.advance() // LOCALITY + p.advance() // GROUP + stmt := &ast.AlterLocalityGroupStatement{IsIfExists: p.tryParseIfExists()} + var err error + if stmt.Name, err = p.parsePathExpression(); err != nil { + return nil, err + } + if stmt.Actions, err = p.parseAlterActionList(); err != nil { + return nil, err + } + stmt.Span = span(alterTok.Pos, stmt.Actions.End()) + return stmt, nil +} + +// parseCreateProtoBundleStatement parses "CREATE PROTO BUNDLE (type, ...)". +// PROTO is the next token. +func (p *parser) parseCreateProtoBundleStatement(createTok token.Token) (ast.Statement, error) { + p.advance() // PROTO + p.advance() // BUNDLE + types, err := p.parseProtoBundleTypeList() + if err != nil { + return nil, err + } + return &ast.CreateProtoBundleStatement{Span: span(createTok.Pos, types.End()), Types: types}, nil +} + +// parseProtoBundleTypeList parses "( path [, ...] [,] )": the proto type names +// of a proto bundle, allowing a trailing comma. The list's location includes +// the parentheses. +func (p *parser) parseProtoBundleTypeList() (*ast.PathExpressionList, error) { + lparen, err := p.expect(token.LPAREN, `"("`) + if err != nil { + return nil, err + } + list := &ast.PathExpressionList{Span: span(lparen.Pos, 0)} + for { + path, err := p.parsePathExpression() + if err != nil { + return nil, err + } + list.Paths = append(list.Paths, path) + if p.peek().Kind != token.COMMA { + break + } + p.advance() // , + if p.peek().Kind == token.RPAREN { + break + } + } + rparen, err := p.expect(token.RPAREN, `")"`) + if err != nil { + return nil, err + } + list.Stop = rparen.End + return list, nil +} + +// parseAlterProtoBundleStatement parses "ALTER PROTO BUNDLE [INSERT (...)] +// [UPDATE (...)] [DELETE (...)]" with at least one action. PROTO is the next +// token. +func (p *parser) parseAlterProtoBundleStatement(alterTok token.Token) (ast.Statement, error) { + p.advance() // PROTO + p.advance() // BUNDLE + list := &ast.AlterActionList{} + for isKeyword(p.peek(), "INSERT") || isKeyword(p.peek(), "UPDATE") || isKeyword(p.peek(), "DELETE") { + opTok := p.advance() + types, err := p.parseProtoBundleTypeList() + if err != nil { + return nil, err + } + list.Actions = append(list.Actions, &ast.ProtoBundleAction{Span: span(opTok.Pos, types.End()), Op: strings.ToUpper(opTok.Image), Types: types}) + } + if len(list.Actions) == 0 { + return nil, p.errorf(p.peek().Pos, "Syntax error: Expected keyword DELETE or keyword INSERT or keyword UPDATE but got %s", describeToken(p.peek())) + } + list.Span = span(list.Actions[0].Pos(), p.prevEnd()) + return &ast.AlterProtoBundleStatement{Span: span(alterTok.Pos, p.prevEnd()), Actions: list}, nil +} + +// parseDropProtoBundleStatement parses "DROP PROTO BUNDLE". PROTO is the next +// token. +func (p *parser) parseDropProtoBundleStatement(dropTok token.Token) (ast.Statement, error) { + p.advance() // PROTO + bundleTok := p.advance() // BUNDLE + return &ast.DropProtoBundleStatement{Span: span(dropTok.Pos, bundleTok.End)}, nil +} + +// parseCreateQueueStatement parses "CREATE QUEUE [IF NOT EXISTS] name +// (elements) PRIMARY KEY (...) [, INTERLEAVE IN [PARENT] ...] [, OPTIONS +// (...)]": a queue is declared like a Spanner table. QUEUE is the next token. +func (p *parser) parseCreateQueueStatement(createTok token.Token) (ast.Statement, error) { + p.advance() // QUEUE + ifNotExists, err := p.parseOptIfNotExists() + if err != nil { + return nil, err + } + name, err := p.parsePathExpression() + if err != nil { + return nil, err + } + stmt := &ast.CreateQueueStatement{Span: span(createTok.Pos, name.End()), IsIfNotExists: ifNotExists, Name: name} + if p.peek().Kind != token.LPAREN { + return nil, p.errorf(p.peek().Pos, `Syntax error: Expected "(" but got %s`, describeToken(p.peek())) + } + if stmt.TableElementList, err = p.parseTableElementList(); err != nil { + return nil, err + } + stmt.Stop = stmt.TableElementList.End() + if isKeyword(p.peek(), "PRIMARY") && isKeyword(p.peekAt(1), "KEY") { + if stmt.SpannerOptions, err = p.parseSpannerTableOptions(); err != nil { + return nil, err + } + stmt.Stop = stmt.SpannerOptions.End() + ttl, opts, err := p.parseSpannerTableTrailers(stmt.SpannerOptions) + if err != nil { + return nil, err + } + if ttl != nil { + return nil, p.errorf(ttl.Pos(), "Syntax error: ROW DELETION POLICY is not supported for queues") + } + stmt.Options = opts + stmt.Stop = p.prevEnd() + } + if stmt.Options == nil && isKeyword(p.peek(), "OPTIONS") { + p.advance() // OPTIONS + if stmt.Options, err = p.parseOptionsList(); err != nil { + return nil, err + } + stmt.Stop = stmt.Options.End() + } + return stmt, nil +} + +// parseSpannerTableTrailers parses the comma-separated clauses Spanner accepts +// after "PRIMARY KEY (...) [, INTERLEAVE IN PARENT ...]", in order: ", +// INTERLEAVE IN path" (no PARENT; attached to opts like INTERLEAVE IN +// PARENT), ", ROW DELETION POLICY (expression)" and ", OPTIONS (...)". The +// TTL clause and options are the nodes the reference produces for the same +// clauses without the comma. Only called under FeatureSpannerDDL. +func (p *parser) parseSpannerTableTrailers(opts *ast.SpannerTableOptions) (*ast.TtlClause, *ast.OptionsList, error) { + if opts.Interleave == nil && p.peek().Kind == token.COMMA && + isKeyword(p.peekAt(1), "INTERLEAVE") && isKeyword(p.peekAt(2), "IN") { + commaTok := p.advance() // , + p.advance() // INTERLEAVE + p.advance() // IN + path, err := p.parseMaybeDashedPathExpression() + if err != nil { + return nil, nil, err + } + opts.Interleave = &ast.SpannerInterleaveClause{Span: span(commaTok.Pos, path.End()), TableName: path, Type: "IN"} + opts.Stop = path.End() + } + var ttl *ast.TtlClause + if p.peek().Kind == token.COMMA && isKeyword(p.peekAt(1), "ROW") && isKeyword(p.peekAt(2), "DELETION") { + p.advance() // , + var err error + if ttl, err = p.parseTtlClause(); err != nil { + return nil, nil, err + } + } + var options *ast.OptionsList + if p.peek().Kind == token.COMMA && isKeyword(p.peekAt(1), "OPTIONS") { + p.advance() // , + p.advance() // OPTIONS + var err error + if options, err = p.parseOptionsList(); err != nil { + return nil, nil, err + } + } + return ttl, options, nil +} + +// parseTtlClause parses "ROW DELETION POLICY (expression)"; see ttl_clause in +// googlesql.tm. ROW is the next token. Requires FEATURE_TTL. +func (p *parser) parseTtlClause() (*ast.TtlClause, error) { + rowTok := p.advance() // ROW + if _, err := p.expectKeyword("DELETION"); err != nil { + return nil, err + } + if _, err := p.expectKeyword("POLICY"); err != nil { + return nil, err + } + if _, err := p.expect(token.LPAREN, `"("`); err != nil { + return nil, err + } + expr, err := p.parseExpression() + if err != nil { + return nil, err + } + rparen, err := p.expect(token.RPAREN, `")"`) + if err != nil { + return nil, err + } + if !p.features.Enabled(FeatureTTL) { + return nil, p.errorf(rowTok.Pos, "ROW DELETION POLICY clause is not supported.") + } + return &ast.TtlClause{Span: span(rowTok.Pos, rparen.End), Expression: expr}, nil +} + +// parseTableSynonym parses the Spanner "SYNONYM (name)" table element. +// SYNONYM is the next token. +func (p *parser) parseTableSynonym() (*ast.TableSynonym, error) { + synTok := p.advance() // SYNONYM + if _, err := p.expect(token.LPAREN, `"("`); err != nil { + return nil, err + } + name, err := p.parseIdentifier() + if err != nil { + return nil, err + } + rparen, err := p.expect(token.RPAREN, `")"`) + if err != nil { + return nil, err + } + return &ast.TableSynonym{Span: span(synTok.Pos, rparen.End), Name: name}, nil +} + +// parseColumnOnUpdate parses a Spanner column's "ON UPDATE expression" +// clause. ON is the next token. +func (p *parser) parseColumnOnUpdate() (*ast.ColumnOnUpdateClause, error) { + onTok := p.advance() // ON + if _, err := p.expectKeyword("UPDATE"); err != nil { + return nil, err + } + expr, err := p.parseExpression() + if err != nil { + return nil, err + } + return &ast.ColumnOnUpdateClause{Span: span(onTok.Pos, p.extEnd(expr)), Expression: expr}, nil +} + +// parseSpannerIdentityOptions parses the body of a Spanner identity column's +// option list after "IDENTITY (": any of a sequence kind (e.g. +// BIT_REVERSED_POSITIVE), "SKIP RANGE min, max", "START COUNTER WITH n", and +// the GoogleSQL options START WITH, INCREMENT BY, MAXVALUE, MINVALUE and +// [NO] CYCLE, in any order. START COUNTER WITH reuses IdentityColumnStartWith. +func (p *parser) parseSpannerIdentityOptions(info *ast.IdentityColumnInfo) error { + for p.peek().Kind != token.RPAREN { + tok := p.peek() + switch { + case isKeyword(tok, "START") && info.StartWith == nil: + p.advance() // START + if isKeyword(p.peek(), "COUNTER") { + p.advance() + } + if _, err := p.expectKeyword("WITH"); err != nil { + return err + } + value, err := p.parseSignedNumericalLiteral() + if err != nil { + return err + } + info.StartWith = &ast.IdentityColumnStartWith{Span: span(tok.Pos, p.extEnd(value)), Value: value} + case isKeyword(tok, "SKIP") && info.SkipRange == nil: + skipRange, err := p.parseSkipRange() + if err != nil { + return err + } + info.SkipRange = skipRange + case isKeyword(tok, "INCREMENT") && info.IncrementBy == nil: + p.advance() // INCREMENT + if _, err := p.expectKeyword("BY"); err != nil { + return err + } + value, err := p.parseSignedNumericalLiteral() + if err != nil { + return err + } + info.IncrementBy = &ast.IdentityColumnIncrementBy{Span: span(tok.Pos, p.extEnd(value)), Value: value} + case isKeyword(tok, "MAXVALUE") && info.MaxValue == nil: + p.advance() // MAXVALUE + value, err := p.parseSignedNumericalLiteral() + if err != nil { + return err + } + info.MaxValue = &ast.IdentityColumnMaxValue{Span: span(tok.Pos, p.extEnd(value)), Value: value} + case isKeyword(tok, "MINVALUE") && info.MinValue == nil: + p.advance() // MINVALUE + value, err := p.parseSignedNumericalLiteral() + if err != nil { + return err + } + info.MinValue = &ast.IdentityColumnMinValue{Span: span(tok.Pos, p.extEnd(value)), Value: value} + case isKeyword(tok, "CYCLE"): + p.advance() + case isKeyword(tok, "NO") && isKeyword(p.peekAt(1), "CYCLE"): + p.advance() + p.advance() + case info.SequenceKind == nil && tok.Kind == token.IDENT && !p.isReserved(tok): + info.SequenceKind = p.parseIdentifierToken(p.advance()) + default: + return p.errorf(tok.Pos, `Syntax error: Expected ")" but got %s`, describeToken(tok)) + } + } + return nil +} + +// parseSkipRange parses "SKIP RANGE min, max". SKIP is the next token. +func (p *parser) parseSkipRange() (*ast.IdentityColumnSkipRange, error) { + skipTok := p.advance() // SKIP + if _, err := p.expectKeyword("RANGE"); err != nil { + return nil, err + } + lo, err := p.parseSignedNumericalLiteral() + if err != nil { + return nil, err + } + if _, err := p.expect(token.COMMA, `","`); err != nil { + return nil, err + } + hi, err := p.parseSignedNumericalLiteral() + if err != nil { + return nil, err + } + return &ast.IdentityColumnSkipRange{Span: span(skipTok.Pos, p.extEnd(hi)), Min: lo, Max: hi}, nil +} + +// parseAlterColumnIdentityAction parses the tail of "ALTER COLUMN c ALTER +// IDENTITY {SET SKIP RANGE min, max | SET NO SKIP RANGE | RESTART COUNTER +// WITH n}". The next token is the second ALTER. +func (p *parser) parseAlterColumnIdentityAction(alterTok token.Token, name *ast.Identifier) (ast.Node, error) { + p.advance() // ALTER + p.advance() // IDENTITY + action := &ast.AlterColumnIdentityAction{Column: name} + tok := p.peek() + switch { + case isKeyword(tok, "SET") && isKeyword(p.peekAt(1), "SKIP"): + p.advance() // SET + skipRange, err := p.parseSkipRange() + if err != nil { + return nil, err + } + action.SkipRange = skipRange + case isKeyword(tok, "SET") && isKeyword(p.peekAt(1), "NO"): + p.advance() // SET + p.advance() // NO + if _, err := p.expectKeyword("SKIP"); err != nil { + return nil, err + } + if _, err := p.expectKeyword("RANGE"); err != nil { + return nil, err + } + action.NoSkipRange = true + case isKeyword(tok, "RESTART"): + p.advance() // RESTART + if _, err := p.expectKeyword("COUNTER"); err != nil { + return nil, err + } + if _, err := p.expectKeyword("WITH"); err != nil { + return nil, err + } + value, err := p.parseSignedNumericalLiteral() + if err != nil { + return nil, err + } + action.RestartCounterWith = &ast.IdentityColumnRestartCounterWith{Span: span(tok.Pos, p.extEnd(value)), Value: value} + default: + return nil, p.errorf(tok.Pos, "Syntax error: Expected keyword RESTART or keyword SET but got %s", describeToken(tok)) + } + action.Span = span(alterTok.Pos, p.prevEnd()) + return action, nil +} + +// grantObjectToken reports whether tok can begin an object name or object-type +// word in a GRANT/REVOKE statement. Under FeatureSpannerDDL the reserved +// keyword DEFAULT also names an object (Spanner's default schema, as in "ON +// SCHEMA default"). +func (p *parser) grantObjectToken(tok token.Token) bool { + return beginsObjectIdentifier(tok) || (p.spanner() && isKeyword(tok, "DEFAULT")) +} + +// parseGrantObjectPath parses an object name in a Spanner GRANT/REVOKE, +// accepting DEFAULT as a one-part name. +func (p *parser) parseGrantObjectPath() (*ast.PathExpression, error) { + if tok := p.peek(); isKeyword(tok, "DEFAULT") { + p.advance() + id := &ast.Identifier{Span: span(tok.Pos, tok.End), Name: tok.Image} + return &ast.PathExpression{Span: id.Span, Names: []*ast.Identifier{id}}, nil + } + return p.parsePathExpression() +} + +// startsSpannerRoleList reports whether the next tokens are "ROLE identifier", +// the Spanner grantee or granted-role list of a GRANT/REVOKE. +func (p *parser) startsSpannerRoleList() bool { + return p.spanner() && isKeyword(p.peek(), "ROLE") && beginsObjectIdentifier(p.peekAt(1)) +} + +// parseGrantRoleStatement parses "GRANT ROLE role, ... TO ROLE role, ..." or +// "REVOKE ROLE role, ... FROM ROLE role, ...". The next token is ROLE. +func (p *parser) parseGrantRoleStatement(startTok token.Token, isRevoke bool) (ast.Statement, error) { + p.advance() // ROLE + roles, err := p.parseIdentifierList() + if err != nil { + return nil, err + } + term := "TO" + if isRevoke { + term = "FROM" + } + if _, err := p.expectKeyword(term); err != nil { + return nil, err + } + if _, err := p.expectKeyword("ROLE"); err != nil { + return nil, err + } + grantees, err := p.parseIdentifierList() + if err != nil { + return nil, err + } + return &ast.GrantRoleStatement{Span: span(startTok.Pos, grantees.End()), IsRevoke: isRevoke, Roles: roles, Grantees: grantees}, nil +} + +// parseGrantOnAllInSchema parses the Spanner object clause "ALL kind IN SCHEMA +// schema, ..." after ON, where kind is a plural object type such as TABLES. +// ALL is the next token. +func (p *parser) parseGrantOnAllInSchema() (*ast.Identifier, *ast.PathExpressionList, error) { + p.advance() // ALL + kind, err := p.parseIdentifier() + if err != nil { + return nil, nil, err + } + if _, err := p.expectKeyword("IN"); err != nil { + return nil, nil, err + } + if _, err := p.expectKeyword("SCHEMA"); err != nil { + return nil, nil, err + } + objects, err := p.parseGrantObjectList() + if err != nil { + return nil, nil, err + } + return kind, objects, nil +} + +// parseGrantObjectList parses the comma-separated object names of a Spanner +// GRANT/REVOKE. +func (p *parser) parseGrantObjectList() (*ast.PathExpressionList, error) { + list := &ast.PathExpressionList{} + for { + path, err := p.parseGrantObjectPath() + if err != nil { + return nil, err + } + list.Paths = append(list.Paths, path) + if p.peek().Kind != token.COMMA { + break + } + p.advance() // , + } + list.Span = span(list.Paths[0].Pos(), list.Paths[len(list.Paths)-1].End()) + return list, nil +} + +// parseSpannerIndexSuffix parses the clauses of a Spanner CREATE [SEARCH | +// VECTOR] INDEX after STORING: "[PARTITION BY ...] [ORDER BY ...] [WHERE +// expression] [, INTERLEAVE IN path] [OPTIONS (...)]", also accepting the +// GoogleSQL order with OPTIONS before ", INTERLEAVE IN". +func (p *parser) parseSpannerIndexSuffix(stmt *ast.CreateIndexStatement) (ast.Statement, error) { + var err error + if isKeyword(p.peek(), "PARTITION") { + if stmt.PartitionBy, err = p.parseIndexPartitionBy(); err != nil { + return nil, err + } + stmt.Stop = stmt.PartitionBy.End() + } + if isKeyword(p.peek(), "ORDER") { + if stmt.OrderBy, err = p.parseOrderBy(false); err != nil { + return nil, err + } + stmt.Stop = stmt.OrderBy.End() + } + if isKeyword(p.peek(), "WHERE") { + whereTok := p.advance() // WHERE + expr, err := p.parseExpression() + if err != nil { + return nil, err + } + stmt.Where = &ast.WhereClause{Span: span(whereTok.Pos, p.extEnd(expr)), Expr: expr} + stmt.Stop = stmt.Where.End() + } + parseInterleave := func() error { + if p.peek().Kind != token.COMMA || !isKeyword(p.peekAt(1), "INTERLEAVE") || !isKeyword(p.peekAt(2), "IN") { + return nil + } + commaTok := p.advance() // , + p.advance() // INTERLEAVE + p.advance() // IN + path, err := p.parseMaybeDashedPathExpression() + if err != nil { + return err + } + stmt.SpannerInterleave = &ast.SpannerInterleaveClause{Span: span(commaTok.Pos, path.End()), TableName: path, Type: "IN"} + stmt.Stop = max(stmt.Stop, path.End()) + return nil + } + if err := parseInterleave(); err != nil { + return nil, err + } + if isKeyword(p.peek(), "OPTIONS") { + p.advance() // OPTIONS + if stmt.Options, err = p.parseOptionsList(); err != nil { + return nil, err + } + stmt.Stop = stmt.Options.End() + } + if stmt.SpannerInterleave == nil { + if err := parseInterleave(); err != nil { + return nil, err + } + } + return stmt, nil +} diff --git a/parser/spanner_test.go b/parser/spanner_test.go new file mode 100644 index 0000000..da3ca9c --- /dev/null +++ b/parser/spanner_test.go @@ -0,0 +1,89 @@ +package parser_test + +import ( + "crypto/sha256" + "encoding/hex" + "io/fs" + "os" + "path/filepath" + "strings" + "testing" + + "github.com/sqlc-dev/zetajones/parser" +) + +// spannerDDLFeatures is the feature set the Spanner-only backlog is parsed +// with: the corpus's reference features plus zetajones's SPANNER_DDL. +const spannerDDLFeatures = "MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SPANNER_DDL" + +// spannerOnlyStatement is one statement of a generated *.spanner.sql file. +type spannerOnlyStatement struct { + id, sql string +} + +// readSpannerOnlyStatements splits a *.spanner.sql file (written by +// writeRejects in cmd/spanner-corpus) into its statements. Each block is a +// "# " line, a "# id [: note]" line, a "# " line, then the SQL +// followed by ";". +func readSpannerOnlyStatements(t *testing.T, path string) []spannerOnlyStatement { + t.Helper() + data, err := os.ReadFile(path) + if err != nil { + t.Fatal(err) + } + var out []spannerOnlyStatement + blocks := strings.Split(string(data), "\n# https://") + for _, block := range blocks[1:] { + lines := strings.SplitN(block, "\n", 4) + if len(lines) < 4 || !strings.HasPrefix(lines[1], "# id ") { + t.Fatalf("%s: malformed block:\n%s", path, block) + } + id, _, _ := strings.Cut(strings.TrimPrefix(lines[1], "# id "), ":") + sql := strings.TrimSuffix(strings.TrimRight(lines[3], "\n"), ";") + // The id is a hash of the SQL (stmtID in cmd/spanner-corpus), so this + // catches any drift between the file format and this reader. + sum := sha256.Sum256([]byte(sql)) + if got := hex.EncodeToString(sum[:])[:12]; got != id { + t.Fatalf("%s: id %s does not match its SQL (hash %s):\n%s", path, id, got, sql) + } + out = append(out, spannerOnlyStatement{id: id, sql: sql}) + } + return out +} + +// TestSpannerOnlySyntax checks that every statement in the Spanner-only +// backlog (testdata/spanner/**/*.spanner.sql, syntax the reference parser +// rejects) parses with SPANNER_DDL and is still rejected without it. Expected +// trees for this syntax live in testdata/extensions/spanner. +func TestSpannerOnlySyntax(t *testing.T) { + var files []string + err := filepath.WalkDir(filepath.Join("testdata", "spanner"), func(path string, d fs.DirEntry, err error) error { + if err == nil && strings.HasSuffix(path, ".spanner.sql") { + files = append(files, path) + } + return err + }) + if err != nil { + t.Fatal(err) + } + if len(files) == 0 { + t.Fatal("no .spanner.sql files found") + } + with := parser.Options{Features: parser.ParseFeatureSet(spannerDDLFeatures)} + without := parser.Options{Features: parser.ParseFeatureSet(spannerDDLFeatures + ",-SPANNER_DDL")} + for _, path := range files { + for _, st := range readSpannerOnlyStatements(t, path) { + name := strings.TrimSuffix(strings.TrimPrefix(path, filepath.Join("testdata", "spanner")+string(filepath.Separator)), ".spanner.sql") + "/" + st.id + t.Run(name, func(t *testing.T) { + // The corpus runs these in script mode when they have + // comments or several statements; script mode accepts both. + if _, err := parser.ParseScriptWithOptions(st.sql+"\n", with); err != nil { + t.Errorf("parse with SPANNER_DDL failed:\n%s\n\n%v", st.sql, err) + } + if _, err := parser.ParseScriptWithOptions(st.sql+"\n", without); err == nil { + t.Errorf("parse without SPANNER_DDL succeeded:\n%s", st.sql) + } + }) + } + } +} diff --git a/parser/testdata/extensions/spanner/change_streams.test b/parser/testdata/extensions/spanner/change_streams.test new file mode 100644 index 0000000..7a185b5 --- /dev/null +++ b/parser/testdata/extensions/spanner/change_streams.test @@ -0,0 +1,103 @@ +# Hand-written expected parse trees for Cloud Spanner DDL that GoogleSQL's +# reference parser rejects, enabled by zetajones's SPANNER_DDL feature. These +# are not vendored and not generated: there is no reference output, so each +# tree was reviewed by hand. See "Spanner Extensions" in CLAUDE.md and the +# node shapes in ast/spanner.go. +# +# Change streams. +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SPANNER_DDL] +CREATE CHANGE STREAM s +-- +CreateChangeStreamStatement [0-22] [CREATE CHANGE STREAM s] + PathExpression [21-22] [s] + Identifier(s) [21-22] [s] +== +CREATE CHANGE STREAM s FOR ALL OPTIONS (retention_period = "36h") +-- +CreateChangeStreamStatement [0-65] [CREATE CHANGE...eriod = "36h")] + PathExpression [21-22] [s] + Identifier(s) [21-22] [s] + ChangeStreamForClause(all) [23-30] [FOR ALL] + OptionsList [39-65] [(retention_period = "36h")] + OptionsEntry [40-64] [retention_period = "36h"] + Identifier(retention_period) [40-56] [retention_period] + StringLiteral [59-64] ["36h"] + StringLiteralComponent("36h") [59-64] ["36h"] +== +CREATE CHANGE STREAM IF NOT EXISTS s FOR a(x, y), b, c() +-- +CreateChangeStreamStatement(is_if_not_exists) [0-56] [CREATE CHANGE...y), b, c()] + PathExpression [35-36] [s] + Identifier(s) [35-36] [s] + ChangeStreamForClause [37-56] [FOR a(x, y), b, c()] + ChangeStreamTrackedTable [41-48] [a(x, y)] + PathExpression [41-42] [a] + Identifier(a) [41-42] [a] + ColumnList [42-48] [(x, y)] + Identifier(x) [43-44] [x] + Identifier(y) [46-47] [y] + ChangeStreamTrackedTable [50-51] [b] + PathExpression [50-51] [b] + Identifier(b) [50-51] [b] + ChangeStreamTrackedTable [53-56] [c()] + PathExpression [53-54] [c] + Identifier(c) [53-54] [c] + ColumnList [54-56] [()] +== +[language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP] +CREATE CHANGE STREAM s FOR ALL +-- +ERROR: CHANGE is not a supported object type [at 1:8] +CREATE CHANGE STREAM s FOR ALL + ^ +== +ALTER CHANGE STREAM s SET FOR a(x), b +-- +AlterChangeStreamStatement [0-37] [ALTER CHANGE...FOR a(x), b] + PathExpression [20-21] [s] + Identifier(s) [20-21] [s] + AlterActionList [22-37] [SET FOR a(x), b] + SetChangeStreamForAction [22-37] [SET FOR a(x), b] + ChangeStreamForClause [26-37] [FOR a(x), b] + ChangeStreamTrackedTable [30-34] [a(x)] + PathExpression [30-31] [a] + Identifier(a) [30-31] [a] + ColumnList [31-34] [(x)] + Identifier(x) [32-33] [x] + ChangeStreamTrackedTable [36-37] [b] + PathExpression [36-37] [b] + Identifier(b) [36-37] [b] +== +ALTER CHANGE STREAM s SET OPTIONS (retention_period = "36h") +-- +AlterChangeStreamStatement [0-60] [ALTER CHANGE...period = "36h")] + PathExpression [20-21] [s] + Identifier(s) [20-21] [s] + AlterActionList [22-60] [SET OPTIONS..._period = "36h")] + SetOptionsAction [22-60] [SET OPTIONS..._period = "36h")] + OptionsList [34-60] [(retention_period = "36h")] + OptionsEntry [35-59] [retention_period = "36h"] + Identifier(retention_period) [35-51] [retention_period] + StringLiteral [54-59] ["36h"] + StringLiteralComponent("36h") [54-59] ["36h"] +== +ALTER CHANGE STREAM s DROP FOR ALL +-- +AlterChangeStreamStatement [0-34] [ALTER CHANGE...DROP FOR ALL] + PathExpression [20-21] [s] + Identifier(s) [20-21] [s] + AlterActionList [22-34] [DROP FOR ALL] + DropChangeStreamForAllAction [22-34] [DROP FOR ALL] +== +DROP CHANGE STREAM s +-- +DropStatement CHANGE STREAM [0-20] [DROP CHANGE STREAM s] + PathExpression [19-20] [s] + Identifier(s) [19-20] [s] +== +[language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP] +DROP CHANGE STREAM s +-- +ERROR: CHANGE is not a supported object type [at 1:6] +DROP CHANGE STREAM s + ^ diff --git a/parser/testdata/extensions/spanner/columns.test b/parser/testdata/extensions/spanner/columns.test new file mode 100644 index 0000000..b446a7f --- /dev/null +++ b/parser/testdata/extensions/spanner/columns.test @@ -0,0 +1,190 @@ +# Hand-written expected parse trees for Cloud Spanner DDL that GoogleSQL's +# reference parser rejects, enabled by zetajones's SPANNER_DDL feature. These +# are not vendored and not generated: there is no reference output, so each +# tree was reviewed by hand. See "Spanner Extensions" in CLAUDE.md and the +# node shapes in ast/spanner.go. +# +# Spanner column definitions. Attributes before the DEFAULT or generated +# clause (NOT NULL) and after it (HIDDEN, PLACEMENT KEY, ...) form one +# ColumnAttributeList that follows the DEFAULT/generated child, as the +# reference's SpannerAlterColumnAction orders them. +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SPANNER_DDL] +CREATE TABLE t (a INT64 NOT NULL DEFAULT (1)) PRIMARY KEY (a) +-- +CreateTableStatement [0-61] [CREATE TABLE...PRIMARY KEY (a)] + PathExpression [13-14] [t] + Identifier(t) [13-14] [t] + TableElementList [15-45] [(a INT64 NOT NULL DEFAULT (1))] + ColumnDefinition [16-44] [a INT64 NOT NULL DEFAULT (1)] + Identifier(a) [16-17] [a] + SimpleColumnSchema [18-44] [INT64 NOT NULL DEFAULT (1)] + PathExpression [18-23] [INT64] + Identifier(INT64) [18-23] [INT64] + IntLiteral(1) [42-43] [1] + ColumnAttributeList [24-32] [NOT NULL] + NotNullColumnAttribute [24-32] [NOT NULL] + SpannerTableOptions [46-61] [PRIMARY KEY (a)] + PrimaryKey(ENFORCED) [46-61] [PRIMARY KEY (a)] + PrimaryKeyElementList [58-61] [(a)] + PrimaryKeyElement(ASC) [59-60] [a] + Identifier(a) [59-60] [a] +== +CREATE TABLE t (a INT64 NOT NULL AS (b + 1) STORED, b INT64) PRIMARY KEY (a) +-- +CreateTableStatement [0-76] [CREATE TABLE...PRIMARY KEY (a)] + PathExpression [13-14] [t] + Identifier(t) [13-14] [t] + TableElementList [15-60] [(a INT64 NOT..., b INT64)] + ColumnDefinition [16-50] [a INT64 NOT...1) STORED] + Identifier(a) [16-17] [a] + SimpleColumnSchema [18-50] [INT64 NOT...1) STORED] + PathExpression [18-23] [INT64] + Identifier(INT64) [18-23] [INT64] + GeneratedColumnInfo(generated_mode=ALWAYS, stored_mode=STORED) [33-50] [AS (b + 1) STORED] + BinaryExpression(+) [37-42] [b + 1] + PathExpression [37-38] [b] + Identifier(b) [37-38] [b] + IntLiteral(1) [41-42] [1] + ColumnAttributeList [24-32] [NOT NULL] + NotNullColumnAttribute [24-32] [NOT NULL] + ColumnDefinition [52-59] [b INT64] + Identifier(b) [52-53] [b] + SimpleColumnSchema [54-59] [INT64] + PathExpression [54-59] [INT64] + Identifier(INT64) [54-59] [INT64] + SpannerTableOptions [61-76] [PRIMARY KEY (a)] + PrimaryKey(ENFORCED) [61-76] [PRIMARY KEY (a)] + PrimaryKeyElementList [73-76] [(a)] + PrimaryKeyElement(ASC) [74-75] [a] + Identifier(a) [74-75] [a] +== +CREATE TABLE t (a TIMESTAMP NOT NULL DEFAULT (PENDING_COMMIT_TIMESTAMP()) ON UPDATE (PENDING_COMMIT_TIMESTAMP()) OPTIONS (allow_commit_timestamp = true)) PRIMARY KEY (a) +-- +CreateTableStatement [0-169] [CREATE TABLE...PRIMARY KEY (a)] + PathExpression [13-14] [t] + Identifier(t) [13-14] [t] + TableElementList [15-153] [(a TIMESTAMP...estamp = true))] + ColumnDefinition [16-152] [a TIMESTAMP...imestamp = true)] + Identifier(a) [16-17] [a] + SimpleColumnSchema [18-152] [TIMESTAMP..._timestamp = true)] + PathExpression [18-27] [TIMESTAMP] + Identifier(TIMESTAMP) [18-27] [TIMESTAMP] + FunctionCall [46-72] [PENDING_COMMIT_TIMESTAMP()] + PathExpression [46-70] [PENDING_COMMIT_TIMESTAMP] + Identifier(PENDING_COMMIT_TIMESTAMP) [46-70] [PENDING_COMMIT_TIMESTAMP] + ColumnOnUpdateClause [74-112] [ON UPDATE...OMMIT_TIMESTAMP())] + FunctionCall [85-111] [PENDING_COMMIT_TIMESTAMP()] + PathExpression [85-109] [PENDING_COMMIT_TIMESTAMP] + Identifier(PENDING_COMMIT_TIMESTAMP) [85-109] [PENDING_COMMIT_TIMESTAMP] + ColumnAttributeList [28-36] [NOT NULL] + NotNullColumnAttribute [28-36] [NOT NULL] + OptionsList [121-152] [(allow_commit_tim...mp = true)] + OptionsEntry [122-151] [allow_commit_timestamp = true] + Identifier(allow_commit_timestamp) [122-144] [allow_commit_timestamp] + BooleanLiteral(true) [147-151] [true] + SpannerTableOptions [154-169] [PRIMARY KEY (a)] + PrimaryKey(ENFORCED) [154-169] [PRIMARY KEY (a)] + PrimaryKeyElementList [166-169] [(a)] + PrimaryKeyElement(ASC) [167-168] [a] + Identifier(a) [167-168] [a] +== +CREATE TABLE t (a STRING(MAX) NOT NULL PLACEMENT KEY) PRIMARY KEY (a) +-- +CreateTableStatement [0-69] [CREATE TABLE...PRIMARY KEY (a)] + PathExpression [13-14] [t] + Identifier(t) [13-14] [t] + TableElementList [15-53] [(a STRING(...PLACEMENT KEY)] + ColumnDefinition [16-52] [a STRING(MAX...PLACEMENT KEY] + Identifier(a) [16-17] [a] + SimpleColumnSchema [18-52] [STRING(MAX...PLACEMENT KEY] + PathExpression [18-24] [STRING] + Identifier(STRING) [18-24] [STRING] + TypeParameterList [24-28] [(MAX] + MaxLiteral() [25-28] [MAX] + ColumnAttributeList [30-52] [NOT NULL PLACEMENT KEY] + NotNullColumnAttribute [30-38] [NOT NULL] + PlacementKeyColumnAttribute [39-52] [PLACEMENT KEY] + SpannerTableOptions [54-69] [PRIMARY KEY (a)] + PrimaryKey(ENFORCED) [54-69] [PRIMARY KEY (a)] + PrimaryKeyElementList [66-69] [(a)] + PrimaryKeyElement(ASC) [67-68] [a] + Identifier(a) [67-68] [a] +== +CREATE TABLE t (a INT64 AUTO_INCREMENT PRIMARY KEY) +-- +CreateTableStatement [0-51] [CREATE TABLE...PRIMARY KEY)] + PathExpression [13-14] [t] + Identifier(t) [13-14] [t] + TableElementList [15-51] [(a INT64 AUTO_INC...IMARY KEY)] + ColumnDefinition [16-50] [a INT64 AUTO_INCR...RIMARY KEY] + Identifier(a) [16-17] [a] + SimpleColumnSchema [18-50] [INT64 AUTO_INCREM...RIMARY KEY] + PathExpression [18-23] [INT64] + Identifier(INT64) [18-23] [INT64] + ColumnAttributeList [24-50] [AUTO_INCREMENT PRIMARY KEY] + AutoIncrementColumnAttribute [24-38] [AUTO_INCREMENT] + PrimaryKeyColumnAttribute(ENFORCED) [39-50] [PRIMARY KEY] +== +CREATE TABLE t (a ARRAY(vector_length=>128) NOT NULL) PRIMARY KEY (a) +-- +CreateTableStatement [0-78] [CREATE TABLE...PRIMARY KEY (a)] + PathExpression [13-14] [t] + Identifier(t) [13-14] [t] + TableElementList [15-62] [(a ARRAY128] + NamedArgument [33-51] [vector_length=>128] + Identifier(vector_length) [33-46] [vector_length] + IntLiteral(128) [48-51] [128] + ColumnAttributeList [53-61] [NOT NULL] + NotNullColumnAttribute [53-61] [NOT NULL] + SpannerTableOptions [63-78] [PRIMARY KEY (a)] + PrimaryKey(ENFORCED) [63-78] [PRIMARY KEY (a)] + PrimaryKeyElementList [75-78] [(a)] + PrimaryKeyElement(ASC) [76-77] [a] + Identifier(a) [76-77] [a] +== +[language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP] +CREATE TABLE t (a INT64 NOT NULL DEFAULT (1)) PRIMARY KEY (a) +-- +ERROR: Syntax error: Expected ")" or "," but got keyword DEFAULT [at 1:34] +CREATE TABLE t (a INT64 NOT NULL DEFAULT (1)) PRIMARY KEY (a) + ^ +== +[language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP] +CREATE TABLE t (a ARRAY(vector_length=>128)) PRIMARY KEY (a) +-- +ERROR: Syntax error: Unexpected identifier "vector_length" [at 1:34] +CREATE TABLE t (a ARRAY(vector_length=>128)) PRIMARY KEY (a) + ^ +== +# A non-stored generated column in ALTER COLUMN. +ALTER TABLE t ALTER COLUMN a STRING(100) AS (b) +-- +AlterTableStatement [0-47] [ALTER TABLE...100) AS (b)] + PathExpression [12-13] [t] + Identifier(t) [12-13] [t] + AlterActionList [14-47] [ALTER COLUMN...100) AS (b)] + SpannerAlterColumnAction [14-47] [ALTER COLUMN...100) AS (b)] + ColumnDefinition [27-47] [a STRING(100) AS (b)] + Identifier(a) [27-28] [a] + SimpleColumnSchema [29-47] [STRING(100) AS (b)] + PathExpression [29-35] [STRING] + Identifier(STRING) [29-35] [STRING] + TypeParameterList [35-39] [(100] + IntLiteral(100) [36-39] [100] + GeneratedColumnInfo(generated_mode=ALWAYS) [41-47] [AS (b)] + PathExpression [45-46] [b] + Identifier(b) [45-46] [b] +== +[language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP] +ALTER TABLE t ALTER COLUMN a STRING(100) AS (b) +-- +ERROR: Syntax error: Expected keyword STORED but got end of statement [at 1:48] +ALTER TABLE t ALTER COLUMN a STRING(100) AS (b) + ^ diff --git a/parser/testdata/extensions/spanner/entities.test b/parser/testdata/extensions/spanner/entities.test new file mode 100644 index 0000000..429a8ab --- /dev/null +++ b/parser/testdata/extensions/spanner/entities.test @@ -0,0 +1,136 @@ +# Hand-written expected parse trees for Cloud Spanner DDL that GoogleSQL's +# reference parser rejects, enabled by zetajones's SPANNER_DDL feature. These +# are not vendored and not generated: there is no reference output, so each +# tree was reviewed by hand. See "Spanner Extensions" in CLAUDE.md and the +# node shapes in ast/spanner.go. +# +# Roles and placements are generic entities, and table synonyms generic +# sub-entities: SPANNER_DDL adds ROLE and PLACEMENT to the supported generic +# entity types and SYNONYM to the sub-entity types. +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SPANNER_DDL] +CREATE ROLE r +-- +CreateEntityStatement [0-13] [CREATE ROLE r] + Identifier(ROLE) [7-11] [ROLE] + PathExpression [12-13] [r] + Identifier(r) [12-13] [r] +== +DROP ROLE r +-- +DropEntityStatement [0-11] [DROP ROLE r] + Identifier(ROLE) [5-9] [ROLE] + PathExpression [10-11] [r] + Identifier(r) [10-11] [r] +== +CREATE PLACEMENT p OPTIONS (instance_partition = "europe-partition") +-- +CreateEntityStatement [0-68] [CREATE PLACEMENT...partition")] + Identifier(PLACEMENT) [7-16] [PLACEMENT] + PathExpression [17-18] [p] + Identifier(p) [17-18] [p] + OptionsList [27-68] [(instance_partiti...artition")] + OptionsEntry [28-67] [instance_partitio...partition"] + Identifier(instance_partition) [28-46] [instance_partition] + StringLiteral [49-67] ["europe-partition"] + StringLiteralComponent("europe-partition") [49-67] ["europe-partition"] +== +DROP PLACEMENT p +-- +DropEntityStatement [0-16] [DROP PLACEMENT p] + Identifier(PLACEMENT) [5-14] [PLACEMENT] + PathExpression [15-16] [p] + Identifier(p) [15-16] [p] +== +[language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP] +CREATE ROLE r +-- +ERROR: ROLE is not a supported object type [at 1:8] +CREATE ROLE r + ^ +== +ALTER TABLE t ADD SYNONYM s +-- +AlterTableStatement [0-27] [ALTER TABLE t ADD SYNONYM s] + PathExpression [12-13] [t] + Identifier(t) [12-13] [t] + AlterActionList [14-27] [ADD SYNONYM s] + AddSubEntityAction [14-27] [ADD SYNONYM s] + Identifier(SYNONYM) [18-25] [SYNONYM] + Identifier(s) [26-27] [s] +== +ALTER TABLE t DROP SYNONYM s +-- +AlterTableStatement [0-28] [ALTER TABLE t DROP SYNONYM s] + PathExpression [12-13] [t] + Identifier(t) [12-13] [t] + AlterActionList [14-28] [DROP SYNONYM s] + DropSubEntityAction [14-28] [DROP SYNONYM s] + Identifier(SYNONYM) [19-26] [SYNONYM] + Identifier(s) [27-28] [s] +== +ALTER TABLE t RENAME TO u, ADD SYNONYM t +-- +AlterTableStatement [0-40] [ALTER TABLE...SYNONYM t] + PathExpression [12-13] [t] + Identifier(t) [12-13] [t] + AlterActionList [14-40] [RENAME TO u, ADD SYNONYM t] + RenameToClause [14-25] [RENAME TO u] + PathExpression [24-25] [u] + Identifier(u) [24-25] [u] + AddSubEntityAction [27-40] [ADD SYNONYM t] + Identifier(SYNONYM) [31-38] [SYNONYM] + Identifier(t) [39-40] [t] +== +# Several renames: further pairs follow the first in RenameStatement. +RENAME TABLE a TO b, c TO d +-- +RenameStatement [0-27] [RENAME TABLE a TO b, c TO d] + Identifier(TABLE) [7-12] [TABLE] + PathExpression [13-14] [a] + Identifier(a) [13-14] [a] + PathExpression [18-19] [b] + Identifier(b) [18-19] [b] + PathExpression [21-22] [c] + Identifier(c) [21-22] [c] + PathExpression [26-27] [d] + Identifier(d) [26-27] [d] +== +[language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP] +RENAME TABLE a TO b, c TO d +-- +ERROR: Syntax error: Expected end of input but got "," [at 1:20] +RENAME TABLE a TO b, c TO d + ^ +== +# Database ids may contain dashes. +ALTER DATABASE example-db SET OPTIONS (x = 1) +-- +AlterDatabaseStatement [0-45] [ALTER DATABASE...TIONS (x = 1)] + PathExpression [15-25] [example-db] + Identifier(`example-db`) [15-25] [example-db] + AlterActionList [26-45] [SET OPTIONS (x = 1)] + SetOptionsAction [26-45] [SET OPTIONS (x = 1)] + OptionsList [38-45] [(x = 1)] + OptionsEntry [39-44] [x = 1] + Identifier(x) [39-40] [x] + IntLiteral(1) [43-44] [1] +== +# OPTIONS lists may end in a comma. +ALTER DATABASE db SET OPTIONS (x = 1,) +-- +AlterDatabaseStatement [0-38] [ALTER DATABASE...IONS (x = 1,)] + PathExpression [15-17] [db] + Identifier(db) [15-17] [db] + AlterActionList [18-38] [SET OPTIONS (x = 1,)] + SetOptionsAction [18-38] [SET OPTIONS (x = 1,)] + OptionsList [30-38] [(x = 1,)] + OptionsEntry [31-36] [x = 1] + Identifier(x) [31-32] [x] + IntLiteral(1) [35-36] [1] +== +[language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP] +ALTER DATABASE db SET OPTIONS (x = 1,) +-- +ERROR: Syntax error: Unexpected ")" [at 1:38] +ALTER DATABASE db SET OPTIONS (x = 1,) + ^ diff --git a/parser/testdata/extensions/spanner/grant.test b/parser/testdata/extensions/spanner/grant.test new file mode 100644 index 0000000..819c929 --- /dev/null +++ b/parser/testdata/extensions/spanner/grant.test @@ -0,0 +1,175 @@ +# Hand-written expected parse trees for Cloud Spanner DDL that GoogleSQL's +# reference parser rejects, enabled by zetajones's SPANNER_DDL feature. These +# are not vendored and not generated: there is no reference output, so each +# tree was reviewed by hand. See "Spanner Extensions" in CLAUDE.md and the +# node shapes in ast/spanner.go. +# +# Fine-grained access control GRANT/REVOKE. Privileges reuse the reference +# Privileges node; objects are a PathExpressionList and grantee roles an +# IdentifierList. +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SPANNER_DDL] +GRANT SELECT ON TABLE t TO ROLE r +-- +GrantToRoleStatement [0-33] [GRANT SELECT...TO ROLE r] + Privileges [6-12] [SELECT] + Privilege [6-12] [SELECT] + Identifier(`SELECT`) [6-12] [SELECT] + Identifier(TABLE) [16-21] [TABLE] + PathExpressionList [22-23] [t] + PathExpression [22-23] [t] + Identifier(t) [22-23] [t] + IdentifierList [32-33] [r] + Identifier(r) [32-33] [r] +== +GRANT SELECT(a, b), UPDATE(c), INSERT ON TABLE t, u TO ROLE r1, r2 +-- +GrantToRoleStatement [0-66] [GRANT SELECT...ROLE r1, r2] + Privileges [6-37] [SELECT(a,...c), INSERT] + Privilege [6-18] [SELECT(a, b)] + Identifier(`SELECT`) [6-12] [SELECT] + PathExpressionList [12-18] [(a, b)] + PathExpression [13-14] [a] + Identifier(a) [13-14] [a] + PathExpression [16-17] [b] + Identifier(b) [16-17] [b] + Privilege [20-29] [UPDATE(c)] + Identifier(`UPDATE`) [20-26] [UPDATE] + PathExpressionList [26-29] [(c)] + PathExpression [27-28] [c] + Identifier(c) [27-28] [c] + Privilege [31-37] [INSERT] + Identifier(INSERT) [31-37] [INSERT] + Identifier(TABLE) [41-46] [TABLE] + PathExpressionList [47-51] [t, u] + PathExpression [47-48] [t] + Identifier(t) [47-48] [t] + PathExpression [50-51] [u] + Identifier(u) [50-51] [u] + IdentifierList [60-66] [r1, r2] + Identifier(r1) [60-62] [r1] + Identifier(r2) [64-66] [r2] +== +REVOKE DELETE ON TABLE t FROM ROLE r +-- +RevokeFromRoleStatement [0-36] [REVOKE DELETE...FROM ROLE r] + Privileges [7-13] [DELETE] + Privilege [7-13] [DELETE] + Identifier(DELETE) [7-13] [DELETE] + Identifier(TABLE) [17-22] [TABLE] + PathExpressionList [23-24] [t] + PathExpression [23-24] [t] + Identifier(t) [23-24] [t] + IdentifierList [35-36] [r] + Identifier(r) [35-36] [r] +== +GRANT EXECUTE ON TABLE FUNCTION f TO ROLE r +-- +GrantToRoleStatement [0-43] [GRANT EXECUTE...TO ROLE r] + Privileges [6-13] [EXECUTE] + Privilege [6-13] [EXECUTE] + Identifier(EXECUTE) [6-13] [EXECUTE] + Identifier(TABLE) [17-22] [TABLE] + Identifier(`FUNCTION`) [23-31] [FUNCTION] + PathExpressionList [32-33] [f] + PathExpression [32-33] [f] + Identifier(f) [32-33] [f] + IdentifierList [42-43] [r] + Identifier(r) [42-43] [r] +== +GRANT SELECT ON CHANGE STREAM s TO ROLE r +-- +GrantToRoleStatement [0-41] [GRANT SELECT...TO ROLE r] + Privileges [6-12] [SELECT] + Privilege [6-12] [SELECT] + Identifier(`SELECT`) [6-12] [SELECT] + Identifier(CHANGE) [16-22] [CHANGE] + Identifier(STREAM) [23-29] [STREAM] + PathExpressionList [30-31] [s] + PathExpression [30-31] [s] + Identifier(s) [30-31] [s] + IdentifierList [40-41] [r] + Identifier(r) [40-41] [r] +== +GRANT USAGE ON SCHEMA default TO ROLE r +-- +GrantToRoleStatement [0-39] [GRANT USAGE...TO ROLE r] + Privileges [6-11] [USAGE] + Privilege [6-11] [USAGE] + Identifier(USAGE) [6-11] [USAGE] + Identifier(SCHEMA) [15-21] [SCHEMA] + PathExpressionList [22-29] [default] + PathExpression [22-29] [default] + Identifier(`default`) [22-29] [default] + IdentifierList [38-39] [r] + Identifier(r) [38-39] [r] +== +GRANT SELECT ON ALL TABLES IN SCHEMA s TO ROLE r +-- +GrantToRoleStatement(all_in_schema) [0-48] [GRANT SELECT...TO ROLE r] + Privileges [6-12] [SELECT] + Privilege [6-12] [SELECT] + Identifier(`SELECT`) [6-12] [SELECT] + Identifier(TABLES) [20-26] [TABLES] + PathExpressionList [37-38] [s] + PathExpression [37-38] [s] + Identifier(s) [37-38] [s] + IdentifierList [47-48] [r] + Identifier(r) [47-48] [r] +== +REVOKE SELECT ON ALL SEQUENCES IN SCHEMA s FROM ROLE r +-- +RevokeFromRoleStatement(all_in_schema) [0-54] [REVOKE SELECT...FROM ROLE r] + Privileges [7-13] [SELECT] + Privilege [7-13] [SELECT] + Identifier(`SELECT`) [7-13] [SELECT] + Identifier(SEQUENCES) [21-30] [SEQUENCES] + PathExpressionList [41-42] [s] + PathExpression [41-42] [s] + Identifier(s) [41-42] [s] + IdentifierList [53-54] [r] + Identifier(r) [53-54] [r] +== +GRANT ROLE a, b TO ROLE c +-- +GrantRoleStatement [0-25] [GRANT ROLE a, b TO ROLE c] + IdentifierList [11-15] [a, b] + Identifier(a) [11-12] [a] + Identifier(b) [14-15] [b] + IdentifierList [24-25] [c] + Identifier(c) [24-25] [c] +== +REVOKE ROLE a FROM ROLE public +-- +RevokeRoleStatement [0-30] [REVOKE ROLE a FROM ROLE public] + IdentifierList [12-13] [a] + Identifier(a) [12-13] [a] + IdentifierList [24-30] [public] + Identifier(public) [24-30] [public] +== +# String grantees are still the reference GrantStatement. +GRANT SELECT ON TABLE t TO 'user@example.com' +-- +GrantStatement [0-45] [GRANT SELECT...example.com'] + Privileges [6-12] [SELECT] + Privilege [6-12] [SELECT] + Identifier(`SELECT`) [6-12] [SELECT] + Identifier(TABLE) [16-21] [TABLE] + PathExpression [22-23] [t] + Identifier(t) [22-23] [t] + GranteeList [27-45] ['user@example.com'] + StringLiteral [27-45] ['user@example.com'] + StringLiteralComponent('user@example.com') [27-45] ['user@example.com'] +== +[language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP] +GRANT SELECT ON TABLE t TO ROLE r +-- +ERROR: Syntax error: Expected "@" or "@@" or string literal but got identifier "ROLE" [at 1:28] +GRANT SELECT ON TABLE t TO ROLE r + ^ +== +[language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP] +GRANT ROLE a TO ROLE c +-- +ERROR: Syntax error: Expected keyword ON but got identifier "a" [at 1:12] +GRANT ROLE a TO ROLE c + ^ diff --git a/parser/testdata/extensions/spanner/identity.test b/parser/testdata/extensions/spanner/identity.test new file mode 100644 index 0000000..3326ed8 --- /dev/null +++ b/parser/testdata/extensions/spanner/identity.test @@ -0,0 +1,122 @@ +# Hand-written expected parse trees for Cloud Spanner DDL that GoogleSQL's +# reference parser rejects, enabled by zetajones's SPANNER_DDL feature. These +# are not vendored and not generated: there is no reference output, so each +# tree was reviewed by hand. See "Spanner Extensions" in CLAUDE.md and the +# node shapes in ast/spanner.go. +# +# Spanner identity columns: a bare IDENTITY, a sequence kind, SKIP RANGE and +# START COUNTER WITH (which reuses IdentityColumnStartWith), and ALTER +# IDENTITY. +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SPANNER_DDL] +CREATE TABLE t (a INT64 GENERATED BY DEFAULT AS IDENTITY) PRIMARY KEY (a) +-- +CreateTableStatement [0-73] [CREATE TABLE...PRIMARY KEY (a)] + PathExpression [13-14] [t] + Identifier(t) [13-14] [t] + TableElementList [15-57] [(a INT64 GENERATE...IDENTITY)] + ColumnDefinition [16-56] [a INT64 GENERATED...S IDENTITY] + Identifier(a) [16-17] [a] + SimpleColumnSchema [18-56] [INT64 GENERATED...AS IDENTITY] + PathExpression [18-23] [INT64] + Identifier(INT64) [18-23] [INT64] + GeneratedColumnInfo(generated_mode=BY_DEFAULT) [24-56] [GENERATED...AS IDENTITY] + IdentityColumnInfo [48-56] [IDENTITY] + SpannerTableOptions [58-73] [PRIMARY KEY (a)] + PrimaryKey(ENFORCED) [58-73] [PRIMARY KEY (a)] + PrimaryKeyElementList [70-73] [(a)] + PrimaryKeyElement(ASC) [71-72] [a] + Identifier(a) [71-72] [a] +== +CREATE TABLE t (a INT64 GENERATED BY DEFAULT AS IDENTITY (BIT_REVERSED_POSITIVE START COUNTER WITH 1000 SKIP RANGE 1, 10)) PRIMARY KEY (a) +-- +CreateTableStatement [0-138] [CREATE TABLE...PRIMARY KEY (a)] + PathExpression [13-14] [t] + Identifier(t) [13-14] [t] + TableElementList [15-122] [(a INT64 GENERATE...GE 1, 10))] + ColumnDefinition [16-121] [a INT64 GENERATED...NGE 1, 10)] + Identifier(a) [16-17] [a] + SimpleColumnSchema [18-121] [INT64 GENERATED...RANGE 1, 10)] + PathExpression [18-23] [INT64] + Identifier(INT64) [18-23] [INT64] + GeneratedColumnInfo(generated_mode=BY_DEFAULT) [24-121] [GENERATED...RANGE 1, 10)] + IdentityColumnInfo [48-121] [IDENTITY (...RANGE 1, 10)] + Identifier(BIT_REVERSED_POSITIVE) [58-79] [BIT_REVERSED_POSITIVE] + IdentityColumnStartWith [80-103] [START COUNTER WITH 1000] + IntLiteral(1000) [99-103] [1000] + IdentityColumnSkipRange [104-120] [SKIP RANGE 1, 10] + IntLiteral(1) [115-116] [1] + IntLiteral(10) [118-120] [10] + SpannerTableOptions [123-138] [PRIMARY KEY (a)] + PrimaryKey(ENFORCED) [123-138] [PRIMARY KEY (a)] + PrimaryKeyElementList [135-138] [(a)] + PrimaryKeyElement(ASC) [136-137] [a] + Identifier(a) [136-137] [a] +== +CREATE TABLE t (a INT64 NOT NULL GENERATED BY DEFAULT AS IDENTITY (BIT_REVERSED_POSITIVE) HIDDEN) PRIMARY KEY (a) +-- +CreateTableStatement [0-113] [CREATE TABLE...PRIMARY KEY (a)] + PathExpression [13-14] [t] + Identifier(t) [13-14] [t] + TableElementList [15-97] [(a INT64 NOT...SITIVE) HIDDEN)] + ColumnDefinition [16-96] [a INT64 NOT...POSITIVE) HIDDEN] + Identifier(a) [16-17] [a] + SimpleColumnSchema [18-96] [INT64 NOT...D_POSITIVE) HIDDEN] + PathExpression [18-23] [INT64] + Identifier(INT64) [18-23] [INT64] + GeneratedColumnInfo(generated_mode=BY_DEFAULT) [33-89] [GENERATED...REVERSED_POSITIVE)] + IdentityColumnInfo [57-89] [IDENTITY (...EVERSED_POSITIVE)] + Identifier(BIT_REVERSED_POSITIVE) [67-88] [BIT_REVERSED_POSITIVE] + ColumnAttributeList [24-96] [NOT NULL GENERATE...VE) HIDDEN] + NotNullColumnAttribute [24-32] [NOT NULL] + HiddenColumnAttribute [90-96] [HIDDEN] + SpannerTableOptions [98-113] [PRIMARY KEY (a)] + PrimaryKey(ENFORCED) [98-113] [PRIMARY KEY (a)] + PrimaryKeyElementList [110-113] [(a)] + PrimaryKeyElement(ASC) [111-112] [a] + Identifier(a) [111-112] [a] +== +[language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP] +CREATE TABLE t (a INT64 GENERATED BY DEFAULT AS IDENTITY) PRIMARY KEY (a) +-- +ERROR: Syntax error: Expected "(" but got ")" [at 1:57] +CREATE TABLE t (a INT64 GENERATED BY DEFAULT AS IDENTITY) PRIMARY KEY (a) + ^ +== +ALTER TABLE t ALTER COLUMN a ALTER IDENTITY SET SKIP RANGE 1, 10 +-- +AlterTableStatement [0-64] [ALTER TABLE...RANGE 1, 10] + PathExpression [12-13] [t] + Identifier(t) [12-13] [t] + AlterActionList [14-64] [ALTER COLUMN...RANGE 1, 10] + AlterColumnIdentityAction [14-64] [ALTER COLUMN...RANGE 1, 10] + Identifier(a) [27-28] [a] + IdentityColumnSkipRange [48-64] [SKIP RANGE 1, 10] + IntLiteral(1) [59-60] [1] + IntLiteral(10) [62-64] [10] +== +ALTER TABLE t ALTER COLUMN a ALTER IDENTITY SET NO SKIP RANGE +-- +AlterTableStatement [0-61] [ALTER TABLE...SKIP RANGE] + PathExpression [12-13] [t] + Identifier(t) [12-13] [t] + AlterActionList [14-61] [ALTER COLUMN...SKIP RANGE] + AlterColumnIdentityAction(no_skip_range) [14-61] [ALTER COLUMN...SKIP RANGE] + Identifier(a) [27-28] [a] +== +ALTER TABLE t ALTER COLUMN a ALTER IDENTITY RESTART COUNTER WITH 1000 +-- +AlterTableStatement [0-69] [ALTER TABLE...WITH 1000] + PathExpression [12-13] [t] + Identifier(t) [12-13] [t] + AlterActionList [14-69] [ALTER COLUMN...WITH 1000] + AlterColumnIdentityAction [14-69] [ALTER COLUMN...WITH 1000] + Identifier(a) [27-28] [a] + IdentityColumnRestartCounterWith [44-69] [RESTART COUNTER WITH 1000] + IntLiteral(1000) [65-69] [1000] +== +[language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP] +ALTER TABLE t ALTER COLUMN a ALTER IDENTITY RESTART COUNTER WITH 1000 +-- +ERROR: Syntax error: Expected end of input but got keyword IDENTITY [at 1:36] +ALTER TABLE t ALTER COLUMN a ALTER IDENTITY RESTART COUNTER WITH 1000 + ^ diff --git a/parser/testdata/extensions/spanner/indexes.test b/parser/testdata/extensions/spanner/indexes.test new file mode 100644 index 0000000..18dccef --- /dev/null +++ b/parser/testdata/extensions/spanner/indexes.test @@ -0,0 +1,120 @@ +# Hand-written expected parse trees for Cloud Spanner DDL that GoogleSQL's +# reference parser rejects, enabled by zetajones's SPANNER_DDL feature. These +# are not vendored and not generated: there is no reference output, so each +# tree was reviewed by hand. See "Spanner Extensions" in CLAUDE.md and the +# node shapes in ast/spanner.go. +# +# Spanner search and vector index clauses, and ALTER INDEX stored columns. +# ORDER BY and WHERE reuse OrderBy and WhereClause; ", INTERLEAVE IN" reuses +# SpannerInterleaveClause, which follows OPTIONS in the tree as in the +# reference. +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SPANNER_DDL] +CREATE SEARCH INDEX i ON t(a_tokens) STORING (b) PARTITION BY c ORDER BY d DESC WHERE b IS NOT NULL OPTIONS (sort_order_sharding = true) +-- +CreateIndexStatement(SEARCH) [0-136] [CREATE SEARCH...arding = true)] + PathExpression [20-21] [i] + Identifier(i) [20-21] [i] + PathExpression [25-26] [t] + Identifier(t) [25-26] [t] + IndexItemList [26-36] [(a_tokens)] + OrderingExpression(ASC) [27-35] [a_tokens] + PathExpression [27-35] [a_tokens] + Identifier(a_tokens) [27-35] [a_tokens] + IndexStoringExpressionList [45-48] [(b)] + PathExpression [46-47] [b] + Identifier(b) [46-47] [b] + PartitionBy [49-63] [PARTITION BY c] + PathExpression [62-63] [c] + Identifier(c) [62-63] [c] + OrderBy [64-79] [ORDER BY d DESC] + OrderingExpression(DESC) [73-79] [d DESC] + PathExpression [73-74] [d] + Identifier(d) [73-74] [d] + WhereClause [80-99] [WHERE b IS NOT NULL] + BinaryExpression(IS NOT) [86-99] [b IS NOT NULL] + PathExpression [86-87] [b] + Identifier(b) [86-87] [b] + NullLiteral(NULL) [95-99] [NULL] + OptionsList [108-136] [(sort_order_sharding = true)] + OptionsEntry [109-135] [sort_order_sharding = true] + Identifier(sort_order_sharding) [109-128] [sort_order_sharding] + BooleanLiteral(true) [131-135] [true] +== +CREATE SEARCH INDEX i ON t(a_tokens) PARTITION BY c, INTERLEAVE IN p OPTIONS (sort_order_sharding = true) +-- +CreateIndexStatement(SEARCH) [0-105] [CREATE SEARCH...arding = true)] + PathExpression [20-21] [i] + Identifier(i) [20-21] [i] + PathExpression [25-26] [t] + Identifier(t) [25-26] [t] + IndexItemList [26-36] [(a_tokens)] + OrderingExpression(ASC) [27-35] [a_tokens] + PathExpression [27-35] [a_tokens] + Identifier(a_tokens) [27-35] [a_tokens] + PartitionBy [37-51] [PARTITION BY c] + PathExpression [50-51] [c] + Identifier(c) [50-51] [c] + OptionsList [77-105] [(sort_order_sharding = true)] + OptionsEntry [78-104] [sort_order_sharding = true] + Identifier(sort_order_sharding) [78-97] [sort_order_sharding] + BooleanLiteral(true) [100-104] [true] + SpannerInterleaveClause [51-68] [, INTERLEAVE IN p] + PathExpression [67-68] [p] + Identifier(p) [67-68] [p] +== +CREATE VECTOR INDEX i ON t(e) STORING (b) WHERE e IS NOT NULL OPTIONS (distance_type = "COSINE") +-- +CreateIndexStatement(VECTOR) [0-96] [CREATE VECTOR..."COSINE")] + PathExpression [20-21] [i] + Identifier(i) [20-21] [i] + PathExpression [25-26] [t] + Identifier(t) [25-26] [t] + IndexItemList [26-29] [(e)] + OrderingExpression(ASC) [27-28] [e] + PathExpression [27-28] [e] + Identifier(e) [27-28] [e] + IndexStoringExpressionList [38-41] [(b)] + PathExpression [39-40] [b] + Identifier(b) [39-40] [b] + WhereClause [42-61] [WHERE e IS NOT NULL] + BinaryExpression(IS NOT) [48-61] [e IS NOT NULL] + PathExpression [48-49] [e] + Identifier(e) [48-49] [e] + NullLiteral(NULL) [57-61] [NULL] + OptionsList [70-96] [(distance_type = "COSINE")] + OptionsEntry [71-95] [distance_type = "COSINE"] + Identifier(distance_type) [71-84] [distance_type] + StringLiteral [87-95] ["COSINE"] + StringLiteralComponent("COSINE") [87-95] ["COSINE"] +== +[language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP] +CREATE VECTOR INDEX i ON t(e) WHERE e IS NOT NULL OPTIONS (distance_type = "COSINE") +-- +ERROR: Syntax error: Expected end of input but got keyword WHERE [at 1:31] +CREATE VECTOR INDEX i ON t(e) WHERE e IS NOT NULL OPTIONS (distance_type = "C... + ^ +== +ALTER INDEX i ADD STORED COLUMN c +-- +AlterIndexStatement [0-33] [ALTER INDEX...STORED COLUMN c] + PathExpression [12-13] [i] + Identifier(i) [12-13] [i] + AlterActionList [14-33] [ADD STORED COLUMN c] + AddStoredColumnAction [14-33] [ADD STORED COLUMN c] + Identifier(c) [32-33] [c] +== +ALTER VECTOR INDEX i DROP STORED COLUMN c +-- +AlterIndexStatement [0-41] [ALTER VECTOR...STORED COLUMN c] + PathExpression [19-20] [i] + Identifier(i) [19-20] [i] + AlterActionList [21-41] [DROP STORED COLUMN c] + DropStoredColumnAction [21-41] [DROP STORED COLUMN c] + Identifier(c) [40-41] [c] +== +[language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP] +ALTER INDEX i ADD STORED COLUMN c +-- +ERROR: Syntax error: Unexpected keyword STORED [at 1:19] +ALTER INDEX i ADD STORED COLUMN c + ^ diff --git a/parser/testdata/extensions/spanner/locality_groups.test b/parser/testdata/extensions/spanner/locality_groups.test new file mode 100644 index 0000000..362b8d7 --- /dev/null +++ b/parser/testdata/extensions/spanner/locality_groups.test @@ -0,0 +1,47 @@ +# Hand-written expected parse trees for Cloud Spanner DDL that GoogleSQL's +# reference parser rejects, enabled by zetajones's SPANNER_DDL feature. These +# are not vendored and not generated: there is no reference output, so each +# tree was reviewed by hand. See "Spanner Extensions" in CLAUDE.md and the +# node shapes in ast/spanner.go. +# +# Locality groups. CREATE LOCALITY GROUP is reference syntax (golden cases +# in testdata/spanner); ALTER and DROP are Spanner-only. +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SPANNER_DDL] +ALTER LOCALITY GROUP g SET OPTIONS (storage = "ssd") +-- +AlterLocalityGroupStatement [0-52] [ALTER LOCALITY...rage = "ssd")] + PathExpression [21-22] [g] + Identifier(g) [21-22] [g] + AlterActionList [23-52] [SET OPTIONS (storage = "ssd")] + SetOptionsAction [23-52] [SET OPTIONS (storage = "ssd")] + OptionsList [35-52] [(storage = "ssd")] + OptionsEntry [36-51] [storage = "ssd"] + Identifier(storage) [36-43] [storage] + StringLiteral [46-51] ["ssd"] + StringLiteralComponent("ssd") [46-51] ["ssd"] +== +ALTER LOCALITY GROUP `default` SET OPTIONS (storage = "ssd") +-- +AlterLocalityGroupStatement [0-60] [ALTER LOCALITY...rage = "ssd")] + PathExpression [21-30] [`default`] + Identifier(`default`) [21-30] [`default`] + AlterActionList [31-60] [SET OPTIONS (storage = "ssd")] + SetOptionsAction [31-60] [SET OPTIONS (storage = "ssd")] + OptionsList [43-60] [(storage = "ssd")] + OptionsEntry [44-59] [storage = "ssd"] + Identifier(storage) [44-51] [storage] + StringLiteral [54-59] ["ssd"] + StringLiteralComponent("ssd") [54-59] ["ssd"] +== +DROP LOCALITY GROUP g +-- +DropStatement LOCALITY GROUP [0-21] [DROP LOCALITY GROUP g] + PathExpression [20-21] [g] + Identifier(g) [20-21] [g] +== +[language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP] +ALTER LOCALITY GROUP g SET OPTIONS (storage = "ssd") +-- +ERROR: Syntax error: Unexpected keyword LOCALITY [at 1:7] +ALTER LOCALITY GROUP g SET OPTIONS (storage = "ssd") + ^ diff --git a/parser/testdata/extensions/spanner/proto_bundles.test b/parser/testdata/extensions/spanner/proto_bundles.test new file mode 100644 index 0000000..c342bc9 --- /dev/null +++ b/parser/testdata/extensions/spanner/proto_bundles.test @@ -0,0 +1,53 @@ +# Hand-written expected parse trees for Cloud Spanner DDL that GoogleSQL's +# reference parser rejects, enabled by zetajones's SPANNER_DDL feature. These +# are not vendored and not generated: there is no reference output, so each +# tree was reviewed by hand. See "Spanner Extensions" in CLAUDE.md and the +# node shapes in ast/spanner.go. +# +# Proto bundles. +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SPANNER_DDL] +CREATE PROTO BUNDLE (a.b.C, a.b.C.D,) +-- +CreateProtoBundleStatement [0-37] [CREATE PROTO...a.b.C.D,)] + PathExpressionList [20-37] [(a.b.C, a.b.C.D,)] + PathExpression [21-26] [a.b.C] + Identifier(a) [21-22] [a] + Identifier(b) [23-24] [b] + Identifier(C) [25-26] [C] + PathExpression [28-35] [a.b.C.D] + Identifier(a) [28-29] [a] + Identifier(b) [30-31] [b] + Identifier(C) [32-33] [C] + Identifier(D) [34-35] [D] +== +ALTER PROTO BUNDLE INSERT (a.E) UPDATE (a.b.C) DELETE (a.F) +-- +AlterProtoBundleStatement [0-59] [ALTER PROTO...DELETE (a.F)] + AlterActionList [19-59] [INSERT (a....DELETE (a.F)] + ProtoBundleAction(INSERT) [19-31] [INSERT (a.E)] + PathExpressionList [26-31] [(a.E)] + PathExpression [27-30] [a.E] + Identifier(a) [27-28] [a] + Identifier(E) [29-30] [E] + ProtoBundleAction(UPDATE) [32-46] [UPDATE (a.b.C)] + PathExpressionList [39-46] [(a.b.C)] + PathExpression [40-45] [a.b.C] + Identifier(a) [40-41] [a] + Identifier(b) [42-43] [b] + Identifier(C) [44-45] [C] + ProtoBundleAction(DELETE) [47-59] [DELETE (a.F)] + PathExpressionList [54-59] [(a.F)] + PathExpression [55-58] [a.F] + Identifier(a) [55-56] [a] + Identifier(F) [57-58] [F] +== +DROP PROTO BUNDLE +-- +DropProtoBundleStatement [0-17] [DROP PROTO BUNDLE] +== +[language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP] +CREATE PROTO BUNDLE (a.b.C) +-- +ERROR: Syntax error: Unexpected keyword PROTO [at 1:8] +CREATE PROTO BUNDLE (a.b.C) + ^ diff --git a/parser/testdata/extensions/spanner/table_options.test b/parser/testdata/extensions/spanner/table_options.test new file mode 100644 index 0000000..b2f2f04 --- /dev/null +++ b/parser/testdata/extensions/spanner/table_options.test @@ -0,0 +1,229 @@ +# Hand-written expected parse trees for Cloud Spanner DDL that GoogleSQL's +# reference parser rejects, enabled by zetajones's SPANNER_DDL feature. These +# are not vendored and not generated: there is no reference output, so each +# tree was reviewed by hand. See "Spanner Extensions" in CLAUDE.md and the +# node shapes in ast/spanner.go. +# +# Comma-separated clauses after a Spanner table's PRIMARY KEY. ROW DELETION +# POLICY and OPTIONS produce the same TtlClause and OptionsList the reference +# produces when they follow PRIMARY KEY without a comma; INTERLEAVE IN without +# PARENT is a SpannerInterleaveClause, as for indexes. +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SPANNER_DDL] +CREATE TABLE t (a INT64) PRIMARY KEY (a), ROW DELETION POLICY (OLDER_THAN(a, INTERVAL 1 DAY)) +-- +CreateTableStatement [0-93] [CREATE TABLE...NTERVAL 1 DAY))] + PathExpression [13-14] [t] + Identifier(t) [13-14] [t] + TableElementList [15-24] [(a INT64)] + ColumnDefinition [16-23] [a INT64] + Identifier(a) [16-17] [a] + SimpleColumnSchema [18-23] [INT64] + PathExpression [18-23] [INT64] + Identifier(INT64) [18-23] [INT64] + SpannerTableOptions [25-40] [PRIMARY KEY (a)] + PrimaryKey(ENFORCED) [25-40] [PRIMARY KEY (a)] + PrimaryKeyElementList [37-40] [(a)] + PrimaryKeyElement(ASC) [38-39] [a] + Identifier(a) [38-39] [a] + TtlClause [42-93] [ROW DELETION...NTERVAL 1 DAY))] + FunctionCall [63-92] [OLDER_THAN(a, INTERVAL 1 DAY)] + PathExpression [63-73] [OLDER_THAN] + Identifier(OLDER_THAN) [63-73] [OLDER_THAN] + PathExpression [74-75] [a] + Identifier(a) [74-75] [a] + IntervalExpr [77-91] [INTERVAL 1 DAY] + IntLiteral(1) [86-87] [1] + Identifier(DAY) [88-91] [DAY] +== +CREATE TABLE t (a INT64) PRIMARY KEY (a), OPTIONS (x = 1) +-- +CreateTableStatement [0-57] [CREATE TABLE...OPTIONS (x = 1)] + PathExpression [13-14] [t] + Identifier(t) [13-14] [t] + TableElementList [15-24] [(a INT64)] + ColumnDefinition [16-23] [a INT64] + Identifier(a) [16-17] [a] + SimpleColumnSchema [18-23] [INT64] + PathExpression [18-23] [INT64] + Identifier(INT64) [18-23] [INT64] + SpannerTableOptions [25-40] [PRIMARY KEY (a)] + PrimaryKey(ENFORCED) [25-40] [PRIMARY KEY (a)] + PrimaryKeyElementList [37-40] [(a)] + PrimaryKeyElement(ASC) [38-39] [a] + Identifier(a) [38-39] [a] + OptionsList [50-57] [(x = 1)] + OptionsEntry [51-56] [x = 1] + Identifier(x) [51-52] [x] + IntLiteral(1) [55-56] [1] +== +CREATE TABLE t (a INT64) PRIMARY KEY (a), INTERLEAVE IN p +-- +CreateTableStatement [0-57] [CREATE TABLE...INTERLEAVE IN p] + PathExpression [13-14] [t] + Identifier(t) [13-14] [t] + TableElementList [15-24] [(a INT64)] + ColumnDefinition [16-23] [a INT64] + Identifier(a) [16-17] [a] + SimpleColumnSchema [18-23] [INT64] + PathExpression [18-23] [INT64] + Identifier(INT64) [18-23] [INT64] + SpannerTableOptions [25-57] [PRIMARY KEY...INTERLEAVE IN p] + PrimaryKey(ENFORCED) [25-40] [PRIMARY KEY (a)] + PrimaryKeyElementList [37-40] [(a)] + PrimaryKeyElement(ASC) [38-39] [a] + Identifier(a) [38-39] [a] + SpannerInterleaveClause [40-57] [, INTERLEAVE IN p] + PathExpression [56-57] [p] + Identifier(p) [56-57] [p] +== +# All of them, in order. +CREATE TABLE t (a INT64) PRIMARY KEY (a), INTERLEAVE IN PARENT p ON DELETE CASCADE, ROW DELETION POLICY (OLDER_THAN(a, INTERVAL 1 DAY)), OPTIONS (x = 1) +-- +CreateTableStatement [0-152] [CREATE TABLE...OPTIONS (x = 1)] + PathExpression [13-14] [t] + Identifier(t) [13-14] [t] + TableElementList [15-24] [(a INT64)] + ColumnDefinition [16-23] [a INT64] + Identifier(a) [16-17] [a] + SimpleColumnSchema [18-23] [INT64] + PathExpression [18-23] [INT64] + Identifier(INT64) [18-23] [INT64] + SpannerTableOptions [25-82] [PRIMARY KEY...DELETE CASCADE] + PrimaryKey(ENFORCED) [25-40] [PRIMARY KEY (a)] + PrimaryKeyElementList [37-40] [(a)] + PrimaryKeyElement(ASC) [38-39] [a] + Identifier(a) [38-39] [a] + SpannerInterleaveClause [40-82] [, INTERLEAVE...DELETE CASCADE] + PathExpression [63-64] [p] + Identifier(p) [63-64] [p] + TtlClause [84-135] [ROW DELETION...NTERVAL 1 DAY))] + FunctionCall [105-134] [OLDER_THAN(a, INTERVAL 1 DAY)] + PathExpression [105-115] [OLDER_THAN] + Identifier(OLDER_THAN) [105-115] [OLDER_THAN] + PathExpression [116-117] [a] + Identifier(a) [116-117] [a] + IntervalExpr [119-133] [INTERVAL 1 DAY] + IntLiteral(1) [128-129] [1] + Identifier(DAY) [130-133] [DAY] + OptionsList [145-152] [(x = 1)] + OptionsEntry [146-151] [x = 1] + Identifier(x) [146-147] [x] + IntLiteral(1) [150-151] [1] +== +# The reference form without a comma is unchanged. +CREATE TABLE t (a INT64) PRIMARY KEY (a) ROW DELETION POLICY (x) OPTIONS (y = 1) +-- +CreateTableStatement [0-80] [CREATE TABLE...OPTIONS (y = 1)] + PathExpression [13-14] [t] + Identifier(t) [13-14] [t] + TableElementList [15-24] [(a INT64)] + ColumnDefinition [16-23] [a INT64] + Identifier(a) [16-17] [a] + SimpleColumnSchema [18-23] [INT64] + PathExpression [18-23] [INT64] + Identifier(INT64) [18-23] [INT64] + SpannerTableOptions [25-40] [PRIMARY KEY (a)] + PrimaryKey(ENFORCED) [25-40] [PRIMARY KEY (a)] + PrimaryKeyElementList [37-40] [(a)] + PrimaryKeyElement(ASC) [38-39] [a] + Identifier(a) [38-39] [a] + TtlClause [41-64] [ROW DELETION POLICY (x)] + PathExpression [62-63] [x] + Identifier(x) [62-63] [x] + OptionsList [73-80] [(y = 1)] + OptionsEntry [74-79] [y = 1] + Identifier(y) [74-75] [y] + IntLiteral(1) [78-79] [1] +== +# Without SPANNER_DDL the comma forms are rejected. +[language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP] +CREATE TABLE t (a INT64) PRIMARY KEY (a), OPTIONS (x = 1) +-- +ERROR: Syntax error: Expected end of input but got "," [at 1:41] +CREATE TABLE t (a INT64) PRIMARY KEY (a), OPTIONS (x = 1) + ^ +== +[language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP] +CREATE TABLE t (a INT64) PRIMARY KEY (a), INTERLEAVE IN p +-- +ERROR: Syntax error: Expected end of input but got "," [at 1:41] +CREATE TABLE t (a INT64) PRIMARY KEY (a), INTERLEAVE IN p + ^ +== +# A table synonym is a table element. +CREATE TABLE t (a INT64, SYNONYM (u)) PRIMARY KEY (a) +-- +CreateTableStatement [0-53] [CREATE TABLE...PRIMARY KEY (a)] + PathExpression [13-14] [t] + Identifier(t) [13-14] [t] + TableElementList [15-37] [(a INT64, SYNONYM (u))] + ColumnDefinition [16-23] [a INT64] + Identifier(a) [16-17] [a] + SimpleColumnSchema [18-23] [INT64] + PathExpression [18-23] [INT64] + Identifier(INT64) [18-23] [INT64] + TableSynonym [25-36] [SYNONYM (u)] + Identifier(u) [34-35] [u] + SpannerTableOptions [38-53] [PRIMARY KEY (a)] + PrimaryKey(ENFORCED) [38-53] [PRIMARY KEY (a)] + PrimaryKeyElementList [50-53] [(a)] + PrimaryKeyElement(ASC) [51-52] [a] + Identifier(a) [51-52] [a] +== +# A queue is declared like a table. +CREATE QUEUE q (a INT64 NOT NULL, b BYTES(MAX)) PRIMARY KEY (a), INTERLEAVE IN PARENT p ON DELETE CASCADE +-- +CreateQueueStatement [0-105] [CREATE QUEUE...DELETE CASCADE] + PathExpression [13-14] [q] + Identifier(q) [13-14] [q] + TableElementList [15-47] [(a INT64 NOT...BYTES(MAX))] + ColumnDefinition [16-32] [a INT64 NOT NULL] + Identifier(a) [16-17] [a] + SimpleColumnSchema [18-32] [INT64 NOT NULL] + PathExpression [18-23] [INT64] + Identifier(INT64) [18-23] [INT64] + ColumnAttributeList [24-32] [NOT NULL] + NotNullColumnAttribute [24-32] [NOT NULL] + ColumnDefinition [34-46] [b BYTES(MAX)] + Identifier(b) [34-35] [b] + SimpleColumnSchema [36-46] [BYTES(MAX)] + PathExpression [36-41] [BYTES] + Identifier(BYTES) [36-41] [BYTES] + TypeParameterList [41-45] [(MAX] + MaxLiteral() [42-45] [MAX] + SpannerTableOptions [48-105] [PRIMARY KEY...DELETE CASCADE] + PrimaryKey(ENFORCED) [48-63] [PRIMARY KEY (a)] + PrimaryKeyElementList [60-63] [(a)] + PrimaryKeyElement(ASC) [61-62] [a] + Identifier(a) [61-62] [a] + SpannerInterleaveClause [63-105] [, INTERLEAVE...DELETE CASCADE] + PathExpression [86-87] [p] + Identifier(p) [86-87] [p] +== +CREATE QUEUE IF NOT EXISTS q (a INT64) PRIMARY KEY (a), OPTIONS (x = 1) +-- +CreateQueueStatement(is_if_not_exists) [0-71] [CREATE QUEUE...OPTIONS (x = 1)] + PathExpression [27-28] [q] + Identifier(q) [27-28] [q] + TableElementList [29-38] [(a INT64)] + ColumnDefinition [30-37] [a INT64] + Identifier(a) [30-31] [a] + SimpleColumnSchema [32-37] [INT64] + PathExpression [32-37] [INT64] + Identifier(INT64) [32-37] [INT64] + SpannerTableOptions [39-54] [PRIMARY KEY (a)] + PrimaryKey(ENFORCED) [39-54] [PRIMARY KEY (a)] + PrimaryKeyElementList [51-54] [(a)] + PrimaryKeyElement(ASC) [52-53] [a] + Identifier(a) [52-53] [a] + OptionsList [64-71] [(x = 1)] + OptionsEntry [65-70] [x = 1] + Identifier(x) [65-66] [x] + IntLiteral(1) [69-70] [1] +== +[language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP] +CREATE QUEUE q (a INT64) PRIMARY KEY (a) +-- +ERROR: QUEUE is not a supported object type [at 1:8] +CREATE QUEUE q (a INT64) PRIMARY KEY (a) + ^ diff --git a/parser/testdata/spanner/aggregate-function-calls.test b/parser/testdata/spanner/aggregate-function-calls.test index f59de0c..e343f0a 100644 --- a/parser/testdata/spanner/aggregate-function-calls.test +++ b/parser/testdata/spanner/aggregate-function-calls.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/reference/standard-sql/aggregate-function-calls # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/reference/standard-sql/aggregate-function-calls#having_max -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] WITH diff --git a/parser/testdata/spanner/aggregate_functions.test b/parser/testdata/spanner/aggregate_functions.test index dc81c8d..e930430 100644 --- a/parser/testdata/spanner/aggregate_functions.test +++ b/parser/testdata/spanner/aggregate_functions.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/reference/standard-sql/aggregate_functions # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/reference/standard-sql/aggregate_functions#any_value -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] SELECT ANY_VALUE(fruit) as any_value diff --git a/parser/testdata/spanner/array_functions.test b/parser/testdata/spanner/array_functions.test index 6097004..75819f9 100644 --- a/parser/testdata/spanner/array_functions.test +++ b/parser/testdata/spanner/array_functions.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/reference/standard-sql/array_functions # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/reference/standard-sql/array_functions#array -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] SELECT ARRAY diff --git a/parser/testdata/spanner/bit_functions.test b/parser/testdata/spanner/bit_functions.test index 869e4de..8cde549 100644 --- a/parser/testdata/spanner/bit_functions.test +++ b/parser/testdata/spanner/bit_functions.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/reference/standard-sql/bit_functions # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/reference/standard-sql/bit_functions#bit_count -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] [mode=expression] diff --git a/parser/testdata/spanner/collation-concepts.test b/parser/testdata/spanner/collation-concepts.test index 7d8c052..a1053d9 100644 --- a/parser/testdata/spanner/collation-concepts.test +++ b/parser/testdata/spanner/collation-concepts.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/reference/standard-sql/collation-concepts # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/reference/standard-sql/collation-concepts#collation_specification_example -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] SELECT Place diff --git a/parser/testdata/spanner/compression-functions.test b/parser/testdata/spanner/compression-functions.test index d1e69c9..fa0daeb 100644 --- a/parser/testdata/spanner/compression-functions.test +++ b/parser/testdata/spanner/compression-functions.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/reference/standard-sql/compression-functions # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/reference/standard-sql/compression-functions#zstd_compress -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] [mode=expression] diff --git a/parser/testdata/spanner/conditional_expressions.test b/parser/testdata/spanner/conditional_expressions.test index 041e57c..ee95a53 100644 --- a/parser/testdata/spanner/conditional_expressions.test +++ b/parser/testdata/spanner/conditional_expressions.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/reference/standard-sql/conditional_expressions # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/reference/standard-sql/conditional_expressions#case_expr -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] WITH Numbers AS ( diff --git a/parser/testdata/spanner/conversion_functions.test b/parser/testdata/spanner/conversion_functions.test index efade2b..2a82947 100644 --- a/parser/testdata/spanner/conversion_functions.test +++ b/parser/testdata/spanner/conversion_functions.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/reference/standard-sql/conversion_functions # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/reference/standard-sql/conversion_functions#cast -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] [mode=expression] diff --git a/parser/testdata/spanner/data-definition-language.metadata.json b/parser/testdata/spanner/data-definition-language.metadata.json deleted file mode 100644 index 0967ef4..0000000 --- a/parser/testdata/spanner/data-definition-language.metadata.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/parser/testdata/spanner/data-definition-language.spanner.sql b/parser/testdata/spanner/data-definition-language.spanner.sql index f353b16..65f60a1 100644 --- a/parser/testdata/spanner/data-definition-language.spanner.sql +++ b/parser/testdata/spanner/data-definition-language.spanner.sql @@ -3,7 +3,7 @@ # Examples from Google Cloud documentation, licensed under Apache 2.0. # # Spanner syntax the reference parser rejects with -# --enabled_language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE +# --enabled_language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE # (classified "spanner" in cmd/spanner-corpus/triage.txt). There is no # golden parse tree for these. diff --git a/parser/testdata/spanner/data-definition-language.test b/parser/testdata/spanner/data-definition-language.test index a86f0fd..fe8dace 100644 --- a/parser/testdata/spanner/data-definition-language.test +++ b/parser/testdata/spanner/data-definition-language.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/reference/standard-sql/data-definition-language # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/reference/standard-sql/data-definition-language#reserved_keywords -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] CREATE TABLE MyTable ( diff --git a/parser/testdata/spanner/data-types.test b/parser/testdata/spanner/data-types.test index bc53f4f..87d5aab 100644 --- a/parser/testdata/spanner/data-types.test +++ b/parser/testdata/spanner/data-types.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/reference/standard-sql/data-types # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/reference/standard-sql/data-types#using_array_literals -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] SELECT [1, 2, 3] AS numbers diff --git a/parser/testdata/spanner/date_functions.test b/parser/testdata/spanner/date_functions.test index d5cefa3..aeabd64 100644 --- a/parser/testdata/spanner/date_functions.test +++ b/parser/testdata/spanner/date_functions.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/reference/standard-sql/date_functions # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/reference/standard-sql/date_functions#adddate -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] [mode=expression] diff --git a/parser/testdata/spanner/debugging_functions.test b/parser/testdata/spanner/debugging_functions.test index 3c1f0d8..2436c93 100644 --- a/parser/testdata/spanner/debugging_functions.test +++ b/parser/testdata/spanner/debugging_functions.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/reference/standard-sql/debugging_functions # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/reference/standard-sql/debugging_functions#error -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] [mode=expression] diff --git a/parser/testdata/spanner/dml-syntax.spanner.sql b/parser/testdata/spanner/dml-syntax.spanner.sql index 57e5da2..0cbf23e 100644 --- a/parser/testdata/spanner/dml-syntax.spanner.sql +++ b/parser/testdata/spanner/dml-syntax.spanner.sql @@ -3,7 +3,7 @@ # Examples from Google Cloud documentation, licensed under Apache 2.0. # # Spanner syntax the reference parser rejects with -# --enabled_language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE +# --enabled_language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE # (classified "spanner" in cmd/spanner-corpus/triage.txt). There is no # golden parse tree for these. diff --git a/parser/testdata/spanner/dml-syntax.test b/parser/testdata/spanner/dml-syntax.test index e84f39f..d106db2 100644 --- a/parser/testdata/spanner/dml-syntax.test +++ b/parser/testdata/spanner/dml-syntax.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/reference/standard-sql/dml-syntax # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/reference/standard-sql/dml-syntax#tables -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] CREATE TABLE AlbumInfo ( diff --git a/parser/testdata/spanner/format-elements.test b/parser/testdata/spanner/format-elements.test index 310abfb..868911b 100644 --- a/parser/testdata/spanner/format-elements.test +++ b/parser/testdata/spanner/format-elements.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/reference/standard-sql/format-elements # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/reference/standard-sql/format-elements#format_elements_date_time -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] SELECT FORMAT_DATE("%b-%d-%Y", DATE "2008-12-25") AS formatted diff --git a/parser/testdata/spanner/graph-gql-functions.test b/parser/testdata/spanner/graph-gql-functions.test index d0bae9b..81bea96 100644 --- a/parser/testdata/spanner/graph-gql-functions.test +++ b/parser/testdata/spanner/graph-gql-functions.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/reference/standard-sql/graph-gql-functions # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/reference/standard-sql/graph-gql-functions#destination_node_id -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] [mode=expression] diff --git a/parser/testdata/spanner/graph-operators.test b/parser/testdata/spanner/graph-operators.test index 71e3f59..784bea0 100644 --- a/parser/testdata/spanner/graph-operators.test +++ b/parser/testdata/spanner/graph-operators.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/reference/standard-sql/graph-operators # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/reference/standard-sql/graph-operators#graph_concatenation_operator -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] GRAPH FinGraph diff --git a/parser/testdata/spanner/graph-patterns.test b/parser/testdata/spanner/graph-patterns.test index 21d96cf..30fd145 100644 --- a/parser/testdata/spanner/graph-patterns.test +++ b/parser/testdata/spanner/graph-patterns.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/reference/standard-sql/graph-patterns # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/reference/standard-sql/graph-patterns#examples -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] GRAPH FinGraph diff --git a/parser/testdata/spanner/graph-query-statements.test b/parser/testdata/spanner/graph-query-statements.test index 7476c92..5ed4272 100644 --- a/parser/testdata/spanner/graph-query-statements.test +++ b/parser/testdata/spanner/graph-query-statements.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/reference/standard-sql/graph-query-statements # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/reference/standard-sql/graph-query-statements#examples -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] GRAPH FinGraph diff --git a/parser/testdata/spanner/graph-schema-statements.metadata.json b/parser/testdata/spanner/graph-schema-statements.metadata.json deleted file mode 100644 index 0967ef4..0000000 --- a/parser/testdata/spanner/graph-schema-statements.metadata.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/parser/testdata/spanner/graph-schema-statements.test b/parser/testdata/spanner/graph-schema-statements.test index 9eb05e0..d365c52 100644 --- a/parser/testdata/spanner/graph-schema-statements.test +++ b/parser/testdata/spanner/graph-schema-statements.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/reference/standard-sql/graph-schema-statements # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/reference/standard-sql/graph-schema-statements#element_definition -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] [mode=expression] diff --git a/parser/testdata/spanner/graph-sql-queries.test b/parser/testdata/spanner/graph-sql-queries.test index 5e05d72..a06b13d 100644 --- a/parser/testdata/spanner/graph-sql-queries.test +++ b/parser/testdata/spanner/graph-sql-queries.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/reference/standard-sql/graph-sql-queries # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/reference/standard-sql/graph-sql-queries#examples -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] SELECT name, id diff --git a/parser/testdata/spanner/graph-subqueries.test b/parser/testdata/spanner/graph-subqueries.test index a1400d1..4ab2fed 100644 --- a/parser/testdata/spanner/graph-subqueries.test +++ b/parser/testdata/spanner/graph-subqueries.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/reference/standard-sql/graph-subqueries # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/reference/standard-sql/graph-subqueries#examples -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] GRAPH FinGraph diff --git a/parser/testdata/spanner/guides/backfill-embeddings.test b/parser/testdata/spanner/guides/backfill-embeddings.test index a9151cb..a815b80 100644 --- a/parser/testdata/spanner/guides/backfill-embeddings.test +++ b/parser/testdata/spanner/guides/backfill-embeddings.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/backfill-embeddings # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/backfill-embeddings#example-use-case -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] CREATE TABLE Products ( diff --git a/parser/testdata/spanner/guides/best-practices-gaming-database.test b/parser/testdata/spanner/guides/best-practices-gaming-database.test index ad3b848..e14a209 100644 --- a/parser/testdata/spanner/guides/best-practices-gaming-database.test +++ b/parser/testdata/spanner/guides/best-practices-gaming-database.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/best-practices-gaming-database # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/best-practices-gaming-database#design_indexing_to_avoid_hotspots -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] CREATE TABLE Ranking ( diff --git a/parser/testdata/spanner/guides/bulk-loading.test b/parser/testdata/spanner/guides/bulk-loading.test index 7d43066..06195ff 100644 --- a/parser/testdata/spanner/guides/bulk-loading.test +++ b/parser/testdata/spanner/guides/bulk-loading.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/bulk-loading # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/bulk-loading#interleave-in -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] SELECT pk1, pk2 FROM child diff --git a/parser/testdata/spanner/guides/change-streams.details.test b/parser/testdata/spanner/guides/change-streams.details.test index a4645ef..9e8ed35 100644 --- a/parser/testdata/spanner/guides/change-streams.details.test +++ b/parser/testdata/spanner/guides/change-streams.details.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/change-streams/details # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/change-streams/details#change_stream_query_syntax -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] SELECT ChangeRecord diff --git a/parser/testdata/spanner/guides/change-streams.manage.spanner.sql b/parser/testdata/spanner/guides/change-streams.manage.spanner.sql index a15a2bd..3f5252a 100644 --- a/parser/testdata/spanner/guides/change-streams.manage.spanner.sql +++ b/parser/testdata/spanner/guides/change-streams.manage.spanner.sql @@ -3,7 +3,7 @@ # Examples from Google Cloud documentation, licensed under Apache 2.0. # # Spanner syntax the reference parser rejects with -# --enabled_language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE +# --enabled_language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE # (classified "spanner" in cmd/spanner-corpus/triage.txt). There is no # golden parse tree for these. diff --git a/parser/testdata/spanner/guides/change-streams.use-dataflow.test b/parser/testdata/spanner/guides/change-streams.use-dataflow.test index 51382c2..187fa0e 100644 --- a/parser/testdata/spanner/guides/change-streams.use-dataflow.test +++ b/parser/testdata/spanner/guides/change-streams.use-dataflow.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/change-streams/use-dataflow # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/change-streams/use-dataflow#fetch-full-row -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] CREATE TABLE Singers ( diff --git a/parser/testdata/spanner/guides/check-constraint.how-to.test b/parser/testdata/spanner/guides/check-constraint.how-to.test index 3f72639..956fd4e 100644 --- a/parser/testdata/spanner/guides/check-constraint.how-to.test +++ b/parser/testdata/spanner/guides/check-constraint.how-to.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/check-constraint/how-to # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/check-constraint/how-to#create-table -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] CREATE TABLE Concerts ( diff --git a/parser/testdata/spanner/guides/commit-timestamp.test b/parser/testdata/spanner/guides/commit-timestamp.test index 6541529..d1211e7 100644 --- a/parser/testdata/spanner/guides/commit-timestamp.test +++ b/parser/testdata/spanner/guides/commit-timestamp.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/commit-timestamp # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/commit-timestamp#keys-indexes -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] CREATE INDEX UsersByLastAccess ON Users(LastAccess) diff --git a/parser/testdata/spanner/guides/configure-columnar-engine.spanner.sql b/parser/testdata/spanner/guides/configure-columnar-engine.spanner.sql index db86d4a..157b04f 100644 --- a/parser/testdata/spanner/guides/configure-columnar-engine.spanner.sql +++ b/parser/testdata/spanner/guides/configure-columnar-engine.spanner.sql @@ -3,7 +3,7 @@ # Examples from Google Cloud documentation, licensed under Apache 2.0. # # Spanner syntax the reference parser rejects with -# --enabled_language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE +# --enabled_language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE # (classified "spanner" in cmd/spanner-corpus/triage.txt). There is no # golden parse tree for these. diff --git a/parser/testdata/spanner/guides/configure-columnar-engine.test b/parser/testdata/spanner/guides/configure-columnar-engine.test index e23a6bb..48f5f29 100644 --- a/parser/testdata/spanner/guides/configure-columnar-engine.test +++ b/parser/testdata/spanner/guides/configure-columnar-engine.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/configure-columnar-engine # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/configure-columnar-engine#enable-columnar-engine-gsql -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] CREATE DATABASE Music diff --git a/parser/testdata/spanner/guides/configure-fgac.spanner.sql b/parser/testdata/spanner/guides/configure-fgac.spanner.sql index b38730c..81b10e9 100644 --- a/parser/testdata/spanner/guides/configure-fgac.spanner.sql +++ b/parser/testdata/spanner/guides/configure-fgac.spanner.sql @@ -3,7 +3,7 @@ # Examples from Google Cloud documentation, licensed under Apache 2.0. # # Spanner syntax the reference parser rejects with -# --enabled_language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE +# --enabled_language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE # (classified "spanner" in cmd/spanner-corpus/triage.txt). There is no # golden parse tree for these. diff --git a/parser/testdata/spanner/guides/configure-fgac.test b/parser/testdata/spanner/guides/configure-fgac.test index 60ea52b..398d972 100644 --- a/parser/testdata/spanner/guides/configure-fgac.test +++ b/parser/testdata/spanner/guides/configure-fgac.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/configure-fgac # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/configure-fgac#list_database_roles -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] SELECT * FROM INFORMATION_SCHEMA.ROLES diff --git a/parser/testdata/spanner/guides/create-manage-data-placements.spanner.sql b/parser/testdata/spanner/guides/create-manage-data-placements.spanner.sql index 6aac82c..abf6aa1 100644 --- a/parser/testdata/spanner/guides/create-manage-data-placements.spanner.sql +++ b/parser/testdata/spanner/guides/create-manage-data-placements.spanner.sql @@ -3,7 +3,7 @@ # Examples from Google Cloud documentation, licensed under Apache 2.0. # # Spanner syntax the reference parser rejects with -# --enabled_language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE +# --enabled_language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE # (classified "spanner" in cmd/spanner-corpus/triage.txt). There is no # golden parse tree for these. diff --git a/parser/testdata/spanner/guides/create-manage-data-placements.test b/parser/testdata/spanner/guides/create-manage-data-placements.test index b0b5479..5a6b606 100644 --- a/parser/testdata/spanner/guides/create-manage-data-placements.test +++ b/parser/testdata/spanner/guides/create-manage-data-placements.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/create-manage-data-placements # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/create-manage-data-placements#delete-table -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] DROP TABLE Singers diff --git a/parser/testdata/spanner/guides/create-manage-databases.test b/parser/testdata/spanner/guides/create-manage-databases.test index 22bf683..f3b57a8 100644 --- a/parser/testdata/spanner/guides/create-manage-databases.test +++ b/parser/testdata/spanner/guides/create-manage-databases.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/create-manage-databases # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/create-manage-databases#update-database -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] ALTER TABLE Songwriters ADD COLUMN Publisher STRING(10) diff --git a/parser/testdata/spanner/guides/create-manage-locality-groups.spanner.sql b/parser/testdata/spanner/guides/create-manage-locality-groups.spanner.sql index f8cd213..538e964 100644 --- a/parser/testdata/spanner/guides/create-manage-locality-groups.spanner.sql +++ b/parser/testdata/spanner/guides/create-manage-locality-groups.spanner.sql @@ -3,31 +3,10 @@ # Examples from Google Cloud documentation, licensed under Apache 2.0. # # Spanner syntax the reference parser rejects with -# --enabled_language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE +# --enabled_language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE # (classified "spanner" in cmd/spanner-corpus/triage.txt). There is no # golden parse tree for these. -# https://docs.cloud.google.com/spanner/docs/create-manage-locality-groups#create-locality-group -# id 285931116d26: locality groups (create-manage-locality-groups) -# execute_query: INVALID_ARGUMENT: CREATE LOCALITY GROUP is not supported [at 1:8] -CREATE LOCALITY GROUP separate_storage; - -# https://docs.cloud.google.com/spanner/docs/create-manage-locality-groups#create-locality-group -# id 999a3d5dfef6: locality groups (create-manage-locality-groups) -# execute_query: INVALID_ARGUMENT: CREATE LOCALITY GROUP is not supported [at 1:8] -CREATE LOCALITY GROUP ssd_only OPTIONS (storage='ssd'); - -# https://docs.cloud.google.com/spanner/docs/create-manage-locality-groups#create-locality-group -# id 2a925ceede24: locality groups (create-manage-locality-groups) -# execute_query: INVALID_ARGUMENT: CREATE LOCALITY GROUP is not supported [at 1:8] -CREATE LOCALITY GROUP hdd_only OPTIONS (storage='hdd'); - -# https://docs.cloud.google.com/spanner/docs/create-manage-locality-groups#create-age-based-policy -# id 01a0dff9e706: locality groups (create-manage-locality-groups) -# execute_query: INVALID_ARGUMENT: CREATE LOCALITY GROUP is not supported [at 1:8] -CREATE LOCALITY GROUP spill_to_hdd -OPTIONS (storage = 'ssd', ssd_to_hdd_spill_timespan = '10d'); - # https://docs.cloud.google.com/spanner/docs/create-manage-locality-groups#set_a_database-level_locality_group # id 32396e1bf247: locality groups (create-manage-locality-groups) # execute_query: INVALID_ARGUMENT: Syntax error: Unexpected keyword LOCALITY [at 1:7] diff --git a/parser/testdata/spanner/guides/create-manage-locality-groups.test b/parser/testdata/spanner/guides/create-manage-locality-groups.test index 4644e84..deef2a5 100644 --- a/parser/testdata/spanner/guides/create-manage-locality-groups.test +++ b/parser/testdata/spanner/guides/create-manage-locality-groups.test @@ -1,10 +1,58 @@ # Code generated by go run ./cmd/spanner-corpus. DO NOT EDIT. # Source: https://docs.cloud.google.com/spanner/docs/create-manage-locality-groups # Examples from Google Cloud documentation, licensed under Apache 2.0. -# https://docs.cloud.google.com/spanner/docs/create-manage-locality-groups#set-storage-policy-index -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +# https://docs.cloud.google.com/spanner/docs/create-manage-locality-groups#create-locality-group +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] +CREATE LOCALITY GROUP separate_storage +-- +CreateLocalityGroupStatement [0-38] + PathExpression [22-38] + Identifier(separate_storage) [22-38] +== +# https://docs.cloud.google.com/spanner/docs/create-manage-locality-groups#create-locality-group +CREATE LOCALITY GROUP ssd_only OPTIONS (storage='ssd') +-- +CreateLocalityGroupStatement [0-54] + PathExpression [22-30] + Identifier(ssd_only) [22-30] + OptionsList [39-54] + OptionsEntry [40-53] + Identifier(storage) [40-47] + StringLiteral [48-53] + StringLiteralComponent('ssd') [48-53] +== +# https://docs.cloud.google.com/spanner/docs/create-manage-locality-groups#create-locality-group +CREATE LOCALITY GROUP hdd_only OPTIONS (storage='hdd') +-- +CreateLocalityGroupStatement [0-54] + PathExpression [22-30] + Identifier(hdd_only) [22-30] + OptionsList [39-54] + OptionsEntry [40-53] + Identifier(storage) [40-47] + StringLiteral [48-53] + StringLiteralComponent('hdd') [48-53] +== +# https://docs.cloud.google.com/spanner/docs/create-manage-locality-groups#create-age-based-policy +CREATE LOCALITY GROUP spill_to_hdd +OPTIONS (storage = 'ssd', ssd_to_hdd_spill_timespan = '10d') +-- +CreateLocalityGroupStatement [0-95] + PathExpression [22-34] + Identifier(spill_to_hdd) [22-34] + OptionsList [43-95] + OptionsEntry [44-59] + Identifier(storage) [44-51] + StringLiteral [54-59] + StringLiteralComponent('ssd') [54-59] + OptionsEntry [61-94] + Identifier(ssd_to_hdd_spill_timespan) [61-86] + StringLiteral [89-94] + StringLiteralComponent('10d') [89-94] +== +# https://docs.cloud.google.com/spanner/docs/create-manage-locality-groups#set-storage-policy-index CREATE INDEX SingersByFirstLastName ON Singers(FirstName, LastName) OPTIONS (locality_group = 'spill_to_hdd') -- diff --git a/parser/testdata/spanner/guides/create-manage-split-points.test b/parser/testdata/spanner/guides/create-manage-split-points.test index 4069a07..a5bc34f 100644 --- a/parser/testdata/spanner/guides/create-manage-split-points.test +++ b/parser/testdata/spanner/guides/create-manage-split-points.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/create-manage-split-points # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/create-manage-split-points#view-split-points -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] SELECT * FROM SPANNER_SYS.USER_SPLIT_POINTS diff --git a/parser/testdata/spanner/guides/create-manage-views.spanner.sql b/parser/testdata/spanner/guides/create-manage-views.spanner.sql index 77662ad..414ffeb 100644 --- a/parser/testdata/spanner/guides/create-manage-views.spanner.sql +++ b/parser/testdata/spanner/guides/create-manage-views.spanner.sql @@ -3,7 +3,7 @@ # Examples from Google Cloud documentation, licensed under Apache 2.0. # # Spanner syntax the reference parser rejects with -# --enabled_language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE +# --enabled_language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE # (classified "spanner" in cmd/spanner-corpus/triage.txt). There is no # golden parse tree for these. diff --git a/parser/testdata/spanner/guides/create-manage-views.test b/parser/testdata/spanner/guides/create-manage-views.test index 3079ec9..e4b7d9c 100644 --- a/parser/testdata/spanner/guides/create-manage-views.test +++ b/parser/testdata/spanner/guides/create-manage-views.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/create-manage-views # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/create-manage-views#create_a_view -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] CREATE TABLE Singers ( diff --git a/parser/testdata/spanner/guides/create-query-database-console.test b/parser/testdata/spanner/guides/create-query-database-console.test index cae4c04..edd6fee 100644 --- a/parser/testdata/spanner/guides/create-query-database-console.test +++ b/parser/testdata/spanner/guides/create-query-database-console.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/create-query-database-console # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/create-query-database-console#create-schema -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] CREATE TABLE Singers ( diff --git a/parser/testdata/spanner/guides/databoost.databoost-run-queries.test b/parser/testdata/spanner/guides/databoost.databoost-run-queries.test index 16c3c35..d0c7f9a 100644 --- a/parser/testdata/spanner/guides/databoost.databoost-run-queries.test +++ b/parser/testdata/spanner/guides/databoost.databoost-run-queries.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/databoost/databoost-run-queries # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/databoost/databoost-run-queries#run-query-from-spanner -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] SELECT c.customer_id, c.name, rq.first_order_date diff --git a/parser/testdata/spanner/guides/dml-best-practices.test b/parser/testdata/spanner/guides/dml-best-practices.test index 99a63a1..dc7ab19 100644 --- a/parser/testdata/spanner/guides/dml-best-practices.test +++ b/parser/testdata/spanner/guides/dml-best-practices.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/dml-best-practices # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/dml-best-practices#locking -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] -- ANTI-PATTERN: SENDING AN UPDATE WITHOUT THE PRIMARY KEY COLUMN diff --git a/parser/testdata/spanner/guides/fgac-about.spanner.sql b/parser/testdata/spanner/guides/fgac-about.spanner.sql index 1eefc39..ffe0db4 100644 --- a/parser/testdata/spanner/guides/fgac-about.spanner.sql +++ b/parser/testdata/spanner/guides/fgac-about.spanner.sql @@ -3,7 +3,7 @@ # Examples from Google Cloud documentation, licensed under Apache 2.0. # # Spanner syntax the reference parser rejects with -# --enabled_language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE +# --enabled_language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE # (classified "spanner" in cmd/spanner-corpus/triage.txt). There is no # golden parse tree for these. diff --git a/parser/testdata/spanner/guides/fgac-privileges.spanner.sql b/parser/testdata/spanner/guides/fgac-privileges.spanner.sql index 256bfd1..ae832d9 100644 --- a/parser/testdata/spanner/guides/fgac-privileges.spanner.sql +++ b/parser/testdata/spanner/guides/fgac-privileges.spanner.sql @@ -3,7 +3,7 @@ # Examples from Google Cloud documentation, licensed under Apache 2.0. # # Spanner syntax the reference parser rejects with -# --enabled_language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE +# --enabled_language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE # (classified "spanner" in cmd/spanner-corpus/triage.txt). There is no # golden parse tree for these. diff --git a/parser/testdata/spanner/guides/fgac-privileges.test b/parser/testdata/spanner/guides/fgac-privileges.test index 7084b4e..846f24b 100644 --- a/parser/testdata/spanner/guides/fgac-privileges.test +++ b/parser/testdata/spanner/guides/fgac-privileges.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/fgac-privileges # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/fgac-privileges#select -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] CREATE VIEW SingerNames SQL SECURITY INVOKER AS diff --git a/parser/testdata/spanner/guides/fgac-queues.spanner.sql b/parser/testdata/spanner/guides/fgac-queues.spanner.sql index a11a725..2646f89 100644 --- a/parser/testdata/spanner/guides/fgac-queues.spanner.sql +++ b/parser/testdata/spanner/guides/fgac-queues.spanner.sql @@ -3,7 +3,7 @@ # Examples from Google Cloud documentation, licensed under Apache 2.0. # # Spanner syntax the reference parser rejects with -# --enabled_language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE +# --enabled_language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE # (classified "spanner" in cmd/spanner-corpus/triage.txt). There is no # golden parse tree for these. diff --git a/parser/testdata/spanner/guides/fgac-system-roles.spanner.sql b/parser/testdata/spanner/guides/fgac-system-roles.spanner.sql index 932c6a1..c8a92d8 100644 --- a/parser/testdata/spanner/guides/fgac-system-roles.spanner.sql +++ b/parser/testdata/spanner/guides/fgac-system-roles.spanner.sql @@ -3,7 +3,7 @@ # Examples from Google Cloud documentation, licensed under Apache 2.0. # # Spanner syntax the reference parser rejects with -# --enabled_language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE +# --enabled_language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE # (classified "spanner" in cmd/spanner-corpus/triage.txt). There is no # golden parse tree for these. diff --git a/parser/testdata/spanner/guides/find-approximate-nearest-neighbors.test b/parser/testdata/spanner/guides/find-approximate-nearest-neighbors.test index 1084d6e..3600a26 100644 --- a/parser/testdata/spanner/guides/find-approximate-nearest-neighbors.test +++ b/parser/testdata/spanner/guides/find-approximate-nearest-neighbors.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/find-approximate-nearest-neighbors # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/find-approximate-nearest-neighbors#query-vector-embeddings -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] CREATE TABLE Documents ( diff --git a/parser/testdata/spanner/guides/find-k-nearest-neighbors.test b/parser/testdata/spanner/guides/find-k-nearest-neighbors.test index 055b878..54f9ccd 100644 --- a/parser/testdata/spanner/guides/find-k-nearest-neighbors.test +++ b/parser/testdata/spanner/guides/find-k-nearest-neighbors.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/find-k-nearest-neighbors # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/find-k-nearest-neighbors#example_1_knn_search -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] CREATE TABLE Documents ( diff --git a/parser/testdata/spanner/guides/foreign-keys.how-to.test b/parser/testdata/spanner/guides/foreign-keys.how-to.test index 41aaf1b..315f5fe 100644 --- a/parser/testdata/spanner/guides/foreign-keys.how-to.test +++ b/parser/testdata/spanner/guides/foreign-keys.how-to.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/foreign-keys/how-to # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/foreign-keys/how-to#create-table -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] CREATE TABLE Orders ( diff --git a/parser/testdata/spanner/guides/foreign-keys.overview.test b/parser/testdata/spanner/guides/foreign-keys.overview.test index 97e7260..664fc50 100644 --- a/parser/testdata/spanner/guides/foreign-keys.overview.test +++ b/parser/testdata/spanner/guides/foreign-keys.overview.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/foreign-keys/overview # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/foreign-keys/overview#create-table-with-informational-fk -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] CREATE TABLE Customers ( diff --git a/parser/testdata/spanner/guides/full-text-search.combine-tokenlists.metadata.json b/parser/testdata/spanner/guides/full-text-search.combine-tokenlists.metadata.json deleted file mode 100644 index 0967ef4..0000000 --- a/parser/testdata/spanner/guides/full-text-search.combine-tokenlists.metadata.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/parser/testdata/spanner/guides/full-text-search.combine-tokenlists.test b/parser/testdata/spanner/guides/full-text-search.combine-tokenlists.test index a43a397..4cc91f1 100644 --- a/parser/testdata/spanner/guides/full-text-search.combine-tokenlists.test +++ b/parser/testdata/spanner/guides/full-text-search.combine-tokenlists.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/full-text-search/combine-tokenlists # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/full-text-search/combine-tokenlists#tokenize-separately -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] CREATE TABLE Albums ( diff --git a/parser/testdata/spanner/guides/full-text-search.facets.metadata.json b/parser/testdata/spanner/guides/full-text-search.facets.metadata.json deleted file mode 100644 index 0967ef4..0000000 --- a/parser/testdata/spanner/guides/full-text-search.facets.metadata.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/parser/testdata/spanner/guides/full-text-search.facets.spanner.sql b/parser/testdata/spanner/guides/full-text-search.facets.spanner.sql index d38c7f8..a4c112b 100644 --- a/parser/testdata/spanner/guides/full-text-search.facets.spanner.sql +++ b/parser/testdata/spanner/guides/full-text-search.facets.spanner.sql @@ -3,7 +3,7 @@ # Examples from Google Cloud documentation, licensed under Apache 2.0. # # Spanner syntax the reference parser rejects with -# --enabled_language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE +# --enabled_language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE # (classified "spanner" in cmd/spanner-corpus/triage.txt). There is no # golden parse tree for these. diff --git a/parser/testdata/spanner/guides/full-text-search.facets.test b/parser/testdata/spanner/guides/full-text-search.facets.test index 35508f0..21f8d40 100644 --- a/parser/testdata/spanner/guides/full-text-search.facets.test +++ b/parser/testdata/spanner/guides/full-text-search.facets.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/full-text-search/facets # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/full-text-search/facets#add_facets_to_use_for_full-text_searches -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] CREATE TABLE Albums ( diff --git a/parser/testdata/spanner/guides/full-text-search.fuzzy-search.metadata.json b/parser/testdata/spanner/guides/full-text-search.fuzzy-search.metadata.json deleted file mode 100644 index 0967ef4..0000000 --- a/parser/testdata/spanner/guides/full-text-search.fuzzy-search.metadata.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/parser/testdata/spanner/guides/full-text-search.fuzzy-search.test b/parser/testdata/spanner/guides/full-text-search.fuzzy-search.test index 42f2b9a..e251b42 100644 --- a/parser/testdata/spanner/guides/full-text-search.fuzzy-search.test +++ b/parser/testdata/spanner/guides/full-text-search.fuzzy-search.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/full-text-search/fuzzy-search # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/full-text-search/fuzzy-search#use_an_n-grams-based_approximate_search -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] CREATE TABLE Albums ( diff --git a/parser/testdata/spanner/guides/full-text-search.mix-full-text-and-non-text-queries.metadata.json b/parser/testdata/spanner/guides/full-text-search.mix-full-text-and-non-text-queries.metadata.json deleted file mode 100644 index 0967ef4..0000000 --- a/parser/testdata/spanner/guides/full-text-search.mix-full-text-and-non-text-queries.metadata.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/parser/testdata/spanner/guides/full-text-search.mix-full-text-and-non-text-queries.test b/parser/testdata/spanner/guides/full-text-search.mix-full-text-and-non-text-queries.test index 45506d9..ba5dc5a 100644 --- a/parser/testdata/spanner/guides/full-text-search.mix-full-text-and-non-text-queries.test +++ b/parser/testdata/spanner/guides/full-text-search.mix-full-text-and-non-text-queries.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/full-text-search/mix-full-text-and-non-text-queries # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/full-text-search/mix-full-text-and-non-text-queries#perform_a_mixed_full-text_and_non-text_search -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] CREATE TABLE Albums ( diff --git a/parser/testdata/spanner/guides/full-text-search.numeric-indexes.metadata.json b/parser/testdata/spanner/guides/full-text-search.numeric-indexes.metadata.json deleted file mode 100644 index 0967ef4..0000000 --- a/parser/testdata/spanner/guides/full-text-search.numeric-indexes.metadata.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/parser/testdata/spanner/guides/full-text-search.numeric-indexes.test b/parser/testdata/spanner/guides/full-text-search.numeric-indexes.test index 5909c96..09429f7 100644 --- a/parser/testdata/spanner/guides/full-text-search.numeric-indexes.test +++ b/parser/testdata/spanner/guides/full-text-search.numeric-indexes.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/full-text-search/numeric-indexes # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/full-text-search/numeric-indexes#array-tokenization -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] CREATE TABLE Albums ( diff --git a/parser/testdata/spanner/guides/full-text-search.paginate-search-results.test b/parser/testdata/spanner/guides/full-text-search.paginate-search-results.test index b5e6d7a..5c5dc10 100644 --- a/parser/testdata/spanner/guides/full-text-search.paginate-search-results.test +++ b/parser/testdata/spanner/guides/full-text-search.paginate-search-results.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/full-text-search/paginate-search-results # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/full-text-search/paginate-search-results#use_key-based_pagination -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] SELECT AlbumId, ReleaseTimestamp diff --git a/parser/testdata/spanner/guides/full-text-search.partition-search-index.metadata.json b/parser/testdata/spanner/guides/full-text-search.partition-search-index.metadata.json deleted file mode 100644 index 0967ef4..0000000 --- a/parser/testdata/spanner/guides/full-text-search.partition-search-index.metadata.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/parser/testdata/spanner/guides/full-text-search.partition-search-index.test b/parser/testdata/spanner/guides/full-text-search.partition-search-index.test index 823b5e5..f04854f 100644 --- a/parser/testdata/spanner/guides/full-text-search.partition-search-index.test +++ b/parser/testdata/spanner/guides/full-text-search.partition-search-index.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/full-text-search/partition-search-index # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/full-text-search/partition-search-index# -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] CREATE TABLE Albums ( diff --git a/parser/testdata/spanner/guides/full-text-search.pattern-matching-function-acceleration.metadata.json b/parser/testdata/spanner/guides/full-text-search.pattern-matching-function-acceleration.metadata.json deleted file mode 100644 index 0967ef4..0000000 --- a/parser/testdata/spanner/guides/full-text-search.pattern-matching-function-acceleration.metadata.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/parser/testdata/spanner/guides/full-text-search.pattern-matching-function-acceleration.test b/parser/testdata/spanner/guides/full-text-search.pattern-matching-function-acceleration.test index c321176..9982b44 100644 --- a/parser/testdata/spanner/guides/full-text-search.pattern-matching-function-acceleration.test +++ b/parser/testdata/spanner/guides/full-text-search.pattern-matching-function-acceleration.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/full-text-search/pattern-matching-function-acceleration # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/full-text-search/pattern-matching-function-acceleration#configure_an_n-gram_tokenlist_for_pattern-matching_acceleration -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] CREATE TABLE Albums ( diff --git a/parser/testdata/spanner/guides/full-text-search.query-overview.metadata.json b/parser/testdata/spanner/guides/full-text-search.query-overview.metadata.json deleted file mode 100644 index 0967ef4..0000000 --- a/parser/testdata/spanner/guides/full-text-search.query-overview.metadata.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/parser/testdata/spanner/guides/full-text-search.query-overview.test b/parser/testdata/spanner/guides/full-text-search.query-overview.test index d4c8f23..2987a13 100644 --- a/parser/testdata/spanner/guides/full-text-search.query-overview.test +++ b/parser/testdata/spanner/guides/full-text-search.query-overview.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/full-text-search/query-overview # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/full-text-search/query-overview#query_a_search_index -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] SELECT AlbumId diff --git a/parser/testdata/spanner/guides/full-text-search.ranked-search.test b/parser/testdata/spanner/guides/full-text-search.ranked-search.test index 3d7db97..ea53fb8 100644 --- a/parser/testdata/spanner/guides/full-text-search.ranked-search.test +++ b/parser/testdata/spanner/guides/full-text-search.ranked-search.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/full-text-search/ranked-search # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/full-text-search/ranked-search# -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] SELECT AlbumId diff --git a/parser/testdata/spanner/guides/full-text-search.search-indexes.metadata.json b/parser/testdata/spanner/guides/full-text-search.search-indexes.metadata.json deleted file mode 100644 index 0967ef4..0000000 --- a/parser/testdata/spanner/guides/full-text-search.search-indexes.metadata.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/parser/testdata/spanner/guides/full-text-search.search-indexes.spanner.sql b/parser/testdata/spanner/guides/full-text-search.search-indexes.spanner.sql index 74dfa0e..d95dfdf 100644 --- a/parser/testdata/spanner/guides/full-text-search.search-indexes.spanner.sql +++ b/parser/testdata/spanner/guides/full-text-search.search-indexes.spanner.sql @@ -3,7 +3,7 @@ # Examples from Google Cloud documentation, licensed under Apache 2.0. # # Spanner syntax the reference parser rejects with -# --enabled_language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE +# --enabled_language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE # (classified "spanner" in cmd/spanner-corpus/triage.txt). There is no # golden parse tree for these. diff --git a/parser/testdata/spanner/guides/full-text-search.search-indexes.test b/parser/testdata/spanner/guides/full-text-search.search-indexes.test index 3fabba2..f7ed6cc 100644 --- a/parser/testdata/spanner/guides/full-text-search.search-indexes.test +++ b/parser/testdata/spanner/guides/full-text-search.search-indexes.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/full-text-search/search-indexes # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/full-text-search/search-indexes#search_index_example -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] CREATE TABLE Albums ( diff --git a/parser/testdata/spanner/guides/full-text-search.search-multiple-columns.metadata.json b/parser/testdata/spanner/guides/full-text-search.search-multiple-columns.metadata.json deleted file mode 100644 index 0967ef4..0000000 --- a/parser/testdata/spanner/guides/full-text-search.search-multiple-columns.metadata.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/parser/testdata/spanner/guides/full-text-search.search-multiple-columns.test b/parser/testdata/spanner/guides/full-text-search.search-multiple-columns.test index 31224e7..a204230 100644 --- a/parser/testdata/spanner/guides/full-text-search.search-multiple-columns.test +++ b/parser/testdata/spanner/guides/full-text-search.search-multiple-columns.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/full-text-search/search-multiple-columns # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/full-text-search/search-multiple-columns#perform_a_multi-column_search -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] CREATE TABLE Albums ( diff --git a/parser/testdata/spanner/guides/full-text-search.search-query-enhancement.spanner.sql b/parser/testdata/spanner/guides/full-text-search.search-query-enhancement.spanner.sql index 088651c..1b2cfd2 100644 --- a/parser/testdata/spanner/guides/full-text-search.search-query-enhancement.spanner.sql +++ b/parser/testdata/spanner/guides/full-text-search.search-query-enhancement.spanner.sql @@ -3,7 +3,7 @@ # Examples from Google Cloud documentation, licensed under Apache 2.0. # # Spanner syntax the reference parser rejects with -# --enabled_language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE +# --enabled_language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE # (classified "spanner" in cmd/spanner-corpus/triage.txt). There is no # golden parse tree for these. diff --git a/parser/testdata/spanner/guides/full-text-search.search-query-enhancement.test b/parser/testdata/spanner/guides/full-text-search.search-query-enhancement.test index b5239e1..47013ec 100644 --- a/parser/testdata/spanner/guides/full-text-search.search-query-enhancement.test +++ b/parser/testdata/spanner/guides/full-text-search.search-query-enhancement.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/full-text-search/search-query-enhancement # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/full-text-search/search-query-enhancement#enhanced-query -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] SELECT AlbumId diff --git a/parser/testdata/spanner/guides/full-text-search.substring-search.metadata.json b/parser/testdata/spanner/guides/full-text-search.substring-search.metadata.json deleted file mode 100644 index 0967ef4..0000000 --- a/parser/testdata/spanner/guides/full-text-search.substring-search.metadata.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/parser/testdata/spanner/guides/full-text-search.substring-search.test b/parser/testdata/spanner/guides/full-text-search.substring-search.test index 8f1165a..013ca11 100644 --- a/parser/testdata/spanner/guides/full-text-search.substring-search.test +++ b/parser/testdata/spanner/guides/full-text-search.substring-search.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/full-text-search/substring-search # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/full-text-search/substring-search# -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] CREATE TABLE Albums ( diff --git a/parser/testdata/spanner/guides/full-text-search.tokenization.metadata.json b/parser/testdata/spanner/guides/full-text-search.tokenization.metadata.json deleted file mode 100644 index 0967ef4..0000000 --- a/parser/testdata/spanner/guides/full-text-search.tokenization.metadata.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/parser/testdata/spanner/guides/full-text-search.tokenization.test b/parser/testdata/spanner/guides/full-text-search.tokenization.test index 7d969a2..ff3f982 100644 --- a/parser/testdata/spanner/guides/full-text-search.tokenization.test +++ b/parser/testdata/spanner/guides/full-text-search.tokenization.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/full-text-search/tokenization # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/full-text-search/tokenization#tokenizers -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] [mode=expression] diff --git a/parser/testdata/spanner/guides/full-text-search.top-k-pattern-matching.metadata.json b/parser/testdata/spanner/guides/full-text-search.top-k-pattern-matching.metadata.json deleted file mode 100644 index 0967ef4..0000000 --- a/parser/testdata/spanner/guides/full-text-search.top-k-pattern-matching.metadata.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/parser/testdata/spanner/guides/full-text-search.top-k-pattern-matching.spanner.sql b/parser/testdata/spanner/guides/full-text-search.top-k-pattern-matching.spanner.sql deleted file mode 100644 index 6253ff4..0000000 --- a/parser/testdata/spanner/guides/full-text-search.top-k-pattern-matching.spanner.sql +++ /dev/null @@ -1,21 +0,0 @@ -# Code generated by go run ./cmd/spanner-corpus. DO NOT EDIT. -# Source: https://docs.cloud.google.com/spanner/docs/full-text-search/top-k-pattern-matching -# Examples from Google Cloud documentation, licensed under Apache 2.0. -# -# Spanner syntax the reference parser rejects with -# --enabled_language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE -# (classified "spanner" in cmd/spanner-corpus/triage.txt). There is no -# golden parse tree for these. - -# https://docs.cloud.google.com/spanner/docs/full-text-search/top-k-pattern-matching#create_search_indexes_for_top-k_matches -# id f7df4248d043: search index clauses (ORDER BY, WHERE, INTERLEAVE IN) (full-text-search.top-k-pattern-matching) -# execute_query: INVALID_ARGUMENT: Syntax error: Expected ";" or end of input but got keyword ORDER [at 4:1] -CREATE SEARCH INDEX AlbumsRecordTimestampIndex -ON Albums(AlbumTitle_Tokens, SingerId_Tokens) -STORING (ListenTimestamp) -ORDER BY RecordTimestamp DESC - -CREATE SEARCH INDEX AlbumsReleaseTimestampIndex -ON Albums(AlbumTitle_Tokens) -STORING (ListenTimestamp) -ORDER BY ReleaseTimestamp DESC; diff --git a/parser/testdata/spanner/guides/full-text-search.top-k-pattern-matching.test b/parser/testdata/spanner/guides/full-text-search.top-k-pattern-matching.test index 7dfed8c..36c49dd 100644 --- a/parser/testdata/spanner/guides/full-text-search.top-k-pattern-matching.test +++ b/parser/testdata/spanner/guides/full-text-search.top-k-pattern-matching.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/full-text-search/top-k-pattern-matching # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/full-text-search/top-k-pattern-matching#create_search_indexes_for_top-k_matches -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] CREATE TABLE Albums ( diff --git a/parser/testdata/spanner/guides/generated-column.how-to.spanner.sql b/parser/testdata/spanner/guides/generated-column.how-to.spanner.sql index 3f8c9f8..7ef8ae1 100644 --- a/parser/testdata/spanner/guides/generated-column.how-to.spanner.sql +++ b/parser/testdata/spanner/guides/generated-column.how-to.spanner.sql @@ -3,7 +3,7 @@ # Examples from Google Cloud documentation, licensed under Apache 2.0. # # Spanner syntax the reference parser rejects with -# --enabled_language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE +# --enabled_language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE # (classified "spanner" in cmd/spanner-corpus/triage.txt). There is no # golden parse tree for these. diff --git a/parser/testdata/spanner/guides/generated-column.how-to.test b/parser/testdata/spanner/guides/generated-column.how-to.test index d154690..a157f7d 100644 --- a/parser/testdata/spanner/guides/generated-column.how-to.test +++ b/parser/testdata/spanner/guides/generated-column.how-to.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/generated-column/how-to # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/generated-column/how-to#create-table -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] CREATE TABLE Users ( diff --git a/parser/testdata/spanner/guides/getting-started.jdbc.test b/parser/testdata/spanner/guides/getting-started.jdbc.test index c1c20b7..494b9fa 100644 --- a/parser/testdata/spanner/guides/getting-started.jdbc.test +++ b/parser/testdata/spanner/guides/getting-started.jdbc.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/getting-started/jdbc # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/getting-started/jdbc#create_a_database -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] [mode=expression] diff --git a/parser/testdata/spanner/guides/graph.algorithm-best-practices.metadata.json b/parser/testdata/spanner/guides/graph.algorithm-best-practices.metadata.json deleted file mode 100644 index 0967ef4..0000000 --- a/parser/testdata/spanner/guides/graph.algorithm-best-practices.metadata.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/parser/testdata/spanner/guides/graph.algorithm-best-practices.test b/parser/testdata/spanner/guides/graph.algorithm-best-practices.test index 5ca6bdc..a32c175 100644 --- a/parser/testdata/spanner/guides/graph.algorithm-best-practices.test +++ b/parser/testdata/spanner/guides/graph.algorithm-best-practices.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/graph/algorithm-best-practices # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/graph/algorithm-best-practices#predefined-flexible-schema -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] -- Create `AccountAlgoProperty` as a child table of `Account`, to store all diff --git a/parser/testdata/spanner/guides/graph.algorithms.test b/parser/testdata/spanner/guides/graph.algorithms.test index ef38c1e..a14599d 100644 --- a/parser/testdata/spanner/guides/graph.algorithms.test +++ b/parser/testdata/spanner/guides/graph.algorithms.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/graph/algorithms # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/graph/algorithms#example -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] EXPORT DATA OPTIONS ( diff --git a/parser/testdata/spanner/guides/graph.best-practices-designing-schema.spanner.sql b/parser/testdata/spanner/guides/graph.best-practices-designing-schema.spanner.sql index 06a2c75..2aba5e4 100644 --- a/parser/testdata/spanner/guides/graph.best-practices-designing-schema.spanner.sql +++ b/parser/testdata/spanner/guides/graph.best-practices-designing-schema.spanner.sql @@ -3,7 +3,7 @@ # Examples from Google Cloud documentation, licensed under Apache 2.0. # # Spanner syntax the reference parser rejects with -# --enabled_language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE +# --enabled_language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE # (classified "spanner" in cmd/spanner-corpus/triage.txt). There is no # golden parse tree for these. diff --git a/parser/testdata/spanner/guides/graph.best-practices-designing-schema.test b/parser/testdata/spanner/guides/graph.best-practices-designing-schema.test index f6590fb..c7179d9 100644 --- a/parser/testdata/spanner/guides/graph.best-practices-designing-schema.test +++ b/parser/testdata/spanner/guides/graph.best-practices-designing-schema.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/graph/best-practices-designing-schema # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/graph/best-practices-designing-schema#choose-design-based-on-queries -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] GRAPH FinGraph diff --git a/parser/testdata/spanner/guides/graph.best-practices-tuning-queries.test b/parser/testdata/spanner/guides/graph.best-practices-tuning-queries.test index 27a9ded..779ec91 100644 --- a/parser/testdata/spanner/guides/graph.best-practices-tuning-queries.test +++ b/parser/testdata/spanner/guides/graph.best-practices-tuning-queries.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/graph/best-practices-tuning-queries # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/graph/best-practices-tuning-queries#start-lower-cardinality-nodes -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] GRAPH FinGraph diff --git a/parser/testdata/spanner/guides/graph.create-update-drop-schema.metadata.json b/parser/testdata/spanner/guides/graph.create-update-drop-schema.metadata.json deleted file mode 100644 index 0967ef4..0000000 --- a/parser/testdata/spanner/guides/graph.create-update-drop-schema.metadata.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/parser/testdata/spanner/guides/graph.create-update-drop-schema.test b/parser/testdata/spanner/guides/graph.create-update-drop-schema.test index 02a0974..fd86139 100644 --- a/parser/testdata/spanner/guides/graph.create-update-drop-schema.test +++ b/parser/testdata/spanner/guides/graph.create-update-drop-schema.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/graph/create-update-drop-schema # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/graph/create-update-drop-schema#create-node-input-tables -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] CREATE TABLE Person ( diff --git a/parser/testdata/spanner/guides/graph.full-text-search-and-graph.metadata.json b/parser/testdata/spanner/guides/graph.full-text-search-and-graph.metadata.json deleted file mode 100644 index 0967ef4..0000000 --- a/parser/testdata/spanner/guides/graph.full-text-search-and-graph.metadata.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/parser/testdata/spanner/guides/graph.full-text-search-and-graph.test b/parser/testdata/spanner/guides/graph.full-text-search-and-graph.test index fd277f3..3e50f51 100644 --- a/parser/testdata/spanner/guides/graph.full-text-search-and-graph.test +++ b/parser/testdata/spanner/guides/graph.full-text-search-and-graph.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/graph/full-text-search-and-graph # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/graph/full-text-search-and-graph#create_tokens_and_search_indexes -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] ALTER TABLE Account diff --git a/parser/testdata/spanner/guides/graph.graph-algorithms-overview.test b/parser/testdata/spanner/guides/graph.graph-algorithms-overview.test index 6a127b9..f9c7660 100644 --- a/parser/testdata/spanner/guides/graph.graph-algorithms-overview.test +++ b/parser/testdata/spanner/guides/graph.graph-algorithms-overview.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/graph/graph-algorithms-overview # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/graph/graph-algorithms-overview#gql-integration -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] EXPORT DATA OPTIONS ( diff --git a/parser/testdata/spanner/guides/graph.graph-with-views-how-to.metadata.json b/parser/testdata/spanner/guides/graph.graph-with-views-how-to.metadata.json deleted file mode 100644 index 0967ef4..0000000 --- a/parser/testdata/spanner/guides/graph.graph-with-views-how-to.metadata.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/parser/testdata/spanner/guides/graph.graph-with-views-how-to.spanner.sql b/parser/testdata/spanner/guides/graph.graph-with-views-how-to.spanner.sql index c31fb8d..93484f3 100644 --- a/parser/testdata/spanner/guides/graph.graph-with-views-how-to.spanner.sql +++ b/parser/testdata/spanner/guides/graph.graph-with-views-how-to.spanner.sql @@ -3,7 +3,7 @@ # Examples from Google Cloud documentation, licensed under Apache 2.0. # # Spanner syntax the reference parser rejects with -# --enabled_language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE +# --enabled_language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE # (classified "spanner" in cmd/spanner-corpus/triage.txt). There is no # golden parse tree for these. diff --git a/parser/testdata/spanner/guides/graph.graph-with-views-how-to.test b/parser/testdata/spanner/guides/graph.graph-with-views-how-to.test index 63a8ad8..2d7443a 100644 --- a/parser/testdata/spanner/guides/graph.graph-with-views-how-to.test +++ b/parser/testdata/spanner/guides/graph.graph-with-views-how-to.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/graph/graph-with-views-how-to # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/graph/graph-with-views-how-to#create-graph-views -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] CREATE PROPERTY GRAPH MyGraph diff --git a/parser/testdata/spanner/guides/graph.graph-with-views-overview.metadata.json b/parser/testdata/spanner/guides/graph.graph-with-views-overview.metadata.json deleted file mode 100644 index 0967ef4..0000000 --- a/parser/testdata/spanner/guides/graph.graph-with-views-overview.metadata.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/parser/testdata/spanner/guides/graph.graph-with-views-overview.test b/parser/testdata/spanner/guides/graph.graph-with-views-overview.test index 3d4edf8..6339aba 100644 --- a/parser/testdata/spanner/guides/graph.graph-with-views-overview.test +++ b/parser/testdata/spanner/guides/graph.graph-with-views-overview.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/graph/graph-with-views-overview # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/graph/graph-with-views-overview#strict-key-validation -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] -- Table has PRIMARY KEY(account_id). diff --git a/parser/testdata/spanner/guides/graph.insert-update-delete-data.test b/parser/testdata/spanner/guides/graph.insert-update-delete-data.test index 5cf038c..2871ef0 100644 --- a/parser/testdata/spanner/guides/graph.insert-update-delete-data.test +++ b/parser/testdata/spanner/guides/graph.insert-update-delete-data.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/graph/insert-update-delete-data # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/graph/insert-update-delete-data#insert-nodes-or-edges -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] -- Insert 2 Account nodes. diff --git a/parser/testdata/spanner/guides/graph.manage-schemaless-data.metadata.json b/parser/testdata/spanner/guides/graph.manage-schemaless-data.metadata.json deleted file mode 100644 index 0967ef4..0000000 --- a/parser/testdata/spanner/guides/graph.manage-schemaless-data.metadata.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/parser/testdata/spanner/guides/graph.manage-schemaless-data.test b/parser/testdata/spanner/guides/graph.manage-schemaless-data.test index af1acef..755ed06 100644 --- a/parser/testdata/spanner/guides/graph.manage-schemaless-data.test +++ b/parser/testdata/spanner/guides/graph.manage-schemaless-data.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/graph/manage-schemaless-data # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/graph/manage-schemaless-data#create-input-tables -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] CREATE TABLE GraphNode ( diff --git a/parser/testdata/spanner/guides/graph.perform-vector-similarity-search.metadata.json b/parser/testdata/spanner/guides/graph.perform-vector-similarity-search.metadata.json deleted file mode 100644 index 0967ef4..0000000 --- a/parser/testdata/spanner/guides/graph.perform-vector-similarity-search.metadata.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/parser/testdata/spanner/guides/graph.perform-vector-similarity-search.spanner.sql b/parser/testdata/spanner/guides/graph.perform-vector-similarity-search.spanner.sql index 2b6e5e2..bd64105 100644 --- a/parser/testdata/spanner/guides/graph.perform-vector-similarity-search.spanner.sql +++ b/parser/testdata/spanner/guides/graph.perform-vector-similarity-search.spanner.sql @@ -3,7 +3,7 @@ # Examples from Google Cloud documentation, licensed under Apache 2.0. # # Spanner syntax the reference parser rejects with -# --enabled_language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE +# --enabled_language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE # (classified "spanner" in cmd/spanner-corpus/triage.txt). There is no # golden parse tree for these. diff --git a/parser/testdata/spanner/guides/graph.perform-vector-similarity-search.test b/parser/testdata/spanner/guides/graph.perform-vector-similarity-search.test index dd6940c..01622e3 100644 --- a/parser/testdata/spanner/guides/graph.perform-vector-similarity-search.test +++ b/parser/testdata/spanner/guides/graph.perform-vector-similarity-search.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/graph/perform-vector-similarity-search # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/graph/perform-vector-similarity-search#insert-additional-vector-data -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] UPDATE Account SET nick_name = "Fund for a refreshing tropical vacation" WHERE id = 7 diff --git a/parser/testdata/spanner/guides/graph.queries-overview.test b/parser/testdata/spanner/guides/graph.queries-overview.test index 27ab78d..216ab1f 100644 --- a/parser/testdata/spanner/guides/graph.queries-overview.test +++ b/parser/testdata/spanner/guides/graph.queries-overview.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/graph/queries-overview # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/graph/queries-overview#find-all-nodes -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] GRAPH FinGraph diff --git a/parser/testdata/spanner/guides/graph.reverse-etl.metadata.json b/parser/testdata/spanner/guides/graph.reverse-etl.metadata.json deleted file mode 100644 index 0967ef4..0000000 --- a/parser/testdata/spanner/guides/graph.reverse-etl.metadata.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/parser/testdata/spanner/guides/graph.reverse-etl.spanner.sql b/parser/testdata/spanner/guides/graph.reverse-etl.spanner.sql index 1f84bab..7ba7b03 100644 --- a/parser/testdata/spanner/guides/graph.reverse-etl.spanner.sql +++ b/parser/testdata/spanner/guides/graph.reverse-etl.spanner.sql @@ -3,7 +3,7 @@ # Examples from Google Cloud documentation, licensed under Apache 2.0. # # Spanner syntax the reference parser rejects with -# --enabled_language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE +# --enabled_language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE # (classified "spanner" in cmd/spanner-corpus/triage.txt). There is no # golden parse tree for these. @@ -17,15 +17,3 @@ CREATE TABLE PersonOwnAccount ( CONSTRAINT FK_Account FOREIGN KEY (account_id) REFERENCES Account (id) NOT ENFORCED ) PRIMARY KEY (id, account_id), INTERLEAVE IN Person; - -# https://docs.cloud.google.com/spanner/docs/graph/reverse-etl#perform_a_logical_or_soft_delete_in_the_source -# id 27727b8671c2: row deletion policy (TTL) (graph.reverse-etl) -# execute_query: INVALID_ARGUMENT: ADD ROW DELETION POLICY clause is not supported. [at 2:7] -ALTER TABLE PersonOwnAccount - ADD ROW DELETION POLICY (OLDER_THAN(expired_ts_generated, INTERVAL 0 DAY)); - -# https://docs.cloud.google.com/spanner/docs/graph/reverse-etl#bq-change-history -# id c2e5bc718928: row deletion policy (TTL) (graph.reverse-etl) -# execute_query: INVALID_ARGUMENT: ADD ROW DELETION POLICY clause is not supported. [at 2:7] -ALTER TABLE PersonOwnAccount - ADD ROW DELETION POLICY (OLDER_THAN(expired_ts, INTERVAL 1 DAY)); diff --git a/parser/testdata/spanner/guides/graph.reverse-etl.test b/parser/testdata/spanner/guides/graph.reverse-etl.test index 4c59d2e..eefa416 100644 --- a/parser/testdata/spanner/guides/graph.reverse-etl.test +++ b/parser/testdata/spanner/guides/graph.reverse-etl.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/graph/reverse-etl # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/graph/reverse-etl#insert-data -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] CREATE TABLE Person ( @@ -226,6 +226,24 @@ AlterTableStatement [0-188] ColumnAttributeList [182-188] HiddenColumnAttribute [182-188] == +# https://docs.cloud.google.com/spanner/docs/graph/reverse-etl#perform_a_logical_or_soft_delete_in_the_source +ALTER TABLE PersonOwnAccount + ADD ROW DELETION POLICY (OLDER_THAN(expired_ts_generated, INTERVAL 0 DAY)) +-- +AlterTableStatement [0-105] + PathExpression [12-28] + Identifier(PersonOwnAccount) [12-28] + AlterActionList [31-105] + AddTtlAction [31-105] + FunctionCall [56-104] + PathExpression [56-66] + Identifier(OLDER_THAN) [56-66] + PathExpression [67-87] + Identifier(expired_ts_generated) [67-87] + IntervalExpr [89-103] + IntLiteral(0) [98-99] + Identifier(DAY) [100-103] +== # https://docs.cloud.google.com/spanner/docs/graph/reverse-etl#bq-change-history ALTER TABLE PersonOwnAccount ADD COLUMN expired_ts TIMESTAMP -- @@ -239,3 +257,21 @@ AlterTableStatement [0-60] SimpleColumnSchema [51-60] PathExpression [51-60] Identifier(TIMESTAMP) [51-60] +== +# https://docs.cloud.google.com/spanner/docs/graph/reverse-etl#bq-change-history +ALTER TABLE PersonOwnAccount + ADD ROW DELETION POLICY (OLDER_THAN(expired_ts, INTERVAL 1 DAY)) +-- +AlterTableStatement [0-95] + PathExpression [12-28] + Identifier(PersonOwnAccount) [12-28] + AlterActionList [31-95] + AddTtlAction [31-95] + FunctionCall [56-94] + PathExpression [56-66] + Identifier(OLDER_THAN) [56-66] + PathExpression [67-77] + Identifier(expired_ts) [67-77] + IntervalExpr [79-93] + IntLiteral(1) [88-89] + Identifier(DAY) [90-93] diff --git a/parser/testdata/spanner/guides/graph.run-algorithms.metadata.json b/parser/testdata/spanner/guides/graph.run-algorithms.metadata.json deleted file mode 100644 index 0967ef4..0000000 --- a/parser/testdata/spanner/guides/graph.run-algorithms.metadata.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/parser/testdata/spanner/guides/graph.run-algorithms.test b/parser/testdata/spanner/guides/graph.run-algorithms.test index 3940006..8641735 100644 --- a/parser/testdata/spanner/guides/graph.run-algorithms.test +++ b/parser/testdata/spanner/guides/graph.run-algorithms.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/graph/run-algorithms # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/graph/run-algorithms#before-you-begin -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] -- Add `page_rank` as a column. Data type of this column matches the data type defined in `PageRank` output signature. diff --git a/parser/testdata/spanner/guides/graph.schema-overview.metadata.json b/parser/testdata/spanner/guides/graph.schema-overview.metadata.json deleted file mode 100644 index 0967ef4..0000000 --- a/parser/testdata/spanner/guides/graph.schema-overview.metadata.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/parser/testdata/spanner/guides/graph.schema-overview.test b/parser/testdata/spanner/guides/graph.schema-overview.test index 2749817..9545e6d 100644 --- a/parser/testdata/spanner/guides/graph.schema-overview.test +++ b/parser/testdata/spanner/guides/graph.schema-overview.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/graph/schema-overview # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/graph/schema-overview#defining-node-property-graph -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] -- First, create an Account table. diff --git a/parser/testdata/spanner/guides/graph.set-up.test b/parser/testdata/spanner/guides/graph.set-up.test index 8fe98ed..0b46729 100644 --- a/parser/testdata/spanner/guides/graph.set-up.test +++ b/parser/testdata/spanner/guides/graph.set-up.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/graph/set-up # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/graph/set-up#create-database -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] CREATE TABLE PersonOwnAccount ( diff --git a/parser/testdata/spanner/guides/graph.troubleshoot.metadata.json b/parser/testdata/spanner/guides/graph.troubleshoot.metadata.json deleted file mode 100644 index 0967ef4..0000000 --- a/parser/testdata/spanner/guides/graph.troubleshoot.metadata.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/parser/testdata/spanner/guides/graph.troubleshoot.test b/parser/testdata/spanner/guides/graph.troubleshoot.test index a4498c9..8669370 100644 --- a/parser/testdata/spanner/guides/graph.troubleshoot.test +++ b/parser/testdata/spanner/guides/graph.troubleshoot.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/graph/troubleshoot # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/graph/troubleshoot#example_error -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] CREATE OR REPLACE PROPERTY GRAPH FinGraph diff --git a/parser/testdata/spanner/guides/graph.work-with-paths.test b/parser/testdata/spanner/guides/graph.work-with-paths.test index b9a9192..96970ac 100644 --- a/parser/testdata/spanner/guides/graph.work-with-paths.test +++ b/parser/testdata/spanner/guides/graph.work-with-paths.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/graph/work-with-paths # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/graph/work-with-paths#example -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] GRAPH FinGraph diff --git a/parser/testdata/spanner/guides/graph.work-with-visualizations.test b/parser/testdata/spanner/guides/graph.work-with-visualizations.test index 8cbce59..6c197ea 100644 --- a/parser/testdata/spanner/guides/graph.work-with-visualizations.test +++ b/parser/testdata/spanner/guides/graph.work-with-visualizations.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/graph/work-with-visualizations # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/graph/work-with-visualizations#visualization-results -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] GRAPH FinGraph diff --git a/parser/testdata/spanner/guides/hybrid-full-text-vector-search.test b/parser/testdata/spanner/guides/hybrid-full-text-vector-search.test index 994cb9b..0888784 100644 --- a/parser/testdata/spanner/guides/hybrid-full-text-vector-search.test +++ b/parser/testdata/spanner/guides/hybrid-full-text-vector-search.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/hybrid-full-text-vector-search # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/hybrid-full-text-vector-search#implement-rrf-spanner -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] SELECT SUM(1 / (60 + rank)) AS rrf_score, key diff --git a/parser/testdata/spanner/guides/implement-multi-tenancy.test b/parser/testdata/spanner/guides/implement-multi-tenancy.test index 30b7110..11f37ac 100644 --- a/parser/testdata/spanner/guides/implement-multi-tenancy.test +++ b/parser/testdata/spanner/guides/implement-multi-tenancy.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/implement-multi-tenancy # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/implement-multi-tenancy#query_generation_and_attribution -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] SELECT * FROM EMPLOYEE diff --git a/parser/testdata/spanner/guides/index-geo-partitioning.spanner.sql b/parser/testdata/spanner/guides/index-geo-partitioning.spanner.sql index f05f6ec..8c9a316 100644 --- a/parser/testdata/spanner/guides/index-geo-partitioning.spanner.sql +++ b/parser/testdata/spanner/guides/index-geo-partitioning.spanner.sql @@ -3,7 +3,7 @@ # Examples from Google Cloud documentation, licensed under Apache 2.0. # # Spanner syntax the reference parser rejects with -# --enabled_language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE +# --enabled_language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE # (classified "spanner" in cmd/spanner-corpus/triage.txt). There is no # golden parse tree for these. diff --git a/parser/testdata/spanner/guides/index-geo-partitioning.test b/parser/testdata/spanner/guides/index-geo-partitioning.test index 46f0902..db36d44 100644 --- a/parser/testdata/spanner/guides/index-geo-partitioning.test +++ b/parser/testdata/spanner/guides/index-geo-partitioning.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/index-geo-partitioning # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/index-geo-partitioning#global-index -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] CREATE UNIQUE INDEX idx_customer_email ON customer(email) diff --git a/parser/testdata/spanner/guides/introspection.active-partitioned-dmls.test b/parser/testdata/spanner/guides/introspection.active-partitioned-dmls.test index d8a09da..7252fe2 100644 --- a/parser/testdata/spanner/guides/introspection.active-partitioned-dmls.test +++ b/parser/testdata/spanner/guides/introspection.active-partitioned-dmls.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/introspection/active-partitioned-dmls # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/introspection/active-partitioned-dmls#listing_oldest_running_queries -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] SELECT text, diff --git a/parser/testdata/spanner/guides/introspection.column-operations-statistics.test b/parser/testdata/spanner/guides/introspection.column-operations-statistics.test index fa0940c..2f838e3 100644 --- a/parser/testdata/spanner/guides/introspection.column-operations-statistics.test +++ b/parser/testdata/spanner/guides/introspection.column-operations-statistics.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/introspection/column-operations-statistics # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/introspection/column-operations-statistics#query_the_table_columns_with_the_most_write_operations_for_the_most_recent_interval -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] SELECT interval_end, diff --git a/parser/testdata/spanner/guides/introspection.hot-split-statistics.test b/parser/testdata/spanner/guides/introspection.hot-split-statistics.test index 345d976..4934fef 100644 --- a/parser/testdata/spanner/guides/introspection.hot-split-statistics.test +++ b/parser/testdata/spanner/guides/introspection.hot-split-statistics.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/introspection/hot-split-statistics # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/introspection/hot-split-statistics#example_schema -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] CREATE TABLE Users ( diff --git a/parser/testdata/spanner/guides/introspection.investigate-cpu-utilization.test b/parser/testdata/spanner/guides/introspection.investigate-cpu-utilization.test index 1568797..a9fde6b 100644 --- a/parser/testdata/spanner/guides/introspection.investigate-cpu-utilization.test +++ b/parser/testdata/spanner/guides/introspection.investigate-cpu-utilization.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/introspection/investigate-cpu-utilization # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/introspection/investigate-cpu-utilization#analyze-statistics -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] SELECT text, diff --git a/parser/testdata/spanner/guides/introspection.lock-statistics.test b/parser/testdata/spanner/guides/introspection.lock-statistics.test index bc91a8b..750adc5 100644 --- a/parser/testdata/spanner/guides/introspection.lock-statistics.test +++ b/parser/testdata/spanner/guides/introspection.lock-statistics.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/introspection/lock-statistics # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/introspection/lock-statistics#explain-row-range -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] CREATE TABLE Singers ( diff --git a/parser/testdata/spanner/guides/introspection.oldest-active-queries.test b/parser/testdata/spanner/guides/introspection.oldest-active-queries.test index b2f3237..000fdcb 100644 --- a/parser/testdata/spanner/guides/introspection.oldest-active-queries.test +++ b/parser/testdata/spanner/guides/introspection.oldest-active-queries.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/introspection/oldest-active-queries # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/introspection/oldest-active-queries#list_oldest_running_active_queries -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] SELECT start_time, diff --git a/parser/testdata/spanner/guides/introspection.query-statistics.test b/parser/testdata/spanner/guides/introspection.query-statistics.test index eff117a..6a74c15 100644 --- a/parser/testdata/spanner/guides/introspection.query-statistics.test +++ b/parser/testdata/spanner/guides/introspection.query-statistics.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/introspection/query-statistics # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/introspection/query-statistics#list_the_basic_statistics_for_each_query_in_a_given_time_period -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] SELECT text, diff --git a/parser/testdata/spanner/guides/introspection.read-statistics.test b/parser/testdata/spanner/guides/introspection.read-statistics.test index 690e7c9..8426587 100644 --- a/parser/testdata/spanner/guides/introspection.read-statistics.test +++ b/parser/testdata/spanner/guides/introspection.read-statistics.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/introspection/read-statistics # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/introspection/read-statistics#list_the_basic_statistics_for_each_read_shape_in_a_given_time_period -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] SELECT fprint, diff --git a/parser/testdata/spanner/guides/introspection.table-operations-statistics.test b/parser/testdata/spanner/guides/introspection.table-operations-statistics.test index ab56489..0d0ba63 100644 --- a/parser/testdata/spanner/guides/introspection.table-operations-statistics.test +++ b/parser/testdata/spanner/guides/introspection.table-operations-statistics.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/introspection/table-operations-statistics # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/introspection/table-operations-statistics#query_the_tables_and_indexes_with_no_usage_in_the_last_24_hours -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] (SELECT t.table_name diff --git a/parser/testdata/spanner/guides/introspection.transaction-statistics.test b/parser/testdata/spanner/guides/introspection.transaction-statistics.test index 690c45a..8e943db 100644 --- a/parser/testdata/spanner/guides/introspection.transaction-statistics.test +++ b/parser/testdata/spanner/guides/introspection.transaction-statistics.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/introspection/transaction-statistics # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/introspection/transaction-statistics#list_the_basic_statistics_for_each_transaction_in_a_given_time_period -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] SELECT fprint, diff --git a/parser/testdata/spanner/guides/introspection.troubleshooting-with-tags.test b/parser/testdata/spanner/guides/introspection.troubleshooting-with-tags.test index 14414d4..dffb046 100644 --- a/parser/testdata/spanner/guides/introspection.troubleshooting-with-tags.test +++ b/parser/testdata/spanner/guides/introspection.troubleshooting-with-tags.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/introspection/troubleshooting-with-tags # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/introspection/troubleshooting-with-tags#how_to_view_request_tags_in_statistics_table -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] SELECT t.text, diff --git a/parser/testdata/spanner/guides/introspection.vector-index-statistics.test b/parser/testdata/spanner/guides/introspection.vector-index-statistics.test index 9e2a68a..be9b4a5 100644 --- a/parser/testdata/spanner/guides/introspection.vector-index-statistics.test +++ b/parser/testdata/spanner/guides/introspection.vector-index-statistics.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/introspection/vector-index-statistics # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/introspection/vector-index-statistics#example-query-1 -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] SELECT VECTOR_INDEX_NAME, diff --git a/parser/testdata/spanner/guides/isolation-levels.test b/parser/testdata/spanner/guides/isolation-levels.test index 8bc92bf..7a88720 100644 --- a/parser/testdata/spanner/guides/isolation-levels.test +++ b/parser/testdata/spanner/guides/isolation-levels.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/isolation-levels # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/isolation-levels#repeatable-read-example -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] -- Transaction 1 diff --git a/parser/testdata/spanner/guides/migrating-primary-keys.spanner.sql b/parser/testdata/spanner/guides/migrating-primary-keys.spanner.sql index 662c20b..fe2f7ec 100644 --- a/parser/testdata/spanner/guides/migrating-primary-keys.spanner.sql +++ b/parser/testdata/spanner/guides/migrating-primary-keys.spanner.sql @@ -3,7 +3,7 @@ # Examples from Google Cloud documentation, licensed under Apache 2.0. # # Spanner syntax the reference parser rejects with -# --enabled_language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE +# --enabled_language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE # (classified "spanner" in cmd/spanner-corpus/triage.txt). There is no # golden parse tree for these. diff --git a/parser/testdata/spanner/guides/migrating-primary-keys.test b/parser/testdata/spanner/guides/migrating-primary-keys.test index 218a5f1..297a17f 100644 --- a/parser/testdata/spanner/guides/migrating-primary-keys.test +++ b/parser/testdata/spanner/guides/migrating-primary-keys.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/migrating-primary-keys # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/migrating-primary-keys#sample_migration_workflow -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] CREATE SEQUENCE singer_id_sequence OPTIONS ( diff --git a/parser/testdata/spanner/guides/ml-emulator.test b/parser/testdata/spanner/guides/ml-emulator.test index 6d81b88..ef9ac46 100644 --- a/parser/testdata/spanner/guides/ml-emulator.test +++ b/parser/testdata/spanner/guides/ml-emulator.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/ml-emulator # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/ml-emulator#default_behavior -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] SELECT Outcome diff --git a/parser/testdata/spanner/guides/ml-tutorial-embeddings.test b/parser/testdata/spanner/guides/ml-tutorial-embeddings.test index ecf0eb2..c5b3d27 100644 --- a/parser/testdata/spanner/guides/ml-tutorial-embeddings.test +++ b/parser/testdata/spanner/guides/ml-tutorial-embeddings.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/ml-tutorial-embeddings # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/ml-tutorial-embeddings#generate_and_store_text_embeddings -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] CREATE TABLE Products( diff --git a/parser/testdata/spanner/guides/ml-tutorial-generative-ai.test b/parser/testdata/spanner/guides/ml-tutorial-generative-ai.test index cdbaab8..dcdbc81 100644 --- a/parser/testdata/spanner/guides/ml-tutorial-generative-ai.test +++ b/parser/testdata/spanner/guides/ml-tutorial-generative-ai.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/ml-tutorial-generative-ai # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/ml-tutorial-generative-ai#create_the_ecommerce_website_schema -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] CREATE TABLE Products ( diff --git a/parser/testdata/spanner/guides/ml-tutorial.test b/parser/testdata/spanner/guides/ml-tutorial.test index e27d697..1fc05cd 100644 --- a/parser/testdata/spanner/guides/ml-tutorial.test +++ b/parser/testdata/spanner/guides/ml-tutorial.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/ml-tutorial # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/ml-tutorial#examples -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] SELECT content diff --git a/parser/testdata/spanner/guides/named-schemas.spanner.sql b/parser/testdata/spanner/guides/named-schemas.spanner.sql index c64026f..eac21d7 100644 --- a/parser/testdata/spanner/guides/named-schemas.spanner.sql +++ b/parser/testdata/spanner/guides/named-schemas.spanner.sql @@ -3,16 +3,10 @@ # Examples from Google Cloud documentation, licensed under Apache 2.0. # # Spanner syntax the reference parser rejects with -# --enabled_language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE +# --enabled_language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE # (classified "spanner" in cmd/spanner-corpus/triage.txt). There is no # golden parse tree for these. -# https://docs.cloud.google.com/spanner/docs/named-schemas#add-fgac-to-named-schema -# id 5f1bb1f70bc6: CREATE ROLE (named-schemas) -# execute_query: INVALID_ARGUMENT: ROLE is not a supported object type [at 1:8] -CREATE ROLE role1 -CREATE ROLE role2; - # https://docs.cloud.google.com/spanner/docs/named-schemas#add-fgac-to-named-schema # id 2907f4ab8957: GRANT/REVOKE for fine-grained access control (named-schemas) # execute_query: INVALID_ARGUMENT: Syntax error: Unexpected keyword ALL [at 1:17] diff --git a/parser/testdata/spanner/guides/named-schemas.test b/parser/testdata/spanner/guides/named-schemas.test index ac60aea..a96d5e2 100644 --- a/parser/testdata/spanner/guides/named-schemas.test +++ b/parser/testdata/spanner/guides/named-schemas.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/named-schemas # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/named-schemas#create_a_named_schema -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] CREATE SEQUENCE sch1.sequence OPTIONS ( diff --git a/parser/testdata/spanner/guides/pre-splitting-overview.test b/parser/testdata/spanner/guides/pre-splitting-overview.test index 7631075..fea0f60 100644 --- a/parser/testdata/spanner/guides/pre-splitting-overview.test +++ b/parser/testdata/spanner/guides/pre-splitting-overview.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/pre-splitting-overview # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/pre-splitting-overview#sample_workflow_for_determining_split_points -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] CREATE TABLE UserInfo ( diff --git a/parser/testdata/spanner/guides/primary-key-default-value.spanner.sql b/parser/testdata/spanner/guides/primary-key-default-value.spanner.sql index 943a978..7173295 100644 --- a/parser/testdata/spanner/guides/primary-key-default-value.spanner.sql +++ b/parser/testdata/spanner/guides/primary-key-default-value.spanner.sql @@ -3,7 +3,7 @@ # Examples from Google Cloud documentation, licensed under Apache 2.0. # # Spanner syntax the reference parser rejects with -# --enabled_language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE +# --enabled_language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE # (classified "spanner" in cmd/spanner-corpus/triage.txt). There is no # golden parse tree for these. diff --git a/parser/testdata/spanner/guides/primary-key-default-value.test b/parser/testdata/spanner/guides/primary-key-default-value.test index 01a1db6..3422e1a 100644 --- a/parser/testdata/spanner/guides/primary-key-default-value.test +++ b/parser/testdata/spanner/guides/primary-key-default-value.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/primary-key-default-value # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/primary-key-default-value#universally_unique_identifier_uuid -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] CREATE TABLE Fans ( diff --git a/parser/testdata/spanner/guides/query-columnar-data.test b/parser/testdata/spanner/guides/query-columnar-data.test index fdc6419..153a735 100644 --- a/parser/testdata/spanner/guides/query-columnar-data.test +++ b/parser/testdata/spanner/guides/query-columnar-data.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/query-columnar-data # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/query-columnar-data#query-columnar-data-using-bigquery -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] SELECT SUM(MarketingBudget) AS total_marketing_spend diff --git a/parser/testdata/spanner/guides/query-execution-plans.test b/parser/testdata/spanner/guides/query-execution-plans.test index 307156d..c562c1e 100644 --- a/parser/testdata/spanner/guides/query-execution-plans.test +++ b/parser/testdata/spanner/guides/query-execution-plans.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/query-execution-plans # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/query-execution-plans#overview -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] CREATE INDEX SingersByFirstLastName ON Singers(FirstName, LastName) diff --git a/parser/testdata/spanner/guides/query-optimizer.manage-query-optimizer.test b/parser/testdata/spanner/guides/query-optimizer.manage-query-optimizer.test index 5686eda..c771452 100644 --- a/parser/testdata/spanner/guides/query-optimizer.manage-query-optimizer.test +++ b/parser/testdata/spanner/guides/query-optimizer.manage-query-optimizer.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/query-optimizer/manage-query-optimizer # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/query-optimizer/manage-query-optimizer#list-optimizer-versions -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] SELECT * FROM SPANNER_SYS.SUPPORTED_OPTIMIZER_VERSIONS diff --git a/parser/testdata/spanner/guides/query-optimizer.versions.test b/parser/testdata/spanner/guides/query-optimizer.versions.test index a5281ea..55e6c52 100644 --- a/parser/testdata/spanner/guides/query-optimizer.versions.test +++ b/parser/testdata/spanner/guides/query-optimizer.versions.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/query-optimizer/versions # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/query-optimizer/versions#version-9 -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] SELECT s.SingerId, s.FirstName, s.LastName diff --git a/parser/testdata/spanner/guides/queues.queues-examples.spanner.sql b/parser/testdata/spanner/guides/queues.queues-examples.spanner.sql index ed77de2..8158d24 100644 --- a/parser/testdata/spanner/guides/queues.queues-examples.spanner.sql +++ b/parser/testdata/spanner/guides/queues.queues-examples.spanner.sql @@ -3,7 +3,7 @@ # Examples from Google Cloud documentation, licensed under Apache 2.0. # # Spanner syntax the reference parser rejects with -# --enabled_language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE +# --enabled_language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE # (classified "spanner" in cmd/spanner-corpus/triage.txt). There is no # golden parse tree for these. diff --git a/parser/testdata/spanner/guides/queues.queues-examples.test b/parser/testdata/spanner/guides/queues.queues-examples.test index 930c0f3..c126020 100644 --- a/parser/testdata/spanner/guides/queues.queues-examples.test +++ b/parser/testdata/spanner/guides/queues.queues-examples.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/queues/queues-examples # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/queues/queues-examples#perform_work_after_a_transaction_commits -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] -- Inside your application transaction: diff --git a/parser/testdata/spanner/guides/queues.queues-using.spanner.sql b/parser/testdata/spanner/guides/queues.queues-using.spanner.sql index 6992199..95d7ac2 100644 --- a/parser/testdata/spanner/guides/queues.queues-using.spanner.sql +++ b/parser/testdata/spanner/guides/queues.queues-using.spanner.sql @@ -3,7 +3,7 @@ # Examples from Google Cloud documentation, licensed under Apache 2.0. # # Spanner syntax the reference parser rejects with -# --enabled_language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE +# --enabled_language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE # (classified "spanner" in cmd/spanner-corpus/triage.txt). There is no # golden parse tree for these. diff --git a/parser/testdata/spanner/guides/queues.queues-using.test b/parser/testdata/spanner/guides/queues.queues-using.test index e5c1809..7905404 100644 --- a/parser/testdata/spanner/guides/queues.queues-using.test +++ b/parser/testdata/spanner/guides/queues.queues-using.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/queues/queues-using # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/queues/queues-using#create_a_queue -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] -- Example table for interleaving diff --git a/parser/testdata/spanner/guides/schema-and-data-model.spanner.sql b/parser/testdata/spanner/guides/schema-and-data-model.spanner.sql index 1334a73..e03827e 100644 --- a/parser/testdata/spanner/guides/schema-and-data-model.spanner.sql +++ b/parser/testdata/spanner/guides/schema-and-data-model.spanner.sql @@ -3,7 +3,7 @@ # Examples from Google Cloud documentation, licensed under Apache 2.0. # # Spanner syntax the reference parser rejects with -# --enabled_language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE +# --enabled_language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE # (classified "spanner" in cmd/spanner-corpus/triage.txt). There is no # golden parse tree for these. diff --git a/parser/testdata/spanner/guides/schema-and-data-model.test b/parser/testdata/spanner/guides/schema-and-data-model.test index a7f7e7a..15bdbda 100644 --- a/parser/testdata/spanner/guides/schema-and-data-model.test +++ b/parser/testdata/spanner/guides/schema-and-data-model.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/schema-and-data-model # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/schema-and-data-model#create_a_parent_table -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] CREATE TABLE Singers ( diff --git a/parser/testdata/spanner/guides/schema-design.spanner.sql b/parser/testdata/spanner/guides/schema-design.spanner.sql index 226a0a0..1937ba2 100644 --- a/parser/testdata/spanner/guides/schema-design.spanner.sql +++ b/parser/testdata/spanner/guides/schema-design.spanner.sql @@ -3,7 +3,7 @@ # Examples from Google Cloud documentation, licensed under Apache 2.0. # # Spanner syntax the reference parser rejects with -# --enabled_language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE +# --enabled_language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE # (classified "spanner" in cmd/spanner-corpus/triage.txt). There is no # golden parse tree for these. diff --git a/parser/testdata/spanner/guides/schema-design.test b/parser/testdata/spanner/guides/schema-design.test index f37d098..aa5bc3c 100644 --- a/parser/testdata/spanner/guides/schema-design.test +++ b/parser/testdata/spanner/guides/schema-design.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/schema-design # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/schema-design#uuid_primary_key -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] CREATE TABLE UserAccessLogs ( diff --git a/parser/testdata/spanner/guides/schema-updates-best-practices.test b/parser/testdata/spanner/guides/schema-updates-best-practices.test index 88be6f8..9f0a66f 100644 --- a/parser/testdata/spanner/guides/schema-updates-best-practices.test +++ b/parser/testdata/spanner/guides/schema-updates-best-practices.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/schema-updates-best-practices # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/schema-updates-best-practices#large-updates -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] CREATE TABLE Singers ( diff --git a/parser/testdata/spanner/guides/schema-updates.spanner.sql b/parser/testdata/spanner/guides/schema-updates.spanner.sql index b4f782e..613b67f 100644 --- a/parser/testdata/spanner/guides/schema-updates.spanner.sql +++ b/parser/testdata/spanner/guides/schema-updates.spanner.sql @@ -3,7 +3,7 @@ # Examples from Google Cloud documentation, licensed under Apache 2.0. # # Spanner syntax the reference parser rejects with -# --enabled_language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE +# --enabled_language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE # (classified "spanner" in cmd/spanner-corpus/triage.txt). There is no # golden parse tree for these. diff --git a/parser/testdata/spanner/guides/schema-updates.test b/parser/testdata/spanner/guides/schema-updates.test index db8bd81..14bcd02 100644 --- a/parser/testdata/spanner/guides/schema-updates.test +++ b/parser/testdata/spanner/guides/schema-updates.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/schema-updates # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/schema-updates#updates-that-require-validation -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] [mode=expression] diff --git a/parser/testdata/spanner/guides/secondary-indexes.spanner.sql b/parser/testdata/spanner/guides/secondary-indexes.spanner.sql index bf7b5ba..f2f691a 100644 --- a/parser/testdata/spanner/guides/secondary-indexes.spanner.sql +++ b/parser/testdata/spanner/guides/secondary-indexes.spanner.sql @@ -3,7 +3,7 @@ # Examples from Google Cloud documentation, licensed under Apache 2.0. # # Spanner syntax the reference parser rejects with -# --enabled_language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE +# --enabled_language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE # (classified "spanner" in cmd/spanner-corpus/triage.txt). There is no # golden parse tree for these. diff --git a/parser/testdata/spanner/guides/secondary-indexes.test b/parser/testdata/spanner/guides/secondary-indexes.test index 9e5ce98..0f4fe4d 100644 --- a/parser/testdata/spanner/guides/secondary-indexes.test +++ b/parser/testdata/spanner/guides/secondary-indexes.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/secondary-indexes # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/secondary-indexes#add-index -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] CREATE INDEX SongsBySingerSongName ON Songs(SingerId, SongName), diff --git a/parser/testdata/spanner/guides/sequence-tasks.test b/parser/testdata/spanner/guides/sequence-tasks.test index 4989dd1..a6bde50 100644 --- a/parser/testdata/spanner/guides/sequence-tasks.test +++ b/parser/testdata/spanner/guides/sequence-tasks.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/sequence-tasks # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/sequence-tasks#sequence-options -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] CREATE SEQUENCE IF NOT EXISTS customer_garage_seq_seed OPTIONS ( diff --git a/parser/testdata/spanner/guides/set-default-time-zone.test b/parser/testdata/spanner/guides/set-default-time-zone.test index efbdf73..adeb37f 100644 --- a/parser/testdata/spanner/guides/set-default-time-zone.test +++ b/parser/testdata/spanner/guides/set-default-time-zone.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/set-default-time-zone # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/set-default-time-zone#default_time_zone_not_customized -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] SELECT TIMESTAMP("2072-12-25 15:30:00") AS timestamp_str diff --git a/parser/testdata/spanner/guides/sql-best-practices.test b/parser/testdata/spanner/guides/sql-best-practices.test index 433cdcc..bbc2cc7 100644 --- a/parser/testdata/spanner/guides/sql-best-practices.test +++ b/parser/testdata/spanner/guides/sql-best-practices.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/sql-best-practices # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/sql-best-practices# -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] CREATE TABLE Singers ( diff --git a/parser/testdata/spanner/guides/storing-numeric-data.test b/parser/testdata/spanner/guides/storing-numeric-data.test index 4d48cba..2f4075c 100644 --- a/parser/testdata/spanner/guides/storing-numeric-data.test +++ b/parser/testdata/spanner/guides/storing-numeric-data.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/storing-numeric-data # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/storing-numeric-data#perform_approximate_aggregations_sorting_and_calculations -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] SELECT SUM(CAST(value AS FLOAT64)) FROM my_table diff --git a/parser/testdata/spanner/guides/table-name-synonym.spanner.sql b/parser/testdata/spanner/guides/table-name-synonym.spanner.sql index f2bd0d3..e446dc4 100644 --- a/parser/testdata/spanner/guides/table-name-synonym.spanner.sql +++ b/parser/testdata/spanner/guides/table-name-synonym.spanner.sql @@ -3,7 +3,7 @@ # Examples from Google Cloud documentation, licensed under Apache 2.0. # # Spanner syntax the reference parser rejects with -# --enabled_language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE +# --enabled_language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE # (classified "spanner" in cmd/spanner-corpus/triage.txt). There is no # golden parse tree for these. diff --git a/parser/testdata/spanner/guides/table-name-synonym.test b/parser/testdata/spanner/guides/table-name-synonym.test index 401853d..7c8781a 100644 --- a/parser/testdata/spanner/guides/table-name-synonym.test +++ b/parser/testdata/spanner/guides/table-name-synonym.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/table-name-synonym # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/table-name-synonym#rename-table -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] ALTER TABLE table_name RENAME TO new_table_name diff --git a/parser/testdata/spanner/guides/troubleshooting-performance-regressions.test b/parser/testdata/spanner/guides/troubleshooting-performance-regressions.test index ba2ae5e..458fab9 100644 --- a/parser/testdata/spanner/guides/troubleshooting-performance-regressions.test +++ b/parser/testdata/spanner/guides/troubleshooting-performance-regressions.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/troubleshooting-performance-regressions # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/troubleshooting-performance-regressions#operators-table-scan -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] SELECT AlbumTitle FROM Albums WHERE STARTS_WITH(AlbumTitle, "Now") diff --git a/parser/testdata/spanner/guides/ttl.monitoring-and-metrics.test b/parser/testdata/spanner/guides/ttl.monitoring-and-metrics.test index 5e31718..d0796fd 100644 --- a/parser/testdata/spanner/guides/ttl.monitoring-and-metrics.test +++ b/parser/testdata/spanner/guides/ttl.monitoring-and-metrics.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/ttl/monitoring-and-metrics # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/ttl/monitoring-and-metrics#use-query -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] SELECT TABLE_NAME, UNDELETABLE_ROWS diff --git a/parser/testdata/spanner/guides/ttl.working-with-ttl.spanner.sql b/parser/testdata/spanner/guides/ttl.working-with-ttl.spanner.sql index a577475..a9aec37 100644 --- a/parser/testdata/spanner/guides/ttl.working-with-ttl.spanner.sql +++ b/parser/testdata/spanner/guides/ttl.working-with-ttl.spanner.sql @@ -3,7 +3,7 @@ # Examples from Google Cloud documentation, licensed under Apache 2.0. # # Spanner syntax the reference parser rejects with -# --enabled_language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE +# --enabled_language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE # (classified "spanner" in cmd/spanner-corpus/triage.txt). There is no # golden parse tree for these. @@ -39,15 +39,3 @@ CREATE TABLE Orders ( TIMESTAMP_ADD(LastModifiedDate, INTERVAL 180 DAY))) STORED, ) PRIMARY KEY(OrderId), ROW DELETION POLICY (OLDER_THAN(ExpiredDate, INTERVAL 0 DAY)); - -# https://docs.cloud.google.com/spanner/docs/ttl/working-with-ttl#delete -# id ebe181a95224: row deletion policy (TTL) (ttl.working-with-ttl) -# execute_query: INVALID_ARGUMENT: DROP ROW DELETION POLICY clause is not supported. [at 2:6] -ALTER TABLE MyTable -DROP ROW DELETION POLICY; - -# https://docs.cloud.google.com/spanner/docs/ttl/working-with-ttl#modify -# id 1de829b56fcf: row deletion policy (TTL) (ttl.working-with-ttl) -# execute_query: INVALID_ARGUMENT: REPLACE ROW DELETION POLICY clause is not supported. [at 2:9] -ALTER TABLE MyTable -REPLACE ROW DELETION POLICY (OLDER_THAN(ModifiedAt, INTERVAL 7 DAY)); diff --git a/parser/testdata/spanner/guides/ttl.working-with-ttl.test b/parser/testdata/spanner/guides/ttl.working-with-ttl.test index 890f346..5372012 100644 --- a/parser/testdata/spanner/guides/ttl.working-with-ttl.test +++ b/parser/testdata/spanner/guides/ttl.working-with-ttl.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/ttl/working-with-ttl # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/ttl/working-with-ttl#verify_your_conditions -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] SELECT COUNT(*) @@ -213,6 +213,16 @@ CreateTableStatement [0-123] PrimaryKeyElement(ASC) [112-122] Identifier(CustomerID) [112-122] == +# https://docs.cloud.google.com/spanner/docs/ttl/working-with-ttl#delete +ALTER TABLE MyTable +DROP ROW DELETION POLICY +-- +AlterTableStatement [0-44] + PathExpression [12-19] + Identifier(MyTable) [12-19] + AlterActionList [20-44] + DropTtlAction [20-44] +== # https://docs.cloud.google.com/spanner/docs/ttl/working-with-ttl#view SELECT TABLE_NAME, ROW_DELETION_POLICY_EXPRESSION FROM INFORMATION_SCHEMA.TABLES @@ -238,3 +248,21 @@ QueryStatement [0-129] PathExpression [87-117] Identifier(ROW_DELETION_POLICY_EXPRESSION) [87-117] NullLiteral(NULL) [125-129] +== +# https://docs.cloud.google.com/spanner/docs/ttl/working-with-ttl#modify +ALTER TABLE MyTable +REPLACE ROW DELETION POLICY (OLDER_THAN(ModifiedAt, INTERVAL 7 DAY)) +-- +AlterTableStatement [0-88] + PathExpression [12-19] + Identifier(MyTable) [12-19] + AlterActionList [20-88] + ReplaceTtlAction [20-88] + FunctionCall [49-87] + PathExpression [49-59] + Identifier(OLDER_THAN) [49-59] + PathExpression [60-70] + Identifier(ModifiedAt) [60-70] + IntervalExpr [72-86] + IntLiteral(7) [81-82] + Identifier(DAY) [83-86] diff --git a/parser/testdata/spanner/guides/use-pitr.spanner.sql b/parser/testdata/spanner/guides/use-pitr.spanner.sql index 73f71d3..63292fd 100644 --- a/parser/testdata/spanner/guides/use-pitr.spanner.sql +++ b/parser/testdata/spanner/guides/use-pitr.spanner.sql @@ -3,7 +3,7 @@ # Examples from Google Cloud documentation, licensed under Apache 2.0. # # Spanner syntax the reference parser rejects with -# --enabled_language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE +# --enabled_language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE # (classified "spanner" in cmd/spanner-corpus/triage.txt). There is no # golden parse tree for these. diff --git a/parser/testdata/spanner/guides/use-pitr.test b/parser/testdata/spanner/guides/use-pitr.test index 1c6e97c..e5f4a13 100644 --- a/parser/testdata/spanner/guides/use-pitr.test +++ b/parser/testdata/spanner/guides/use-pitr.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/use-pitr # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/use-pitr#estimate-storage -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] SELECT diff --git a/parser/testdata/spanner/guides/use-select-for-update-repeatable-read.test b/parser/testdata/spanner/guides/use-select-for-update-repeatable-read.test index ad6799b..5318190 100644 --- a/parser/testdata/spanner/guides/use-select-for-update-repeatable-read.test +++ b/parser/testdata/spanner/guides/use-select-for-update-repeatable-read.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/use-select-for-update-repeatable-read # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/use-select-for-update-repeatable-read#query-syntax -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] SELECT SingerId, SingerInfo diff --git a/parser/testdata/spanner/guides/use-select-for-update-serializable.test b/parser/testdata/spanner/guides/use-select-for-update-serializable.test index e8415e1..774d3a4 100644 --- a/parser/testdata/spanner/guides/use-select-for-update-serializable.test +++ b/parser/testdata/spanner/guides/use-select-for-update-serializable.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/use-select-for-update-serializable # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/use-select-for-update-serializable#comparison -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] @{lock_scanned_ranges=exclusive} diff --git a/parser/testdata/spanner/guides/vector-index-best-practices.metadata.json b/parser/testdata/spanner/guides/vector-index-best-practices.metadata.json deleted file mode 100644 index 0967ef4..0000000 --- a/parser/testdata/spanner/guides/vector-index-best-practices.metadata.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/parser/testdata/spanner/guides/vector-index-best-practices.test b/parser/testdata/spanner/guides/vector-index-best-practices.test index 5d67dc6..d727696 100644 --- a/parser/testdata/spanner/guides/vector-index-best-practices.test +++ b/parser/testdata/spanner/guides/vector-index-best-practices.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/vector-index-best-practices # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/vector-index-best-practices#determine-vector-search-option-values -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] SELECT diff --git a/parser/testdata/spanner/guides/vector-indexes.spanner.sql b/parser/testdata/spanner/guides/vector-indexes.spanner.sql index 6a5e09c..452f435 100644 --- a/parser/testdata/spanner/guides/vector-indexes.spanner.sql +++ b/parser/testdata/spanner/guides/vector-indexes.spanner.sql @@ -3,7 +3,7 @@ # Examples from Google Cloud documentation, licensed under Apache 2.0. # # Spanner syntax the reference parser rejects with -# --enabled_language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE +# --enabled_language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE # (classified "spanner" in cmd/spanner-corpus/triage.txt). There is no # golden parse tree for these. diff --git a/parser/testdata/spanner/guides/vector-indexes.test b/parser/testdata/spanner/guides/vector-indexes.test index 9f192ee..e824612 100644 --- a/parser/testdata/spanner/guides/vector-indexes.test +++ b/parser/testdata/spanner/guides/vector-indexes.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/vector-indexes # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/vector-indexes#create-vector-index -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] CREATE VECTOR INDEX DocEmbeddingIndex diff --git a/parser/testdata/spanner/guides/vector-search-best-practices.test b/parser/testdata/spanner/guides/vector-search-best-practices.test index 00ec5c5..cc9fd41 100644 --- a/parser/testdata/spanner/guides/vector-search-best-practices.test +++ b/parser/testdata/spanner/guides/vector-search-best-practices.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/vector-search-best-practices # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/vector-search-best-practices#use-top-k-query -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] SELECT d.DocId diff --git a/parser/testdata/spanner/guides/vector-search-tutorial.spanner.sql b/parser/testdata/spanner/guides/vector-search-tutorial.spanner.sql index ffa202e..a72278d 100644 --- a/parser/testdata/spanner/guides/vector-search-tutorial.spanner.sql +++ b/parser/testdata/spanner/guides/vector-search-tutorial.spanner.sql @@ -3,7 +3,7 @@ # Examples from Google Cloud documentation, licensed under Apache 2.0. # # Spanner syntax the reference parser rejects with -# --enabled_language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE +# --enabled_language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE # (classified "spanner" in cmd/spanner-corpus/triage.txt). There is no # golden parse tree for these. diff --git a/parser/testdata/spanner/guides/vector-search-tutorial.test b/parser/testdata/spanner/guides/vector-search-tutorial.test index 5416de4..9283f4c 100644 --- a/parser/testdata/spanner/guides/vector-search-tutorial.test +++ b/parser/testdata/spanner/guides/vector-search-tutorial.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/vector-search-tutorial # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/vector-search-tutorial#create-database -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] CREATE TABLE products ( diff --git a/parser/testdata/spanner/guides/working-with-json.metadata.json b/parser/testdata/spanner/guides/working-with-json.metadata.json deleted file mode 100644 index 0967ef4..0000000 --- a/parser/testdata/spanner/guides/working-with-json.metadata.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/parser/testdata/spanner/guides/working-with-json.test b/parser/testdata/spanner/guides/working-with-json.test index 896cb93..06e4be5 100644 --- a/parser/testdata/spanner/guides/working-with-json.test +++ b/parser/testdata/spanner/guides/working-with-json.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/working-with-json # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/working-with-json#nullability -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] SELECT (JSON '{"a":null}').a IS NULL diff --git a/parser/testdata/spanner/guides/write-sql-gemini.test b/parser/testdata/spanner/guides/write-sql-gemini.test index 1d436ce..9ce4e5c 100644 --- a/parser/testdata/spanner/guides/write-sql-gemini.test +++ b/parser/testdata/spanner/guides/write-sql-gemini.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/write-sql-gemini # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/write-sql-gemini#generate-sql-queries-using-natural-language-prompts -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] INSERT INTO Singers (SingerId, FirstName, LastName, BirthDate) diff --git a/parser/testdata/spanner/hash_functions.test b/parser/testdata/spanner/hash_functions.test index a84c672..2aa4c76 100644 --- a/parser/testdata/spanner/hash_functions.test +++ b/parser/testdata/spanner/hash_functions.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/reference/standard-sql/hash_functions # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/reference/standard-sql/hash_functions#farm_fingerprint -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] [mode=expression] diff --git a/parser/testdata/spanner/interval_functions.test b/parser/testdata/spanner/interval_functions.test index 21f7d27..9970c87 100644 --- a/parser/testdata/spanner/interval_functions.test +++ b/parser/testdata/spanner/interval_functions.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/reference/standard-sql/interval_functions # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/reference/standard-sql/interval_functions#extract -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] [mode=expression] diff --git a/parser/testdata/spanner/json_functions.test b/parser/testdata/spanner/json_functions.test index 7682888..d40f6d2 100644 --- a/parser/testdata/spanner/json_functions.test +++ b/parser/testdata/spanner/json_functions.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/reference/standard-sql/json_functions # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/reference/standard-sql/json_functions#bool_for_json -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] [mode=expression] diff --git a/parser/testdata/spanner/lexical.test b/parser/testdata/spanner/lexical.test index a01621c..217b93f 100644 --- a/parser/testdata/spanner/lexical.test +++ b/parser/testdata/spanner/lexical.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/reference/standard-sql/lexical # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/reference/standard-sql/lexical#identifier_examples -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] [mode=expression] diff --git a/parser/testdata/spanner/mathematical_functions.test b/parser/testdata/spanner/mathematical_functions.test index 986c158..9b60daa 100644 --- a/parser/testdata/spanner/mathematical_functions.test +++ b/parser/testdata/spanner/mathematical_functions.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/reference/standard-sql/mathematical_functions # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/reference/standard-sql/mathematical_functions#abs -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] [mode=expression] diff --git a/parser/testdata/spanner/ml-functions.test b/parser/testdata/spanner/ml-functions.test index c9b1735..0a857bb 100644 --- a/parser/testdata/spanner/ml-functions.test +++ b/parser/testdata/spanner/ml-functions.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/reference/standard-sql/ml-functions # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/reference/standard-sql/ml-functions#aiclassify -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] [mode=expression] diff --git a/parser/testdata/spanner/net_functions.test b/parser/testdata/spanner/net_functions.test index 10f30ae..5546d29 100644 --- a/parser/testdata/spanner/net_functions.test +++ b/parser/testdata/spanner/net_functions.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/reference/standard-sql/net_functions # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/reference/standard-sql/net_functions#nethost -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] [mode=expression] diff --git a/parser/testdata/spanner/operators.test b/parser/testdata/spanner/operators.test index 028679d..4f5591b 100644 --- a/parser/testdata/spanner/operators.test +++ b/parser/testdata/spanner/operators.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/reference/standard-sql/operators # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/reference/standard-sql/operators#field_access_operator -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] SELECT diff --git a/parser/testdata/spanner/pipe-syntax.test b/parser/testdata/spanner/pipe-syntax.test index c3c05d6..e833861 100644 --- a/parser/testdata/spanner/pipe-syntax.test +++ b/parser/testdata/spanner/pipe-syntax.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/reference/standard-sql/pipe-syntax # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/reference/standard-sql/pipe-syntax#query_comparison -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] CREATE TABLE Produce( diff --git a/parser/testdata/spanner/procedural-language.test b/parser/testdata/spanner/procedural-language.test index d4e3c59..826ee7e 100644 --- a/parser/testdata/spanner/procedural-language.test +++ b/parser/testdata/spanner/procedural-language.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/reference/standard-sql/procedural-language # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/reference/standard-sql/procedural-language#call -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] CALL cancel_query("12345") diff --git a/parser/testdata/spanner/protocol-buffers.spanner.sql b/parser/testdata/spanner/protocol-buffers.spanner.sql index 281cfeb..e5ffd1b 100644 --- a/parser/testdata/spanner/protocol-buffers.spanner.sql +++ b/parser/testdata/spanner/protocol-buffers.spanner.sql @@ -3,7 +3,7 @@ # Examples from Google Cloud documentation, licensed under Apache 2.0. # # Spanner syntax the reference parser rejects with -# --enabled_language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE +# --enabled_language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE # (classified "spanner" in cmd/spanner-corpus/triage.txt). There is no # golden parse tree for these. diff --git a/parser/testdata/spanner/protocol-buffers.test b/parser/testdata/spanner/protocol-buffers.test index 105d930..a66fe98 100644 --- a/parser/testdata/spanner/protocol-buffers.test +++ b/parser/testdata/spanner/protocol-buffers.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/reference/standard-sql/protocol-buffers # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/reference/standard-sql/protocol-buffers#cast_to_or_from_a_protocol_buffer -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] SELECT CAST('first_name: "Alana", last_name: "Yah", customer_no: 1234' diff --git a/parser/testdata/spanner/query-syntax.test b/parser/testdata/spanner/query-syntax.test index a7b5050..5f9cf8d 100644 --- a/parser/testdata/spanner/query-syntax.test +++ b/parser/testdata/spanner/query-syntax.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/reference/standard-sql/query-syntax # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/reference/standard-sql/query-syntax#select_star -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] SELECT * FROM (SELECT "apple" AS fruit, "carrot" AS vegetable) diff --git a/parser/testdata/spanner/search_functions.metadata.json b/parser/testdata/spanner/search_functions.metadata.json deleted file mode 100644 index 0967ef4..0000000 --- a/parser/testdata/spanner/search_functions.metadata.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/parser/testdata/spanner/search_functions.test b/parser/testdata/spanner/search_functions.test index ae3e5e0..8c71911 100644 --- a/parser/testdata/spanner/search_functions.test +++ b/parser/testdata/spanner/search_functions.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/reference/standard-sql/search_functions # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/reference/standard-sql/search_functions#debug_tokenlist -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] [mode=expression] diff --git a/parser/testdata/spanner/security_functions.test b/parser/testdata/spanner/security_functions.test index e1c5faf..0f92ae3 100644 --- a/parser/testdata/spanner/security_functions.test +++ b/parser/testdata/spanner/security_functions.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/reference/standard-sql/security_functions # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/reference/standard-sql/security_functions#session_user -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] [mode=expression] diff --git a/parser/testdata/spanner/sequence_functions.test b/parser/testdata/spanner/sequence_functions.test index 3d378fc..6ec87df 100644 --- a/parser/testdata/spanner/sequence_functions.test +++ b/parser/testdata/spanner/sequence_functions.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/reference/standard-sql/sequence_functions # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/reference/standard-sql/sequence_functions#get_internal_sequence_state -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] [mode=expression] diff --git a/parser/testdata/spanner/statistical_aggregate_functions.test b/parser/testdata/spanner/statistical_aggregate_functions.test index 191582c..b06ea3b 100644 --- a/parser/testdata/spanner/statistical_aggregate_functions.test +++ b/parser/testdata/spanner/statistical_aggregate_functions.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/reference/standard-sql/statistical_aggregate_functions # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/reference/standard-sql/statistical_aggregate_functions#stddev_samp -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] SELECT STDDEV_SAMP(x) AS results FROM UNNEST([10, 14, 18]) AS x diff --git a/parser/testdata/spanner/stored-procedures.test b/parser/testdata/spanner/stored-procedures.test index ac69249..5d6c555 100644 --- a/parser/testdata/spanner/stored-procedures.test +++ b/parser/testdata/spanner/stored-procedures.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/reference/standard-sql/stored-procedures # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/reference/standard-sql/stored-procedures#syntax_2 -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] CALL compact_all() diff --git a/parser/testdata/spanner/string_functions.test b/parser/testdata/spanner/string_functions.test index 148aff8..ce36457 100644 --- a/parser/testdata/spanner/string_functions.test +++ b/parser/testdata/spanner/string_functions.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/reference/standard-sql/string_functions # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/reference/standard-sql/string_functions#byte_length -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] [mode=expression] diff --git a/parser/testdata/spanner/subqueries.test b/parser/testdata/spanner/subqueries.test index ef64219..75d1dd5 100644 --- a/parser/testdata/spanner/subqueries.test +++ b/parser/testdata/spanner/subqueries.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/reference/standard-sql/subqueries # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/reference/standard-sql/subqueries#about_subqueries -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] SELECT username diff --git a/parser/testdata/spanner/timestamp_functions.spanner.sql b/parser/testdata/spanner/timestamp_functions.spanner.sql index 9297cb0..1c79170 100644 --- a/parser/testdata/spanner/timestamp_functions.spanner.sql +++ b/parser/testdata/spanner/timestamp_functions.spanner.sql @@ -3,7 +3,7 @@ # Examples from Google Cloud documentation, licensed under Apache 2.0. # # Spanner syntax the reference parser rejects with -# --enabled_language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE +# --enabled_language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE # (classified "spanner" in cmd/spanner-corpus/triage.txt). There is no # golden parse tree for these. diff --git a/parser/testdata/spanner/timestamp_functions.test b/parser/testdata/spanner/timestamp_functions.test index 10f42cd..364f424 100644 --- a/parser/testdata/spanner/timestamp_functions.test +++ b/parser/testdata/spanner/timestamp_functions.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/reference/standard-sql/timestamp_functions # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/reference/standard-sql/timestamp_functions#current_timestamp -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] [mode=expression] diff --git a/parser/testdata/spanner/utility-functions.test b/parser/testdata/spanner/utility-functions.test index 974cb62..641f5a2 100644 --- a/parser/testdata/spanner/utility-functions.test +++ b/parser/testdata/spanner/utility-functions.test @@ -2,7 +2,7 @@ # Source: https://docs.cloud.google.com/spanner/docs/reference/standard-sql/utility-functions # Examples from Google Cloud documentation, licensed under Apache 2.0. # https://docs.cloud.google.com/spanner/docs/reference/standard-sql/utility-functions#generate_uuid -[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] +[default language_features=MAXIMUM,+SPANNER_LEGACY_DDL,+TTL,+CREATE_LOCALITY_GROUP,+SQL_GRAPH,+SQL_GRAPH_ADVANCED_QUERY,+SQL_GRAPH_BOUNDED_PATH_QUANTIFICATION,+SQL_GRAPH_PATH_TYPE,+SQL_GRAPH_PATH_MODE] [default no_show_parse_location_text] [default reserve_graph_table] [mode=expression]