From e61afbefbbc05bf01ae2dbd6a305e5d4ccacc807 Mon Sep 17 00:00:00 2001 From: Niel Markwick Date: Wed, 19 Jun 2024 20:30:57 +0200 Subject: [PATCH] fix: add equals to ASToptions_clause Fixes #117 --- .../solutions/spannerddl/parser/ASToptions_clause.java | 5 +++++ src/test/resources/newDdl.txt | 2 +- src/test/resources/originalDdl.txt | 8 ++------ 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/google/cloud/solutions/spannerddl/parser/ASToptions_clause.java b/src/main/java/com/google/cloud/solutions/spannerddl/parser/ASToptions_clause.java index 47cd75c..ff206c7 100644 --- a/src/main/java/com/google/cloud/solutions/spannerddl/parser/ASToptions_clause.java +++ b/src/main/java/com/google/cloud/solutions/spannerddl/parser/ASToptions_clause.java @@ -42,4 +42,9 @@ public Map getKeyValueMap() { return AstTreeUtils.getChildrenAssertType(children, ASToption_key_val.class).stream() .collect(Collectors.toMap(ASToption_key_val::getKey, ASToption_key_val::getValue)); } + + @Override + public boolean equals(Object obj) { + return toString().equals(obj.toString()); + } } diff --git a/src/test/resources/newDdl.txt b/src/test/resources/newDdl.txt index d340021..b595477 100644 --- a/src/test/resources/newDdl.txt +++ b/src/test/resources/newDdl.txt @@ -493,6 +493,7 @@ STORING (scol1, scol3); CREATE SEARCH INDEX AlbumsIndex ON Albums (col1, col2, col3) +OPTIONS (sort_order_sharding=TRUE) == TEST 59 Add stored col to search index @@ -506,4 +507,3 @@ CREATE SEARCH INDEX AlbumsIndex ON Albums (col1, col2) == - diff --git a/src/test/resources/originalDdl.txt b/src/test/resources/originalDdl.txt index 6a6c827..1d92ec4 100644 --- a/src/test/resources/originalDdl.txt +++ b/src/test/resources/originalDdl.txt @@ -481,7 +481,7 @@ CREATE SEARCH INDEX AlbumsIndex ON Albums ( AlbumTitle_Tokens ASC, Rating_Tokens == TEST 57 Changing search index - before and after table changes -create table test1 ( col1 int64, col2 int64 ) primary key (col1); +create table test1 ( col1 int64, col2 int64 ) primary key (col1) ; CREATE SEARCH INDEX AlbumsIndex ON Albums (col1, col2) @@ -491,6 +491,7 @@ STORING (scol1, scol2); CREATE SEARCH INDEX AlbumsIndex ON Albums (col1, col2) +OPTIONS (sort_order_sharding=TRUE) == TEST 59 Add stored col to search index @@ -504,8 +505,3 @@ ON Albums (col1, col2) STORING (scol1) == - - - - -