Skip to content
Open
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 @@ -55,6 +55,7 @@ public String toString() {
case "DATE":
case "NUMERIC":
case "JSON":
case "UUID":
case "TOKENLIST":
return typeName;
case "STRING":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,20 @@ public void generateAlterTable_incompatibleTypeChange() {
"create table test1 (col1 float64) primary key (col1);",
true,
"Cannot change type of table test1 column col1");

// change type to UUID
getDiffCheckDdlDiffException(
"create table test1 (col1 int64, col2 int64) primary key (col1);",
"create table test1 (col1 int64, col2 uuid) primary key (col1);",
true,
"Cannot change type of table test1 column col2");

// change STRING(36) to UUID
getDiffCheckDdlDiffException(
"create table test1 (col1 int64, col2 string(36)) primary key (col1);",
"create table test1 (col1 int64, col2 uuid) primary key (col1);",
true,
"Cannot change type of table test1 column col2");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public void parseCreateTable() throws ParseException {
+ " (\"prefix\" || sizedstring || \"suffix\"), sizedbytes bytes(55),"
+ " maxbytes bytes(max), datecol date, timestampcol timestamp options"
+ " (allow_commit_timestamp = true), intarray array<int64>, numericcol"
+ " numeric,jsoncol json, pgcolumn pg.something, generatedcol string(max)"
+ " numeric,jsoncol json, uuidcol uuid, pgcolumn pg.something, generatedcol string(max)"
+ " as (sizedstring+"
+ " strstr(maxstring,strpos(maxstring,'xxx'),length(maxstring)) +2.0)"
+ " STORED, constraint fk_col_remote FOREIGN KEY(col1, col2) REFERENCES"
Expand Down Expand Up @@ -68,6 +68,7 @@ public void parseCreateTable() throws ParseException {
+ " intarray ARRAY<INT64>, \n"
+ " numericcol NUMERIC, \n"
+ " jsoncol JSON, \n"
+ " uuidcol UUID, \n"
+ " pgcolumn PG.SOMETHING, \n"
+ " generatedcol STRING(MAX) AS ( sizedstring + strstr ( maxstring, strpos (\n"
+ " maxstring, 'xxx' ), length ( maxstring ) ) + 2.0 ) STORED, \n"
Expand Down
1 change: 1 addition & 0 deletions src/test/resources/ddlParserValidation.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ CREATE TABLE test.test (
intarray ARRAY<INT64>,
numericcol NUMERIC,
jsoncol JSON,
uuidcol UUID,
pgcolumn PG.SOMETHING,
generatedcol STRING(MAX) AS ( sizedstring + strstr ( maxstring, strpos ( maxstring, 'xxx' ), length ( maxstring ) ) + 2.0 ) STORED,
tokenlistCol TOKENLIST AS ( TOKENIZE_FULLTEXT ( maxstring ) ) HIDDEN,
Expand Down
4 changes: 4 additions & 0 deletions src/test/resources/expectedDdlDiff.txt
Original file line number Diff line number Diff line change
Expand Up @@ -379,5 +379,9 @@ ALTER TABLE mytable SET OPTIONS (locality_group='lg2')

ALTER TABLE mytable SET OPTIONS (droppedKey=NULL,newKey='value2')

== test 75 add UUID column

ALTER TABLE test1 ADD COLUMN col3 UUID

==

8 changes: 8 additions & 0 deletions src/test/resources/newDdl.txt
Original file line number Diff line number Diff line change
Expand Up @@ -592,4 +592,12 @@ create table mytable (keycol int64) primary key(keycol), OPTIONS(locality_group

create table mytable (keycol int64) primary key(keycol), OPTIONS(existingKey='value', newKey='value2')

== test 75 add UUID column

create table test1 (
col1 int64,
col2 string(max),
col3 uuid
) primary key (col1);

==
7 changes: 7 additions & 0 deletions src/test/resources/originalDdl.txt
Original file line number Diff line number Diff line change
Expand Up @@ -591,5 +591,12 @@ create table mytable (keycol int64) primary key(keycol), OPTIONS(locality_group

create table mytable (keycol int64) primary key(keycol), OPTIONS(existingKey='value', droppedKey='value1')

== test 75 add UUID column

create table test1 (
col1 int64,
col2 string(max)
) primary key (col1);

==