Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Enjection committed Oct 18, 2024
1 parent e155674 commit 67615d1
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 33 deletions.
27 changes: 11 additions & 16 deletions ydb/library/yql/sql/v1/sql_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7051,11 +7051,10 @@ Y_UNIT_TEST_SUITE(BackupCollection) {
Y_UNIT_TEST(CreateBackupCollectionWithDatabase) {
NYql::TAstParseResult res = SqlToYql(R"sql(
USE plato;
CREATE BACKUP COLLECTION TestCollection WITH (
CREATE BACKUP COLLECTION TestCollection DATABASE WITH (
STORAGE="local",
TAG="test" -- for testing purposes, not a real thing
)
DATABASE;
);
)sql");
UNIT_ASSERT_C(res.Root, res.Issues.ToString());

Expand All @@ -7077,12 +7076,13 @@ Y_UNIT_TEST_SUITE(BackupCollection) {
Y_UNIT_TEST(CreateBackupCollectionWithTables) {
NYql::TAstParseResult res = SqlToYql(R"sql(
USE plato;
CREATE BACKUP COLLECTION TestCollection WITH (
CREATE BACKUP COLLECTION TestCollection (
TABLE someTable,
TABLE `prefix/anotherTable`
) WITH (
STORAGE="local",
TAG="test" -- for testing purposes, not a real thing
)
TABLE someTable,
TABLE `prefix/anotherTable`;
);
)sql");
UNIT_ASSERT_C(res.Root, res.Issues.ToString());

Expand Down Expand Up @@ -7110,18 +7110,13 @@ Y_UNIT_TEST_SUITE(BackupCollection) {

ExpectFailWithError(R"sql(
USE plato;
CREATE BACKUP COLLECTION TestCollection TABLE;
)sql" , "<main>:3:56: Error: Unexpected token 'TABLE' : syntax error...\n\n");

ExpectFailWithError(R"sql(
USE plato;
CREATE BACKUP COLLECTION TestCollection DATABASE `test`;
)sql" , "<main>:3:56: Error: Unexpected token 'DATABASE' : syntax error...\n\n");
CREATE BACKUP COLLECTION TABLE TestCollection;
)sql" , "<main>:3:47: Error: Unexpected token 'TestCollection' : syntax error...\n\n");

ExpectFailWithError(R"sql(
USE plato;
CREATE BACKUP COLLECTION TestCollection DATABASE, TABLE `test`;
)sql" , "<main>:3:56: Error: Unexpected token 'DATABASE' : syntax error...\n\n");
CREATE BACKUP COLLECTION DATABASE `test` TestCollection;
)sql" , "<main>:3:50: Error: Unexpected token '`test`' : syntax error...\n\n");

ExpectFailWithError(R"sql(
USE plato;
Expand Down
29 changes: 12 additions & 17 deletions ydb/library/yql/sql/v1/sql_ut_antlr4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7048,11 +7048,10 @@ Y_UNIT_TEST_SUITE(BackupCollection) {
Y_UNIT_TEST(CreateBackupCollectionWithDatabase) {
NYql::TAstParseResult res = SqlToYql(R"sql(
USE plato;
CREATE BACKUP COLLECTION TestCollection WITH (
CREATE BACKUP COLLECTION TestCollection DATABASE WITH (
STORAGE="local",
TAG="test" -- for testing purposes, not a real thing
)
DATABASE;
);
)sql");
UNIT_ASSERT_C(res.Root, res.Issues.ToString());

Expand All @@ -7074,12 +7073,13 @@ Y_UNIT_TEST_SUITE(BackupCollection) {
Y_UNIT_TEST(CreateBackupCollectionWithTables) {
NYql::TAstParseResult res = SqlToYql(R"sql(
USE plato;
CREATE BACKUP COLLECTION TestCollection WITH (
CREATE BACKUP COLLECTION TestCollection (
TABLE someTable,
TABLE `prefix/anotherTable`
) WITH (
STORAGE="local",
TAG="test" -- for testing purposes, not a real thing
)
TABLE someTable,
TABLE `prefix/anotherTable`;
);
)sql");
UNIT_ASSERT_C(res.Root, res.Issues.ToString());

Expand All @@ -7103,22 +7103,17 @@ Y_UNIT_TEST_SUITE(BackupCollection) {
ExpectFailWithError(R"sql(
USE plato;
CREATE BACKUP COLLECTION TestCollection;
)sql" , "<main>:3:55: Error: mismatched input ';' expecting WITH\n");

ExpectFailWithError(R"sql(
USE plato;
CREATE BACKUP COLLECTION TestCollection TABLE;
)sql" , "<main>:3:56: Error: mismatched input 'TABLE' expecting WITH\n");
)sql" , "<main>:3:55: Error: mismatched input ';' expecting {'(', DATABASE, WITH}\n");

ExpectFailWithError(R"sql(
USE plato;
CREATE BACKUP COLLECTION TestCollection DATABASE `test`;
)sql" , "<main>:3:56: Error: mismatched input 'DATABASE' expecting WITH\n");
CREATE BACKUP COLLECTION TABLE TestCollection;
)sql" , "<main>:3:47: Error: mismatched input 'TestCollection' expecting {'(', DATABASE, WITH}\n");

ExpectFailWithError(R"sql(
USE plato;
CREATE BACKUP COLLECTION TestCollection DATABASE, TABLE `test`;
)sql" , "<main>:3:56: Error: mismatched input 'DATABASE' expecting WITH\n");
CREATE BACKUP COLLECTION DATABASE `test` TestCollection;
)sql" , "<main>:3:50: Error: mismatched input '`test`' expecting {'(', DATABASE, WITH}\n");

ExpectFailWithError(R"sql(
USE plato;
Expand Down

0 comments on commit 67615d1

Please sign in to comment.