Skip to content

Commit

Permalink
Update expected output of some test files when parallel query is enfo…
Browse files Browse the repository at this point in the history
…rced

Update expected output of some test files in case of parallel query due to various reasons such as query plan changes, Order changes, etc. Also unblock these tests from parallel_query_jdbc_schedule file.

Reason for expected output diff in case of parallel query mode -

```
BABEL-2514 - order changes because of UNION
BABEL-2998 - order changes because of UNION
BABEL-328-vu-verify - order changes because of JOIN
TestSQLQueries - order changes because of JOIN

BABEL-1444 - We don't share state of the GUC "role" with parallel worker which will result in current_setting('role') to return none

BABEL-1363
BABEL-2843
BABEL-2844
BABEL-2902
BABEL-2903
BABEL-3248
BABEL-3295
BABEL-3513-vu-prepare
BABEL-3513-vu-verify
BABEL-4281
babel_collection
binary-index-vu-verify
cast_eliminate-vu-verify
babel_index_nulls_order-vu-verify
BABEL-4264

```

Task: BABEL-4643
Signed-off-by: Sandeep Kumawat <[email protected]>
  • Loading branch information
skumawat2025 authored and Sandeep Kumawat committed Dec 28, 2023
1 parent 1f4e191 commit e4e00b2
Show file tree
Hide file tree
Showing 37 changed files with 5,091 additions and 34 deletions.
1 change: 1 addition & 0 deletions contrib/babelfishpg_tsql/sql/test/babel_collation.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
-- parallel_query_expected
-- nvarchar is not supported in PG
create table testing1(col nvarchar(60)); -- expect this to fail in the Postgres dialect

Expand Down
1 change: 0 additions & 1 deletion test/JDBC/expected/BABEL-2902.out
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

-- psql
-- Test setup --
ALTER SYSTEM SET babelfishpg_tsql.migration_mode = 'multi-db';
Expand Down
263 changes: 263 additions & 0 deletions test/JDBC/expected/parallel_query/BABEL-1444.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,263 @@
USE MASTER;
GO

DECLARE @usr CHAR(30)
DECLARE @cur_usr CHAR(30)
SET @usr = user
SET @cur_usr = current_user
SELECT 'user: '+ @usr
SELECT 'current_user: '+ @cur_usr
GO
~~START~~
varchar
user: dbo
~~END~~

~~START~~
varchar
current_user: dbo
~~END~~


CREATE TABLE dbo.t1
(id INT IDENTITY(100, 1) NOT NULL,
description VARCHAR(30) NOT NULL,
usr VARCHAR(30) NOT NULL DEFAULT USER,
cur_usr VARCHAR(30) NOT NULL DEFAULT CURRENT_USER);
GO

INSERT INTO dbo.t1 (description) VALUES ('Orange');
INSERT INTO dbo.t1 (description) VALUES ('Blue');
INSERT INTO dbo.t1 (description, usr) VALUES ('Green', 'Bob');
INSERT INTO dbo.t1 (description, cur_usr) VALUES ('Purple', 'Alice');
INSERT INTO dbo.t1 (description, usr, cur_usr) VALUES ('Red', 'Mike', 'Dave');
GO
~~ROW COUNT: 1~~

~~ROW COUNT: 1~~

~~ROW COUNT: 1~~

~~ROW COUNT: 1~~

~~ROW COUNT: 1~~


SELECT * FROM dbo.t1 ORDER BY id;
GO
~~START~~
int#!#varchar#!#varchar#!#varchar
100#!#Orange#!#dbo#!#dbo
101#!#Blue#!#dbo#!#dbo
102#!#Green#!#Bob#!#dbo
103#!#Purple#!#dbo#!#Alice
104#!#Red#!#Mike#!#Dave
~~END~~


DROP TABLE dbo.t1;
GO

-- Test properties after USE
CREATE DATABASE db1;
GO

SELECT current_setting('role');
GO
~~START~~
text
none
~~END~~

SELECT current_setting('search_path');
GO
~~START~~
text
master_dbo, "$user", sys, pg_catalog
~~END~~

SELECT session_user, current_user, user;
GO
~~START~~
nvarchar#!#varchar#!#nvarchar
dbo#!#dbo#!#dbo
~~END~~

SELECT user_name();
GO
~~START~~
nvarchar
dbo
~~END~~


USE db1;
GO

SELECT current_setting('role');
GO
~~START~~
text
none
~~END~~

SELECT current_setting('search_path');
GO
~~START~~
text
dbo, "$user", sys, pg_catalog
~~END~~

SELECT session_user, current_user, user;
GO
~~START~~
nvarchar#!#varchar#!#nvarchar
dbo#!#dbo#!#dbo
~~END~~

SELECT user_name();
GO
~~START~~
nvarchar
dbo
~~END~~


-- Error: Test DROP
DROP DATABASE db1;
GO
~~ERROR (Code: 33557097)~~

~~ERROR (Message: Cannot drop database "db1" because it is currently in use)~~


SELECT current_setting('role');
GO
~~START~~
text
none
~~END~~

SELECT current_setting('search_path');
GO
~~START~~
text
dbo, "$user", sys, pg_catalog
~~END~~

SELECT session_user, current_user, user;
GO
~~START~~
nvarchar#!#varchar#!#nvarchar
dbo#!#dbo#!#dbo
~~END~~

SELECT user_name();
GO
~~START~~
nvarchar
dbo
~~END~~


-- Test DROP when using another database
USE MASTER;
GO

SELECT current_setting('role');
GO
~~START~~
text
none
~~END~~

SELECT current_setting('search_path');
GO
~~START~~
text
master_dbo, "$user", sys, pg_catalog
~~END~~

SELECT session_user, current_user, user;
GO
~~START~~
nvarchar#!#varchar#!#nvarchar
dbo#!#dbo#!#dbo
~~END~~

SELECT user_name();
GO
~~START~~
nvarchar
dbo
~~END~~


DROP DATABASE db1;
GO

SELECT current_setting('role');
GO
~~START~~
text
none
~~END~~

SELECT current_setting('search_path');
GO
~~START~~
text
master_dbo, "$user", sys, pg_catalog
~~END~~

SELECT session_user, current_user, user;
GO
~~START~~
nvarchar#!#varchar#!#nvarchar
dbo#!#dbo#!#dbo
~~END~~

SELECT user_name();
GO
~~START~~
nvarchar
dbo
~~END~~


-- Test CREATE
CREATE DATABASE db1;
GO

SELECT current_setting('role');
GO
~~START~~
text
none
~~END~~

SELECT current_setting('search_path');
GO
~~START~~
text
master_dbo, "$user", sys, pg_catalog
~~END~~

SELECT session_user, current_user, user;
GO
~~START~~
nvarchar#!#varchar#!#nvarchar
dbo#!#dbo#!#dbo
~~END~~

SELECT user_name();
GO
~~START~~
nvarchar
dbo
~~END~~


-- Clean up
DROP DATABASE db1;
GO
Loading

0 comments on commit e4e00b2

Please sign in to comment.