Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,9 @@ private static Type parseSpannerType(String spannerType, Dialect dialect) {
if (spannerType.startsWith("STRING")) {
return Type.string();
}
if ("UUID".equals(spannerType)) {
return Type.string();
}
if (spannerType.startsWith("BYTES")) {
return Type.bytes();
}
Expand Down Expand Up @@ -260,6 +263,9 @@ private static Type parseSpannerType(String spannerType, Dialect dialect) {
if (spannerType.startsWith("JSONB")) {
return Type.pgJsonb();
}
if ("UUID".equals(spannerType)) {
return Type.string();
}
throw new IllegalArgumentException("Unknown spanner type " + spannerType);
default:
throw new IllegalArgumentException("Unrecognized dialect: " + dialect.name());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,19 @@ public void testSingleTable() throws Exception {
.addColumn("test", "protoVal", "PROTO<customer.app.TestMessage>")
.addColumn("test", "enumVal", "ENUM<customer.app.TestEnum>")
.addColumn("test", "tokens", "TOKENLIST")
.addColumn("test", "uuidCol", "UUID")
.build();

assertEquals(1, schema.getTables().size());
assertEquals(7, schema.getColumns("test").size());
assertEquals(8, 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());
assertEquals(Type.string(), schema.getColumns("test").get(7).getType());
}

@Test
Expand Down Expand Up @@ -84,12 +86,14 @@ public void testSinglePgTable() throws Exception {
.addColumn("test", "numericVal", "numeric")
.addColumn("test", "commitTime", "spanner.commit_timestamp")
.addColumn("test", "jsonbCol", "jsonb")
.addColumn("test", "uuidCol", "uuid")
.build();

assertEquals(1, schema.getTables().size());
assertEquals(5, schema.getColumns("test").size());
assertEquals(6, schema.getColumns("test").size());
assertEquals(1, schema.getKeyParts("test").size());
assertEquals(Type.timestamp(), schema.getColumns("test").get(3).getType());
assertEquals(Type.string(), schema.getColumns("test").get(5).getType());
}

@Test
Expand Down
Loading