Skip to content

Commit 04d7cf6

Browse files
committed
feat: add support index OPTIONS clause
1 parent 8d8d074 commit 04d7cf6

3 files changed

Lines changed: 14 additions & 7 deletions

File tree

src/main/java/com/google/cloud/solutions/spannerddl/parser/ASTcreate_index_statement.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ public String toStringOptionalExistClause(boolean includeExists) {
6666
getChildByType(children, ASTcolumns.class),
6767
getOptionalChildByType(children, ASTstored_column_list.class),
6868
(interleave != null ? "," : null),
69-
interleave);
69+
interleave,
70+
getOptions());
7071
}
7172

7273
/**
@@ -91,7 +92,12 @@ public String getDefinitionWithoutStoring() {
9192
getChildByType(children, ASTtable.class),
9293
getChildByType(children, ASTcolumns.class),
9394
(interleave != null ? "," : null),
94-
interleave);
95+
interleave,
96+
getOptions());
97+
}
98+
99+
public ASToptions_clause getOptions() {
100+
return getOptionalChildByType(children, ASToptions_clause.class);
95101
}
96102

97103
private void validateChildren() {
@@ -105,7 +111,8 @@ private void validateChildren() {
105111
ASTif_not_exists.class,
106112
ASTname.class,
107113
ASTtable.class,
108-
ASTindex_interleave_clause.class));
114+
ASTindex_interleave_clause.class,
115+
ASToptions_clause.class));
109116
}
110117

111118
public List<String> getStoredColumnNames() {

src/test/resources/ddlParserUnsupported.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -261,8 +261,4 @@ CREATE TABLE test_table (
261261

262262
CREATE INDEX IF NOT EXISTS usage ON usage_table ( mycol ASC ) WHERE mycol IS NOT NULL
263263

264-
== Test 34 create index options clause
265-
266-
CREATE INDEX IF NOT EXISTS usage ON usage_table ( mycol ASC ) OPTIONS ( key = 'value' )
267-
268264
==

src/test/resources/ddlParserValidation.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,4 +203,8 @@ CREATE TABLE test1 (
203203
value INT64
204204
) PRIMARY KEY (keycol ASC), INTERLEAVE IN other_table ON DELETE NO ACTION
205205

206+
== Test 21 create index with OPTIONS
207+
208+
CREATE INDEX myIndex ON mytable ( key ASC, index ASC ) STORING ( table ) , INTERLEAVE IN parent_table OPTIONS (some_option='enabled')
209+
206210
==

0 commit comments

Comments
 (0)