Skip to content

Commit

Permalink
Added support for the TOKENLIST type in Spanner (#32038)
Browse files Browse the repository at this point in the history
  • Loading branch information
atask-g authored Aug 6, 2024
1 parent c606235 commit d09c323
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,9 @@ private static Type parseSpannerType(String spannerType, Dialect dialect) {
if (spannerType.startsWith("BYTES")) {
return Type.bytes();
}
if ("TOKENLIST".equals(spannerType)) {
return Type.bytes();
}
if ("TIMESTAMP".equals(spannerType)) {
return Type.timestamp();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,18 @@ public void testSingleTable() throws Exception {
.addColumn("test", "jsonVal", "JSON")
.addColumn("test", "protoVal", "PROTO<customer.app.TestMessage>")
.addColumn("test", "enumVal", "ENUM<customer.app.TestEnum>")
.addColumn("test", "tokens", "TOKENLIST")
.build();

assertEquals(1, schema.getTables().size());
assertEquals(6, schema.getColumns("test").size());
assertEquals(7, schema.getColumns("test").size());
assertEquals(1, schema.getKeyParts("test").size());
assertEquals(Type.json(), schema.getColumns("test").get(3).getType());
assertEquals(
Type.proto("customer.app.TestMessage"), schema.getColumns("test").get(4).getType());
assertEquals(
Type.protoEnum("customer.app.TestEnum"), schema.getColumns("test").get(5).getType());
assertEquals(Type.bytes(), schema.getColumns("test").get(6).getType());
}

@Test
Expand Down

0 comments on commit d09c323

Please sign in to comment.