You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hawq.apache.org by hu...@apache.org on 2017/03/02 01:55:06 UTC

[2/6] incubator-hawq git commit: HAWQ-1359. Add policy test for HAWQ with Ranger enabled.

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/admin/15.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/admin/15.sql b/src/test/feature/Ranger/sql/admin/15.sql
new file mode 100644
index 0000000..935baa5
--- /dev/null
+++ b/src/test/feature/Ranger/sql/admin/15.sql
@@ -0,0 +1,2 @@
+drop FUNCTION si_lt(text, text);
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/admin/16.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/admin/16.sql b/src/test/feature/Ranger/sql/admin/16.sql
new file mode 100644
index 0000000..99c08ee
--- /dev/null
+++ b/src/test/feature/Ranger/sql/admin/16.sql
@@ -0,0 +1,2 @@
+drop FUNCTION normalize_si(text);
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/admin/17.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/admin/17.sql b/src/test/feature/Ranger/sql/admin/17.sql
new file mode 100644
index 0000000..84d8ed2
--- /dev/null
+++ b/src/test/feature/Ranger/sql/admin/17.sql
@@ -0,0 +1,2 @@
+CREATE RESOURCE QUEUE myqueue WITH (PARENT='pg_root', ACTIVE_STATEMENTS=20, MEMORY_LIMIT_CLUSTER=50%, CORE_LIMIT_CLUSTER=50%);   
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/admin/18.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/admin/18.sql b/src/test/feature/Ranger/sql/admin/18.sql
new file mode 100644
index 0000000..3a4aedc
--- /dev/null
+++ b/src/test/feature/Ranger/sql/admin/18.sql
@@ -0,0 +1,2 @@
+DROP RESOURCE QUEUE myqueue;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/admin/19.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/admin/19.sql b/src/test/feature/Ranger/sql/admin/19.sql
new file mode 100644
index 0000000..a8563c4
--- /dev/null
+++ b/src/test/feature/Ranger/sql/admin/19.sql
@@ -0,0 +1,2 @@
+CREATE TABLESPACE mytblspace FILESPACE dfs_system;    
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/admin/2.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/admin/2.sql b/src/test/feature/Ranger/sql/admin/2.sql
new file mode 100644
index 0000000..f66cf7a
--- /dev/null
+++ b/src/test/feature/Ranger/sql/admin/2.sql
@@ -0,0 +1,2 @@
+create language plpythonu;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/admin/20.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/admin/20.sql b/src/test/feature/Ranger/sql/admin/20.sql
new file mode 100644
index 0000000..a2e59f1
--- /dev/null
+++ b/src/test/feature/Ranger/sql/admin/20.sql
@@ -0,0 +1,2 @@
+CREATE TABLE foo(i int) TABLESPACE mytblspace;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/admin/21.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/admin/21.sql b/src/test/feature/Ranger/sql/admin/21.sql
new file mode 100644
index 0000000..6b750fd
--- /dev/null
+++ b/src/test/feature/Ranger/sql/admin/21.sql
@@ -0,0 +1,2 @@
+insert into foo(i) values(1234);
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/admin/22.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/admin/22.sql b/src/test/feature/Ranger/sql/admin/22.sql
new file mode 100644
index 0000000..881831c
--- /dev/null
+++ b/src/test/feature/Ranger/sql/admin/22.sql
@@ -0,0 +1,2 @@
+drop table foo;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/admin/23.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/admin/23.sql b/src/test/feature/Ranger/sql/admin/23.sql
new file mode 100644
index 0000000..2049d96
--- /dev/null
+++ b/src/test/feature/Ranger/sql/admin/23.sql
@@ -0,0 +1,2 @@
+drop tablespace mytblspace;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/admin/24.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/admin/24.sql b/src/test/feature/Ranger/sql/admin/24.sql
new file mode 100644
index 0000000..3b84fc9
--- /dev/null
+++ b/src/test/feature/Ranger/sql/admin/24.sql
@@ -0,0 +1,2 @@
+COPY a FROM '/tmp/a.txt';
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/admin/25.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/admin/25.sql b/src/test/feature/Ranger/sql/admin/25.sql
new file mode 100644
index 0000000..fdef22f
--- /dev/null
+++ b/src/test/feature/Ranger/sql/admin/25.sql
@@ -0,0 +1,2 @@
+COPY a TO STDOUT WITH DELIMITER '|';
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/admin/26.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/admin/26.sql b/src/test/feature/Ranger/sql/admin/26.sql
new file mode 100644
index 0000000..b3602e6
--- /dev/null
+++ b/src/test/feature/Ranger/sql/admin/26.sql
@@ -0,0 +1,2 @@
+CREATE EXTERNAL TABLE ext_t ( N_NATIONKEY INTEGER ,N_NAME CHAR(25), N_REGIONKEY  INTEGER ,N_COMMENT    VARCHAR(152))location ('gpfdist://localhost:7070/nation_error50.tbl')FORMAT 'text' (delimiter '|')SEGMENT REJECT LIMIT 51;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/admin/27.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/admin/27.sql b/src/test/feature/Ranger/sql/admin/27.sql
new file mode 100644
index 0000000..9e1d5b5
--- /dev/null
+++ b/src/test/feature/Ranger/sql/admin/27.sql
@@ -0,0 +1,2 @@
+select * from ext_t order by N_NATIONKEY;   
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/admin/28.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/admin/28.sql b/src/test/feature/Ranger/sql/admin/28.sql
new file mode 100644
index 0000000..2cf4d94
--- /dev/null
+++ b/src/test/feature/Ranger/sql/admin/28.sql
@@ -0,0 +1,2 @@
+CREATE WRITABLE EXTERNAL TABLE ext_t2 (i int) LOCATION ('gpfdist://localhost:7070/ranger2.out') FORMAT 'TEXT' ( DELIMITER '|' NULL ' ');
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/admin/29.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/admin/29.sql b/src/test/feature/Ranger/sql/admin/29.sql
new file mode 100644
index 0000000..a7ce08c
--- /dev/null
+++ b/src/test/feature/Ranger/sql/admin/29.sql
@@ -0,0 +1,2 @@
+insert into ext_t2(i) values(234);
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/admin/3.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/admin/3.sql b/src/test/feature/Ranger/sql/admin/3.sql
new file mode 100644
index 0000000..60256d1
--- /dev/null
+++ b/src/test/feature/Ranger/sql/admin/3.sql
@@ -0,0 +1,2 @@
+CREATE OR REPLACE FUNCTION f4() RETURNS TEXT AS $$ plpy.execute("select * from a order by i") $$ LANGUAGE plpythonu VOLATILE;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/admin/30.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/admin/30.sql b/src/test/feature/Ranger/sql/admin/30.sql
new file mode 100644
index 0000000..cdb6310
--- /dev/null
+++ b/src/test/feature/Ranger/sql/admin/30.sql
@@ -0,0 +1,2 @@
+drop EXTERNAL TABLE ext_t;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/admin/31.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/admin/31.sql b/src/test/feature/Ranger/sql/admin/31.sql
new file mode 100644
index 0000000..78c3bac
--- /dev/null
+++ b/src/test/feature/Ranger/sql/admin/31.sql
@@ -0,0 +1,2 @@
+drop EXTERNAL TABLE ext_t2;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/admin/32.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/admin/32.sql b/src/test/feature/Ranger/sql/admin/32.sql
new file mode 100644
index 0000000..22f3d94
--- /dev/null
+++ b/src/test/feature/Ranger/sql/admin/32.sql
@@ -0,0 +1,2 @@
+create schema sa;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/admin/33.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/admin/33.sql b/src/test/feature/Ranger/sql/admin/33.sql
new file mode 100644
index 0000000..1ecbb3d
--- /dev/null
+++ b/src/test/feature/Ranger/sql/admin/33.sql
@@ -0,0 +1,2 @@
+create temp table ta(i int);
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/admin/34.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/admin/34.sql b/src/test/feature/Ranger/sql/admin/34.sql
new file mode 100644
index 0000000..60553a7
--- /dev/null
+++ b/src/test/feature/Ranger/sql/admin/34.sql
@@ -0,0 +1,2 @@
+create view av as select * from a order by i;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/admin/35.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/admin/35.sql b/src/test/feature/Ranger/sql/admin/35.sql
new file mode 100644
index 0000000..c6980eb
--- /dev/null
+++ b/src/test/feature/Ranger/sql/admin/35.sql
@@ -0,0 +1,2 @@
+create table aa as select * from a order by i;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/admin/36.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/admin/36.sql b/src/test/feature/Ranger/sql/admin/36.sql
new file mode 100644
index 0000000..72650fc
--- /dev/null
+++ b/src/test/feature/Ranger/sql/admin/36.sql
@@ -0,0 +1,2 @@
+create table sa.t(a int, b int);
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/admin/37.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/admin/37.sql b/src/test/feature/Ranger/sql/admin/37.sql
new file mode 100644
index 0000000..b468240
--- /dev/null
+++ b/src/test/feature/Ranger/sql/admin/37.sql
@@ -0,0 +1,2 @@
+CREATE SEQUENCE myseq START 1;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/admin/38.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/admin/38.sql b/src/test/feature/Ranger/sql/admin/38.sql
new file mode 100644
index 0000000..e853d79
--- /dev/null
+++ b/src/test/feature/Ranger/sql/admin/38.sql
@@ -0,0 +1,2 @@
+insert into a values(1);
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/admin/39.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/admin/39.sql b/src/test/feature/Ranger/sql/admin/39.sql
new file mode 100644
index 0000000..e853d79
--- /dev/null
+++ b/src/test/feature/Ranger/sql/admin/39.sql
@@ -0,0 +1,2 @@
+insert into a values(1);
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/admin/4.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/admin/4.sql b/src/test/feature/Ranger/sql/admin/4.sql
new file mode 100644
index 0000000..0cf5902
--- /dev/null
+++ b/src/test/feature/Ranger/sql/admin/4.sql
@@ -0,0 +1,2 @@
+select * from f4();
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/admin/40.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/admin/40.sql b/src/test/feature/Ranger/sql/admin/40.sql
new file mode 100644
index 0000000..b40f4c6
--- /dev/null
+++ b/src/test/feature/Ranger/sql/admin/40.sql
@@ -0,0 +1,2 @@
+insert into a VALUES (nextval('myseq'));
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/admin/41.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/admin/41.sql b/src/test/feature/Ranger/sql/admin/41.sql
new file mode 100644
index 0000000..385baa2
--- /dev/null
+++ b/src/test/feature/Ranger/sql/admin/41.sql
@@ -0,0 +1,2 @@
+select * from a order by i;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/admin/42.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/admin/42.sql b/src/test/feature/Ranger/sql/admin/42.sql
new file mode 100644
index 0000000..4ceed17
--- /dev/null
+++ b/src/test/feature/Ranger/sql/admin/42.sql
@@ -0,0 +1,2 @@
+select generate_series(1,3);
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/admin/43.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/admin/43.sql b/src/test/feature/Ranger/sql/admin/43.sql
new file mode 100644
index 0000000..480e607
--- /dev/null
+++ b/src/test/feature/Ranger/sql/admin/43.sql
@@ -0,0 +1,2 @@
+select * from av;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/admin/44.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/admin/44.sql b/src/test/feature/Ranger/sql/admin/44.sql
new file mode 100644
index 0000000..a45225c
--- /dev/null
+++ b/src/test/feature/Ranger/sql/admin/44.sql
@@ -0,0 +1,2 @@
+SELECT setval('myseq', 1);
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/admin/45.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/admin/45.sql b/src/test/feature/Ranger/sql/admin/45.sql
new file mode 100644
index 0000000..22834c8
--- /dev/null
+++ b/src/test/feature/Ranger/sql/admin/45.sql
@@ -0,0 +1,2 @@
+SELECT * INTO aaa FROM a WHERE i > 0 order by i;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/admin/46.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/admin/46.sql b/src/test/feature/Ranger/sql/admin/46.sql
new file mode 100644
index 0000000..2065b88
--- /dev/null
+++ b/src/test/feature/Ranger/sql/admin/46.sql
@@ -0,0 +1,2 @@
+PREPARE fooplan (int) AS INSERT INTO a VALUES($1);EXECUTE fooplan(1);DEALLOCATE fooplan;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/admin/47.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/admin/47.sql b/src/test/feature/Ranger/sql/admin/47.sql
new file mode 100644
index 0000000..e4e2c41
--- /dev/null
+++ b/src/test/feature/Ranger/sql/admin/47.sql
@@ -0,0 +1,2 @@
+explain select * from a;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/admin/48.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/admin/48.sql b/src/test/feature/Ranger/sql/admin/48.sql
new file mode 100644
index 0000000..9f2f20a
--- /dev/null
+++ b/src/test/feature/Ranger/sql/admin/48.sql
@@ -0,0 +1,2 @@
+CREATE FUNCTION scube_accum(numeric, numeric) RETURNS numeric AS 'select $1 + $2 * $2 * $2' LANGUAGE SQL IMMUTABLE RETURNS NULL ON NULL INPUT;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/admin/49.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/admin/49.sql b/src/test/feature/Ranger/sql/admin/49.sql
new file mode 100644
index 0000000..e6599f1
--- /dev/null
+++ b/src/test/feature/Ranger/sql/admin/49.sql
@@ -0,0 +1,2 @@
+CREATE AGGREGATE scube(numeric) ( SFUNC = scube_accum, STYPE = numeric, INITCOND = 0 );
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/admin/5.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/admin/5.sql b/src/test/feature/Ranger/sql/admin/5.sql
new file mode 100644
index 0000000..c9c075d
--- /dev/null
+++ b/src/test/feature/Ranger/sql/admin/5.sql
@@ -0,0 +1,2 @@
+drop function f4();
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/admin/50.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/admin/50.sql b/src/test/feature/Ranger/sql/admin/50.sql
new file mode 100644
index 0000000..993576b
--- /dev/null
+++ b/src/test/feature/Ranger/sql/admin/50.sql
@@ -0,0 +1,2 @@
+ALTER AGGREGATE scube(numeric) RENAME TO scube2;   
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/admin/51.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/admin/51.sql b/src/test/feature/Ranger/sql/admin/51.sql
new file mode 100644
index 0000000..b05f5ac
--- /dev/null
+++ b/src/test/feature/Ranger/sql/admin/51.sql
@@ -0,0 +1,2 @@
+DROP AGGREGATE scube2(numeric);
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/admin/52.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/admin/52.sql b/src/test/feature/Ranger/sql/admin/52.sql
new file mode 100644
index 0000000..3b29f9a
--- /dev/null
+++ b/src/test/feature/Ranger/sql/admin/52.sql
@@ -0,0 +1,2 @@
+DROP FUNCTION scube_accum(numeric, numeric);
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/admin/53.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/admin/53.sql b/src/test/feature/Ranger/sql/admin/53.sql
new file mode 100644
index 0000000..0707842
--- /dev/null
+++ b/src/test/feature/Ranger/sql/admin/53.sql
@@ -0,0 +1,2 @@
+CREATE TYPE mytype AS (f1 int, f2 int);
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/admin/54.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/admin/54.sql b/src/test/feature/Ranger/sql/admin/54.sql
new file mode 100644
index 0000000..ea91e5a
--- /dev/null
+++ b/src/test/feature/Ranger/sql/admin/54.sql
@@ -0,0 +1,2 @@
+CREATE FUNCTION getfoo() RETURNS SETOF mytype AS $$ SELECT i, i FROM a order by i $$ LANGUAGE SQL;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/admin/55.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/admin/55.sql b/src/test/feature/Ranger/sql/admin/55.sql
new file mode 100644
index 0000000..ff62421
--- /dev/null
+++ b/src/test/feature/Ranger/sql/admin/55.sql
@@ -0,0 +1,2 @@
+select getfoo();
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/admin/56.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/admin/56.sql b/src/test/feature/Ranger/sql/admin/56.sql
new file mode 100644
index 0000000..9704249
--- /dev/null
+++ b/src/test/feature/Ranger/sql/admin/56.sql
@@ -0,0 +1,2 @@
+drop type mytype cascade;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/admin/57.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/admin/57.sql b/src/test/feature/Ranger/sql/admin/57.sql
new file mode 100644
index 0000000..9a3466c
--- /dev/null
+++ b/src/test/feature/Ranger/sql/admin/57.sql
@@ -0,0 +1,2 @@
+begin; DECLARE mycursor CURSOR FOR SELECT * FROM a order by i; FETCH FORWARD 2 FROM mycursor; commit;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/admin/58.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/admin/58.sql b/src/test/feature/Ranger/sql/admin/58.sql
new file mode 100644
index 0000000..8909ac0
--- /dev/null
+++ b/src/test/feature/Ranger/sql/admin/58.sql
@@ -0,0 +1,2 @@
+BEGIN; INSERT INTO a VALUES (1); SAVEPOINT my_savepoint; INSERT INTO a VALUES (1); RELEASE SAVEPOINT my_savepoint; COMMIT;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/admin/59.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/admin/59.sql b/src/test/feature/Ranger/sql/admin/59.sql
new file mode 100644
index 0000000..7082e2b
--- /dev/null
+++ b/src/test/feature/Ranger/sql/admin/59.sql
@@ -0,0 +1,2 @@
+\d
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/admin/6.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/admin/6.sql b/src/test/feature/Ranger/sql/admin/6.sql
new file mode 100644
index 0000000..ca4991c
--- /dev/null
+++ b/src/test/feature/Ranger/sql/admin/6.sql
@@ -0,0 +1,2 @@
+drop language plpythonu;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/admin/60.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/admin/60.sql b/src/test/feature/Ranger/sql/admin/60.sql
new file mode 100644
index 0000000..10d68f3
--- /dev/null
+++ b/src/test/feature/Ranger/sql/admin/60.sql
@@ -0,0 +1,2 @@
+analyze a;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/admin/61.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/admin/61.sql b/src/test/feature/Ranger/sql/admin/61.sql
new file mode 100644
index 0000000..ab2560b
--- /dev/null
+++ b/src/test/feature/Ranger/sql/admin/61.sql
@@ -0,0 +1,2 @@
+analyze;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/admin/62.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/admin/62.sql b/src/test/feature/Ranger/sql/admin/62.sql
new file mode 100644
index 0000000..afb4bd5
--- /dev/null
+++ b/src/test/feature/Ranger/sql/admin/62.sql
@@ -0,0 +1,2 @@
+vacuum aa;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/admin/63.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/admin/63.sql b/src/test/feature/Ranger/sql/admin/63.sql
new file mode 100644
index 0000000..70f7c2a
--- /dev/null
+++ b/src/test/feature/Ranger/sql/admin/63.sql
@@ -0,0 +1,2 @@
+vacuum analyze;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/admin/64.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/admin/64.sql b/src/test/feature/Ranger/sql/admin/64.sql
new file mode 100644
index 0000000..addef79
--- /dev/null
+++ b/src/test/feature/Ranger/sql/admin/64.sql
@@ -0,0 +1,2 @@
+truncate aa;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/admin/65.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/admin/65.sql b/src/test/feature/Ranger/sql/admin/65.sql
new file mode 100644
index 0000000..3785597
--- /dev/null
+++ b/src/test/feature/Ranger/sql/admin/65.sql
@@ -0,0 +1,2 @@
+alter table a rename column i to j;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/admin/66.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/admin/66.sql b/src/test/feature/Ranger/sql/admin/66.sql
new file mode 100644
index 0000000..c684900
--- /dev/null
+++ b/src/test/feature/Ranger/sql/admin/66.sql
@@ -0,0 +1,2 @@
+drop SEQUENCE myseq;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/admin/67.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/admin/67.sql b/src/test/feature/Ranger/sql/admin/67.sql
new file mode 100644
index 0000000..faeb08f
--- /dev/null
+++ b/src/test/feature/Ranger/sql/admin/67.sql
@@ -0,0 +1,2 @@
+drop view av;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/admin/68.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/admin/68.sql b/src/test/feature/Ranger/sql/admin/68.sql
new file mode 100644
index 0000000..3647118
--- /dev/null
+++ b/src/test/feature/Ranger/sql/admin/68.sql
@@ -0,0 +1,2 @@
+drop table aaa;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/admin/69.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/admin/69.sql b/src/test/feature/Ranger/sql/admin/69.sql
new file mode 100644
index 0000000..a99bd9d
--- /dev/null
+++ b/src/test/feature/Ranger/sql/admin/69.sql
@@ -0,0 +1,2 @@
+drop table aa;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/admin/7.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/admin/7.sql b/src/test/feature/Ranger/sql/admin/7.sql
new file mode 100644
index 0000000..6a4725c
--- /dev/null
+++ b/src/test/feature/Ranger/sql/admin/7.sql
@@ -0,0 +1,2 @@
+CREATE OR REPLACE FUNCTION normalize_si(text) RETURNS text AS $$ BEGIN RETURN substring($1, 9, 2) || substring($1, 7, 2) || substring($1, 5, 2) || substring($1, 1, 4); END; $$LANGUAGE 'plpgsql' IMMUTABLE;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/admin/70.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/admin/70.sql b/src/test/feature/Ranger/sql/admin/70.sql
new file mode 100644
index 0000000..e5b6025
--- /dev/null
+++ b/src/test/feature/Ranger/sql/admin/70.sql
@@ -0,0 +1,2 @@
+drop table a;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/admin/71.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/admin/71.sql b/src/test/feature/Ranger/sql/admin/71.sql
new file mode 100644
index 0000000..5aac8ba
--- /dev/null
+++ b/src/test/feature/Ranger/sql/admin/71.sql
@@ -0,0 +1,2 @@
+drop schema sa CASCADE;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/admin/8.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/admin/8.sql b/src/test/feature/Ranger/sql/admin/8.sql
new file mode 100644
index 0000000..c584d07
--- /dev/null
+++ b/src/test/feature/Ranger/sql/admin/8.sql
@@ -0,0 +1,2 @@
+CREATE OR REPLACE FUNCTION si_lt(text, text) RETURNS boolean AS $$ BEGIN RETURN normalize_si($1) < normalize_si($2); END; $$ LANGUAGE 'plpgsql' IMMUTABLE;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/admin/9.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/admin/9.sql b/src/test/feature/Ranger/sql/admin/9.sql
new file mode 100644
index 0000000..13b9067
--- /dev/null
+++ b/src/test/feature/Ranger/sql/admin/9.sql
@@ -0,0 +1,2 @@
+CREATE OPERATOR <# ( PROCEDURE=si_lt,LEFTARG=text, RIGHTARG=text);
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/init_file
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/init_file b/src/test/feature/Ranger/sql/init_file
new file mode 100644
index 0000000..3c1fd76
--- /dev/null
+++ b/src/test/feature/Ranger/sql/init_file
@@ -0,0 +1,7 @@
+-- start_matchignore
+m/You are now connected to database*/
+s/public\|a\|table\|.*\|append only/public\|a\|table\|gpadmin\|append only/
+s/public\|aa\|table\|.*\|append only/public\|aa\|table\|gpadmin\|append only/
+s/public\|aaa\|table\|.*\|append only/public\|aaa\|table\|gpadmin\|append only/
+s/public\|av\|view\|.*\|none/public\|av\|view\|gpadmin\|none/
+-- end_matchignore

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/normal/1.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/normal/1.sql b/src/test/feature/Ranger/sql/normal/1.sql
new file mode 100644
index 0000000..33f1fbe
--- /dev/null
+++ b/src/test/feature/Ranger/sql/normal/1.sql
@@ -0,0 +1,3 @@
+set session role=usertest1;
+create table a(i int);
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/normal/10.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/normal/10.sql b/src/test/feature/Ranger/sql/normal/10.sql
new file mode 100644
index 0000000..355aba0
--- /dev/null
+++ b/src/test/feature/Ranger/sql/normal/10.sql
@@ -0,0 +1,3 @@
+set session role=usertest10;
+CREATE OR REPLACE FUNCTION si_same(text, text) RETURNS int AS $$ BEGIN IF normalize_si($1) < normalize_si($2) THEN RETURN -1; END IF; END; $$ LANGUAGE 'plpgsql' IMMUTABLE;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/normal/11.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/normal/11.sql b/src/test/feature/Ranger/sql/normal/11.sql
new file mode 100644
index 0000000..8e43dbd
--- /dev/null
+++ b/src/test/feature/Ranger/sql/normal/11.sql
@@ -0,0 +1,3 @@
+set session role=usertest11;
+CREATE OPERATOR CLASS sva_special_ops FOR TYPE text USING btree AS OPERATOR 1 <#, FUNCTION 1 si_same(text, text);
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/normal/12.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/normal/12.sql b/src/test/feature/Ranger/sql/normal/12.sql
new file mode 100644
index 0000000..be948a3
--- /dev/null
+++ b/src/test/feature/Ranger/sql/normal/12.sql
@@ -0,0 +1,3 @@
+set session role=usertest12;
+drop OPERATOR CLASS sva_special_ops USING btree;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/normal/13.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/normal/13.sql b/src/test/feature/Ranger/sql/normal/13.sql
new file mode 100644
index 0000000..7258043
--- /dev/null
+++ b/src/test/feature/Ranger/sql/normal/13.sql
@@ -0,0 +1,3 @@
+set session role=usertest13;
+drop OPERATOR <# (text,text) CASCADE;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/normal/14.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/normal/14.sql b/src/test/feature/Ranger/sql/normal/14.sql
new file mode 100644
index 0000000..8bd2dee
--- /dev/null
+++ b/src/test/feature/Ranger/sql/normal/14.sql
@@ -0,0 +1,3 @@
+set session role=usertest14;
+drop FUNCTION si_same(text, text);
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/normal/15.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/normal/15.sql b/src/test/feature/Ranger/sql/normal/15.sql
new file mode 100644
index 0000000..6c69d24
--- /dev/null
+++ b/src/test/feature/Ranger/sql/normal/15.sql
@@ -0,0 +1,3 @@
+set session role=usertest15;
+drop FUNCTION si_lt(text, text);
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/normal/16.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/normal/16.sql b/src/test/feature/Ranger/sql/normal/16.sql
new file mode 100644
index 0000000..fd7aca5
--- /dev/null
+++ b/src/test/feature/Ranger/sql/normal/16.sql
@@ -0,0 +1,3 @@
+set session role=usertest16;
+drop FUNCTION normalize_si(text);
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/normal/17.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/normal/17.sql b/src/test/feature/Ranger/sql/normal/17.sql
new file mode 100644
index 0000000..42de8bb
--- /dev/null
+++ b/src/test/feature/Ranger/sql/normal/17.sql
@@ -0,0 +1,3 @@
+set session role=usertest17;
+CREATE RESOURCE QUEUE myqueue WITH (PARENT='pg_root', ACTIVE_STATEMENTS=20, MEMORY_LIMIT_CLUSTER=50%, CORE_LIMIT_CLUSTER=50%);   
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/normal/18.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/normal/18.sql b/src/test/feature/Ranger/sql/normal/18.sql
new file mode 100644
index 0000000..f2c5d5e
--- /dev/null
+++ b/src/test/feature/Ranger/sql/normal/18.sql
@@ -0,0 +1,3 @@
+set session role=usertest18;
+DROP RESOURCE QUEUE myqueue;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/normal/19.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/normal/19.sql b/src/test/feature/Ranger/sql/normal/19.sql
new file mode 100644
index 0000000..79b9ce0
--- /dev/null
+++ b/src/test/feature/Ranger/sql/normal/19.sql
@@ -0,0 +1,3 @@
+set session role=usertest19;
+CREATE TABLESPACE mytblspace FILESPACE dfs_system;    
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/normal/2.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/normal/2.sql b/src/test/feature/Ranger/sql/normal/2.sql
new file mode 100644
index 0000000..8d579a5
--- /dev/null
+++ b/src/test/feature/Ranger/sql/normal/2.sql
@@ -0,0 +1,3 @@
+set session role=usertest2;
+create language plpythonu;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/normal/20.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/normal/20.sql b/src/test/feature/Ranger/sql/normal/20.sql
new file mode 100644
index 0000000..b0a09cc
--- /dev/null
+++ b/src/test/feature/Ranger/sql/normal/20.sql
@@ -0,0 +1,3 @@
+set session role=usertest20;
+CREATE TABLE foo(i int) TABLESPACE mytblspace;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/normal/21.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/normal/21.sql b/src/test/feature/Ranger/sql/normal/21.sql
new file mode 100644
index 0000000..0816560
--- /dev/null
+++ b/src/test/feature/Ranger/sql/normal/21.sql
@@ -0,0 +1,3 @@
+set session role=usertest21;
+insert into foo(i) values(1234);
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/normal/22.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/normal/22.sql b/src/test/feature/Ranger/sql/normal/22.sql
new file mode 100644
index 0000000..b55b462
--- /dev/null
+++ b/src/test/feature/Ranger/sql/normal/22.sql
@@ -0,0 +1,3 @@
+set session role=usertest22;
+drop table foo;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/normal/23.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/normal/23.sql b/src/test/feature/Ranger/sql/normal/23.sql
new file mode 100644
index 0000000..1552795
--- /dev/null
+++ b/src/test/feature/Ranger/sql/normal/23.sql
@@ -0,0 +1,3 @@
+set session role=usertest23;
+drop tablespace mytblspace;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/normal/24.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/normal/24.sql b/src/test/feature/Ranger/sql/normal/24.sql
new file mode 100644
index 0000000..7be148c
--- /dev/null
+++ b/src/test/feature/Ranger/sql/normal/24.sql
@@ -0,0 +1,3 @@
+set session role=usertest24;
+COPY a FROM '/tmp/a.txt';
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/normal/25.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/normal/25.sql b/src/test/feature/Ranger/sql/normal/25.sql
new file mode 100644
index 0000000..d02f191
--- /dev/null
+++ b/src/test/feature/Ranger/sql/normal/25.sql
@@ -0,0 +1,3 @@
+set session role=usertest25;
+COPY a TO STDOUT WITH DELIMITER '|';
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/normal/26.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/normal/26.sql b/src/test/feature/Ranger/sql/normal/26.sql
new file mode 100644
index 0000000..7faf754
--- /dev/null
+++ b/src/test/feature/Ranger/sql/normal/26.sql
@@ -0,0 +1,3 @@
+set session role=usertest26;
+CREATE EXTERNAL TABLE ext_t ( N_NATIONKEY INTEGER ,N_NAME CHAR(25), N_REGIONKEY  INTEGER ,N_COMMENT    VARCHAR(152))location ('gpfdist://localhost:7070/nation_error50.tbl')FORMAT 'text' (delimiter '|')SEGMENT REJECT LIMIT 51;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/normal/27.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/normal/27.sql b/src/test/feature/Ranger/sql/normal/27.sql
new file mode 100644
index 0000000..4f8707b
--- /dev/null
+++ b/src/test/feature/Ranger/sql/normal/27.sql
@@ -0,0 +1,3 @@
+set session role=usertest27;
+select * from ext_t order by N_NATIONKEY;   
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/normal/28.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/normal/28.sql b/src/test/feature/Ranger/sql/normal/28.sql
new file mode 100644
index 0000000..77b0359
--- /dev/null
+++ b/src/test/feature/Ranger/sql/normal/28.sql
@@ -0,0 +1,3 @@
+set session role=usertest28;
+CREATE WRITABLE EXTERNAL TABLE ext_t2 (i int) LOCATION ('gpfdist://localhost:7070/ranger2.out') FORMAT 'TEXT' ( DELIMITER '|' NULL ' ');
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/normal/29.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/normal/29.sql b/src/test/feature/Ranger/sql/normal/29.sql
new file mode 100644
index 0000000..b3a7902
--- /dev/null
+++ b/src/test/feature/Ranger/sql/normal/29.sql
@@ -0,0 +1,3 @@
+set session role=usertest29;
+insert into ext_t2(i) values(234);
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/normal/3.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/normal/3.sql b/src/test/feature/Ranger/sql/normal/3.sql
new file mode 100644
index 0000000..30e7f5c
--- /dev/null
+++ b/src/test/feature/Ranger/sql/normal/3.sql
@@ -0,0 +1,3 @@
+set session role=usertest3;
+CREATE OR REPLACE FUNCTION f4() RETURNS TEXT AS $$ plpy.execute("select * from a order by i") $$ LANGUAGE plpythonu VOLATILE;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/normal/30.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/normal/30.sql b/src/test/feature/Ranger/sql/normal/30.sql
new file mode 100644
index 0000000..2c455bc
--- /dev/null
+++ b/src/test/feature/Ranger/sql/normal/30.sql
@@ -0,0 +1,3 @@
+set session role=usertest30;
+drop EXTERNAL TABLE ext_t;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/normal/31.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/normal/31.sql b/src/test/feature/Ranger/sql/normal/31.sql
new file mode 100644
index 0000000..b218472
--- /dev/null
+++ b/src/test/feature/Ranger/sql/normal/31.sql
@@ -0,0 +1,3 @@
+set session role=usertest31;
+drop EXTERNAL TABLE ext_t2;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/normal/32.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/normal/32.sql b/src/test/feature/Ranger/sql/normal/32.sql
new file mode 100644
index 0000000..6cbc67c
--- /dev/null
+++ b/src/test/feature/Ranger/sql/normal/32.sql
@@ -0,0 +1,3 @@
+set session role=usertest32;
+create schema sa;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/normal/33.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/normal/33.sql b/src/test/feature/Ranger/sql/normal/33.sql
new file mode 100644
index 0000000..8e86e46
--- /dev/null
+++ b/src/test/feature/Ranger/sql/normal/33.sql
@@ -0,0 +1,3 @@
+set session role=usertest33;
+create temp table ta(i int);
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/normal/34.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/normal/34.sql b/src/test/feature/Ranger/sql/normal/34.sql
new file mode 100644
index 0000000..c943817
--- /dev/null
+++ b/src/test/feature/Ranger/sql/normal/34.sql
@@ -0,0 +1,3 @@
+set session role=usertest34;
+create view av as select * from a order by i;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/normal/35.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/normal/35.sql b/src/test/feature/Ranger/sql/normal/35.sql
new file mode 100644
index 0000000..39288f6
--- /dev/null
+++ b/src/test/feature/Ranger/sql/normal/35.sql
@@ -0,0 +1,3 @@
+set session role=usertest35;
+create table aa as select * from a order by i;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/normal/36.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/normal/36.sql b/src/test/feature/Ranger/sql/normal/36.sql
new file mode 100644
index 0000000..2c6e709
--- /dev/null
+++ b/src/test/feature/Ranger/sql/normal/36.sql
@@ -0,0 +1,3 @@
+set session role=usertest36;
+create table sa.t(a int, b int);
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/normal/37.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/normal/37.sql b/src/test/feature/Ranger/sql/normal/37.sql
new file mode 100644
index 0000000..e25808d
--- /dev/null
+++ b/src/test/feature/Ranger/sql/normal/37.sql
@@ -0,0 +1,3 @@
+set session role=usertest37;
+CREATE SEQUENCE myseq START 1;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/normal/38.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/normal/38.sql b/src/test/feature/Ranger/sql/normal/38.sql
new file mode 100644
index 0000000..7669aa6
--- /dev/null
+++ b/src/test/feature/Ranger/sql/normal/38.sql
@@ -0,0 +1,3 @@
+set session role=usertest38;
+insert into a values(1);
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/normal/39.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/normal/39.sql b/src/test/feature/Ranger/sql/normal/39.sql
new file mode 100644
index 0000000..a211d00
--- /dev/null
+++ b/src/test/feature/Ranger/sql/normal/39.sql
@@ -0,0 +1,3 @@
+set session role=usertest39;
+insert into a values(1);
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/normal/4.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/normal/4.sql b/src/test/feature/Ranger/sql/normal/4.sql
new file mode 100644
index 0000000..25b8c3e
--- /dev/null
+++ b/src/test/feature/Ranger/sql/normal/4.sql
@@ -0,0 +1,3 @@
+set session role=usertest4;
+select * from f4();
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/normal/40.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/normal/40.sql b/src/test/feature/Ranger/sql/normal/40.sql
new file mode 100644
index 0000000..cb0ca4a
--- /dev/null
+++ b/src/test/feature/Ranger/sql/normal/40.sql
@@ -0,0 +1,3 @@
+set session role=usertest40;
+insert into a VALUES (nextval('myseq'));
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/normal/41.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/normal/41.sql b/src/test/feature/Ranger/sql/normal/41.sql
new file mode 100644
index 0000000..57bb612
--- /dev/null
+++ b/src/test/feature/Ranger/sql/normal/41.sql
@@ -0,0 +1,3 @@
+set session role=usertest41;
+select * from a order by i;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/normal/42.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/normal/42.sql b/src/test/feature/Ranger/sql/normal/42.sql
new file mode 100644
index 0000000..73dee45
--- /dev/null
+++ b/src/test/feature/Ranger/sql/normal/42.sql
@@ -0,0 +1,3 @@
+set session role=usertest42;
+select generate_series(1,3);
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/normal/43.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/normal/43.sql b/src/test/feature/Ranger/sql/normal/43.sql
new file mode 100644
index 0000000..07576a8
--- /dev/null
+++ b/src/test/feature/Ranger/sql/normal/43.sql
@@ -0,0 +1,3 @@
+set session role=usertest43;
+select * from av;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/normal/44.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/normal/44.sql b/src/test/feature/Ranger/sql/normal/44.sql
new file mode 100644
index 0000000..336b7c5
--- /dev/null
+++ b/src/test/feature/Ranger/sql/normal/44.sql
@@ -0,0 +1,3 @@
+set session role=usertest44;
+SELECT setval('myseq', 1);
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/normal/45.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/normal/45.sql b/src/test/feature/Ranger/sql/normal/45.sql
new file mode 100644
index 0000000..78befd1
--- /dev/null
+++ b/src/test/feature/Ranger/sql/normal/45.sql
@@ -0,0 +1,3 @@
+set session role=usertest45;
+SELECT * INTO aaa FROM a WHERE i > 0 order by i;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/normal/46.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/normal/46.sql b/src/test/feature/Ranger/sql/normal/46.sql
new file mode 100644
index 0000000..e40a5b2
--- /dev/null
+++ b/src/test/feature/Ranger/sql/normal/46.sql
@@ -0,0 +1,3 @@
+set session role=usertest46;
+PREPARE fooplan (int) AS INSERT INTO a VALUES($1);EXECUTE fooplan(1);DEALLOCATE fooplan;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/normal/47.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/normal/47.sql b/src/test/feature/Ranger/sql/normal/47.sql
new file mode 100644
index 0000000..9955c57
--- /dev/null
+++ b/src/test/feature/Ranger/sql/normal/47.sql
@@ -0,0 +1,3 @@
+set session role=usertest47;
+explain select * from a;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/normal/48.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/normal/48.sql b/src/test/feature/Ranger/sql/normal/48.sql
new file mode 100644
index 0000000..0b288fc
--- /dev/null
+++ b/src/test/feature/Ranger/sql/normal/48.sql
@@ -0,0 +1,3 @@
+set session role=usertest48;
+CREATE FUNCTION scube_accum(numeric, numeric) RETURNS numeric AS 'select $1 + $2 * $2 * $2' LANGUAGE SQL IMMUTABLE RETURNS NULL ON NULL INPUT;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/normal/49.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/normal/49.sql b/src/test/feature/Ranger/sql/normal/49.sql
new file mode 100644
index 0000000..08dd254
--- /dev/null
+++ b/src/test/feature/Ranger/sql/normal/49.sql
@@ -0,0 +1,3 @@
+set session role=usertest49;
+CREATE AGGREGATE scube(numeric) ( SFUNC = scube_accum, STYPE = numeric, INITCOND = 0 );
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/normal/5.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/normal/5.sql b/src/test/feature/Ranger/sql/normal/5.sql
new file mode 100644
index 0000000..0d994c4
--- /dev/null
+++ b/src/test/feature/Ranger/sql/normal/5.sql
@@ -0,0 +1,3 @@
+set session role=usertest5;
+drop function f4();
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/normal/50.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/normal/50.sql b/src/test/feature/Ranger/sql/normal/50.sql
new file mode 100644
index 0000000..2ba3d49
--- /dev/null
+++ b/src/test/feature/Ranger/sql/normal/50.sql
@@ -0,0 +1,3 @@
+set session role=usertest50;
+ALTER AGGREGATE scube(numeric) RENAME TO scube2;   
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/normal/51.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/normal/51.sql b/src/test/feature/Ranger/sql/normal/51.sql
new file mode 100644
index 0000000..11a0cd7
--- /dev/null
+++ b/src/test/feature/Ranger/sql/normal/51.sql
@@ -0,0 +1,3 @@
+set session role=usertest51;
+DROP AGGREGATE scube2(numeric);
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/normal/52.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/normal/52.sql b/src/test/feature/Ranger/sql/normal/52.sql
new file mode 100644
index 0000000..a35aa9d
--- /dev/null
+++ b/src/test/feature/Ranger/sql/normal/52.sql
@@ -0,0 +1,3 @@
+set session role=usertest52;
+DROP FUNCTION scube_accum(numeric, numeric);
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/normal/53.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/normal/53.sql b/src/test/feature/Ranger/sql/normal/53.sql
new file mode 100644
index 0000000..bac2fae
--- /dev/null
+++ b/src/test/feature/Ranger/sql/normal/53.sql
@@ -0,0 +1,3 @@
+set session role=usertest53;
+CREATE TYPE mytype AS (f1 int, f2 int);
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/normal/54.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/normal/54.sql b/src/test/feature/Ranger/sql/normal/54.sql
new file mode 100644
index 0000000..0400efa
--- /dev/null
+++ b/src/test/feature/Ranger/sql/normal/54.sql
@@ -0,0 +1,3 @@
+set session role=usertest54;
+CREATE FUNCTION getfoo() RETURNS SETOF mytype AS $$ SELECT i, i FROM a order by i $$ LANGUAGE SQL;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/normal/55.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/normal/55.sql b/src/test/feature/Ranger/sql/normal/55.sql
new file mode 100644
index 0000000..736b763
--- /dev/null
+++ b/src/test/feature/Ranger/sql/normal/55.sql
@@ -0,0 +1,3 @@
+set session role=usertest55;
+select getfoo();
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/normal/56.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/normal/56.sql b/src/test/feature/Ranger/sql/normal/56.sql
new file mode 100644
index 0000000..364990f
--- /dev/null
+++ b/src/test/feature/Ranger/sql/normal/56.sql
@@ -0,0 +1,3 @@
+set session role=usertest56;
+drop type mytype cascade;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/normal/57.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/normal/57.sql b/src/test/feature/Ranger/sql/normal/57.sql
new file mode 100644
index 0000000..c15fab7
--- /dev/null
+++ b/src/test/feature/Ranger/sql/normal/57.sql
@@ -0,0 +1,3 @@
+set session role=usertest57;
+begin; DECLARE mycursor CURSOR FOR SELECT * FROM a order by i; FETCH FORWARD 2 FROM mycursor; commit;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/normal/58.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/normal/58.sql b/src/test/feature/Ranger/sql/normal/58.sql
new file mode 100644
index 0000000..6f80c61
--- /dev/null
+++ b/src/test/feature/Ranger/sql/normal/58.sql
@@ -0,0 +1,3 @@
+set session role=usertest58;
+BEGIN; INSERT INTO a VALUES (1); SAVEPOINT my_savepoint; INSERT INTO a VALUES (1); RELEASE SAVEPOINT my_savepoint; COMMIT;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/normal/59.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/normal/59.sql b/src/test/feature/Ranger/sql/normal/59.sql
new file mode 100644
index 0000000..84aaed5
--- /dev/null
+++ b/src/test/feature/Ranger/sql/normal/59.sql
@@ -0,0 +1,3 @@
+set session role=usertest59;
+\d
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/normal/6.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/normal/6.sql b/src/test/feature/Ranger/sql/normal/6.sql
new file mode 100644
index 0000000..869fbba
--- /dev/null
+++ b/src/test/feature/Ranger/sql/normal/6.sql
@@ -0,0 +1,3 @@
+set session role=usertest6;
+drop language plpythonu;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/normal/60.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/normal/60.sql b/src/test/feature/Ranger/sql/normal/60.sql
new file mode 100644
index 0000000..1ac8008
--- /dev/null
+++ b/src/test/feature/Ranger/sql/normal/60.sql
@@ -0,0 +1,3 @@
+set session role=usertest60;
+analyze a;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/normal/61.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/normal/61.sql b/src/test/feature/Ranger/sql/normal/61.sql
new file mode 100644
index 0000000..e133a98
--- /dev/null
+++ b/src/test/feature/Ranger/sql/normal/61.sql
@@ -0,0 +1,3 @@
+set session role=usertest61;
+analyze;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/normal/62.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/normal/62.sql b/src/test/feature/Ranger/sql/normal/62.sql
new file mode 100644
index 0000000..5fa3659
--- /dev/null
+++ b/src/test/feature/Ranger/sql/normal/62.sql
@@ -0,0 +1,3 @@
+set session role=usertest62;
+vacuum aa;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/normal/63.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/normal/63.sql b/src/test/feature/Ranger/sql/normal/63.sql
new file mode 100644
index 0000000..d480630
--- /dev/null
+++ b/src/test/feature/Ranger/sql/normal/63.sql
@@ -0,0 +1,3 @@
+set session role=usertest63;
+vacuum analyze;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/normal/64.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/normal/64.sql b/src/test/feature/Ranger/sql/normal/64.sql
new file mode 100644
index 0000000..26aca9e
--- /dev/null
+++ b/src/test/feature/Ranger/sql/normal/64.sql
@@ -0,0 +1,3 @@
+set session role=usertest64;
+truncate aa;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/normal/65.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/normal/65.sql b/src/test/feature/Ranger/sql/normal/65.sql
new file mode 100644
index 0000000..6db582c
--- /dev/null
+++ b/src/test/feature/Ranger/sql/normal/65.sql
@@ -0,0 +1,3 @@
+set session role=usertest65;
+alter table a rename column i to j;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/normal/66.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/normal/66.sql b/src/test/feature/Ranger/sql/normal/66.sql
new file mode 100644
index 0000000..7637754
--- /dev/null
+++ b/src/test/feature/Ranger/sql/normal/66.sql
@@ -0,0 +1,3 @@
+set session role=usertest66;
+drop SEQUENCE myseq;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/normal/67.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/normal/67.sql b/src/test/feature/Ranger/sql/normal/67.sql
new file mode 100644
index 0000000..a88a61f
--- /dev/null
+++ b/src/test/feature/Ranger/sql/normal/67.sql
@@ -0,0 +1,3 @@
+set session role=usertest67;
+drop view av;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/normal/68.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/normal/68.sql b/src/test/feature/Ranger/sql/normal/68.sql
new file mode 100644
index 0000000..cc322ad
--- /dev/null
+++ b/src/test/feature/Ranger/sql/normal/68.sql
@@ -0,0 +1,3 @@
+set session role=usertest68;
+drop table aaa;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/normal/69.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/normal/69.sql b/src/test/feature/Ranger/sql/normal/69.sql
new file mode 100644
index 0000000..d252050
--- /dev/null
+++ b/src/test/feature/Ranger/sql/normal/69.sql
@@ -0,0 +1,3 @@
+set session role=usertest69;
+drop table aa;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/normal/7.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/normal/7.sql b/src/test/feature/Ranger/sql/normal/7.sql
new file mode 100644
index 0000000..47ebd4b
--- /dev/null
+++ b/src/test/feature/Ranger/sql/normal/7.sql
@@ -0,0 +1,3 @@
+set session role=usertest7;
+CREATE OR REPLACE FUNCTION normalize_si(text) RETURNS text AS $$ BEGIN RETURN substring($1, 9, 2) || substring($1, 7, 2) || substring($1, 5, 2) || substring($1, 1, 4); END; $$LANGUAGE 'plpgsql' IMMUTABLE;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/normal/70.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/normal/70.sql b/src/test/feature/Ranger/sql/normal/70.sql
new file mode 100644
index 0000000..620cc97
--- /dev/null
+++ b/src/test/feature/Ranger/sql/normal/70.sql
@@ -0,0 +1,3 @@
+set session role=usertest70;
+drop table a;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/normal/71.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/normal/71.sql b/src/test/feature/Ranger/sql/normal/71.sql
new file mode 100644
index 0000000..a0600ca
--- /dev/null
+++ b/src/test/feature/Ranger/sql/normal/71.sql
@@ -0,0 +1,3 @@
+set session role=usertest71;
+drop schema sa CASCADE;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/normal/8.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/normal/8.sql b/src/test/feature/Ranger/sql/normal/8.sql
new file mode 100644
index 0000000..cf1ddf8
--- /dev/null
+++ b/src/test/feature/Ranger/sql/normal/8.sql
@@ -0,0 +1,3 @@
+set session role=usertest8;
+CREATE OR REPLACE FUNCTION si_lt(text, text) RETURNS boolean AS $$ BEGIN RETURN normalize_si($1) < normalize_si($2); END; $$ LANGUAGE 'plpgsql' IMMUTABLE;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/normal/9.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/normal/9.sql b/src/test/feature/Ranger/sql/normal/9.sql
new file mode 100644
index 0000000..b001581
--- /dev/null
+++ b/src/test/feature/Ranger/sql/normal/9.sql
@@ -0,0 +1,3 @@
+set session role=usertest9;
+CREATE OPERATOR <# ( PROCEDURE=si_lt,LEFTARG=text, RIGHTARG=text);
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/sqlsplit.cpp
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/sqlsplit.cpp b/src/test/feature/Ranger/sql/sqlsplit.cpp
new file mode 100644
index 0000000..61ea00e
--- /dev/null
+++ b/src/test/feature/Ranger/sql/sqlsplit.cpp
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+int main() {
+    FILE *fin, *fout, *foutsuper;
+    fin = fopen("sqlsplitinput", "r");
+    char line[1000];
+    int i = 0;
+    int isnormalquery = 0;
+    while (fscanf(fin, "%d\n", &isnormalquery) && fgets(line, 1000, fin) != NULL) {
+        i++;
+
+        char sqlname[100];
+		sprintf(sqlname, "normal/%d.sql", i);
+		fout = fopen(sqlname, "w");
+    	fprintf(fout, "set session role=usertest%d;\n", i);
+    	fprintf(fout, "%s\n", line);
+    	fclose(fout);
+
+    	{
+    	char sqlname[100];
+		sprintf(sqlname, "../ans/normal%d_fail.ans", i);
+		fout = fopen(sqlname, "w");
+		fclose(fout);
+    	}
+
+    	{
+		char sqlname[100];
+		sprintf(sqlname, "../ans/super%d_fail.ans", i);
+		fout = fopen(sqlname, "w");
+		fclose(fout);
+		}
+
+    	{
+		char sqlname[100];
+		sprintf(sqlname, "../ans/normal%d_success.ans", i);
+		fout = fopen(sqlname, "w");
+		fclose(fout);
+		}
+
+		{
+		char sqlname[100];
+		sprintf(sqlname, "../ans/super%d_success.ans", i);
+		fout = fopen(sqlname, "w");
+		fclose(fout);
+		}
+    	{
+    	    	char sqlname[100];
+    			sprintf(sqlname, "../ans/admin%d.ans", i);
+    			fout = fopen(sqlname, "w");
+    			fclose(fout);
+    	    	}
+
+
+
+        if (!isnormalquery){
+        	char sqlnamesuper[100];
+			sprintf(sqlnamesuper, "super/%d.sql", i);
+			foutsuper = fopen(sqlnamesuper, "w");
+			fprintf(foutsuper, "set session role=usersuper%d;\n", i);
+			fprintf(foutsuper, "%s\n", line);
+			fclose(foutsuper);
+        }
+
+        char sqlnameadmin[100];
+		sprintf(sqlnameadmin, "admin/%d.sql", i);
+		fout = fopen(sqlnameadmin, "w");
+		fprintf(fout, "%s\n", line);
+		fclose(fout);
+    }
+    fclose(fin);
+}

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/sqlsplitinput
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/sqlsplitinput b/src/test/feature/Ranger/sql/sqlsplitinput
new file mode 100644
index 0000000..564b0a0
--- /dev/null
+++ b/src/test/feature/Ranger/sql/sqlsplitinput
@@ -0,0 +1,142 @@
+1
+create table a(i int);
+0
+create language plpythonu;
+0
+CREATE OR REPLACE FUNCTION f4() RETURNS TEXT AS $$ plpy.execute("select * from a order by i") $$ LANGUAGE plpythonu VOLATILE;
+1
+select * from f4();
+0
+drop function f4();
+0
+drop language plpythonu;
+1
+CREATE OR REPLACE FUNCTION normalize_si(text) RETURNS text AS $$ BEGIN RETURN substring($1, 9, 2) || substring($1, 7, 2) || substring($1, 5, 2) || substring($1, 1, 4); END; $$LANGUAGE 'plpgsql' IMMUTABLE;
+1
+CREATE OR REPLACE FUNCTION si_lt(text, text) RETURNS boolean AS $$ BEGIN RETURN normalize_si($1) < normalize_si($2); END; $$ LANGUAGE 'plpgsql' IMMUTABLE;
+1
+CREATE OPERATOR <# ( PROCEDURE=si_lt,LEFTARG=text, RIGHTARG=text);
+1
+CREATE OR REPLACE FUNCTION si_same(text, text) RETURNS int AS $$ BEGIN IF normalize_si($1) < normalize_si($2) THEN RETURN -1; END IF; END; $$ LANGUAGE 'plpgsql' IMMUTABLE;
+0
+CREATE OPERATOR CLASS sva_special_ops FOR TYPE text USING btree AS OPERATOR 1 <#, FUNCTION 1 si_same(text, text);
+0
+drop OPERATOR CLASS sva_special_ops USING btree;
+1
+drop OPERATOR <# (text,text) CASCADE;
+1
+drop FUNCTION si_same(text, text);
+1
+drop FUNCTION si_lt(text, text);
+1
+drop FUNCTION normalize_si(text);
+0
+CREATE RESOURCE QUEUE myqueue WITH (PARENT='pg_root', ACTIVE_STATEMENTS=20, MEMORY_LIMIT_CLUSTER=50%, CORE_LIMIT_CLUSTER=50%);   
+0
+DROP RESOURCE QUEUE myqueue;
+0
+CREATE TABLESPACE mytblspace FILESPACE dfs_system;    
+1
+CREATE TABLE foo(i int) TABLESPACE mytblspace;
+1
+insert into foo(i) values(1234);
+1
+drop table foo;
+0
+drop tablespace mytblspace;
+0
+COPY a FROM '/tmp/a.txt';
+1
+COPY a TO STDOUT WITH DELIMITER '|';
+1
+CREATE EXTERNAL TABLE ext_t ( N_NATIONKEY INTEGER ,N_NAME CHAR(25), N_REGIONKEY  INTEGER ,N_COMMENT    VARCHAR(152))location ('gpfdist://localhost:7070/nation_error50.tbl')FORMAT 'text' (delimiter '|')SEGMENT REJECT LIMIT 51;
+1
+select * from ext_t order by N_NATIONKEY;   
+1
+CREATE WRITABLE EXTERNAL TABLE ext_t2 (i int) LOCATION ('gpfdist://localhost:7070/ranger2.out') FORMAT 'TEXT' ( DELIMITER '|' NULL ' ');
+1
+insert into ext_t2(i) values(234);
+1
+drop EXTERNAL TABLE ext_t;
+1
+drop EXTERNAL TABLE ext_t2;
+1
+create schema sa;
+1
+create temp table ta(i int);
+1
+create view av as select * from a order by i;
+1
+create table aa as select * from a order by i;
+1
+create table sa.t(a int, b int);
+1
+CREATE SEQUENCE myseq START 1;
+1
+insert into a values(1);
+1
+insert into a values(1);
+1
+insert into a VALUES (nextval('myseq'));
+1
+select * from a order by i;
+1
+select generate_series(1,3);
+1
+select * from av;
+1
+SELECT setval('myseq', 1);
+1
+SELECT * INTO aaa FROM a WHERE i > 0 order by i;
+1
+PREPARE fooplan (int) AS INSERT INTO a VALUES($1);EXECUTE fooplan(1);DEALLOCATE fooplan;
+1
+explain select * from a;
+1
+CREATE FUNCTION scube_accum(numeric, numeric) RETURNS numeric AS 'select $1 + $2 * $2 * $2' LANGUAGE SQL IMMUTABLE RETURNS NULL ON NULL INPUT;
+1
+CREATE AGGREGATE scube(numeric) ( SFUNC = scube_accum, STYPE = numeric, INITCOND = 0 );
+1
+ALTER AGGREGATE scube(numeric) RENAME TO scube2;   
+1
+DROP AGGREGATE scube2(numeric);
+1
+DROP FUNCTION scube_accum(numeric, numeric);
+1
+CREATE TYPE mytype AS (f1 int, f2 int);
+1
+CREATE FUNCTION getfoo() RETURNS SETOF mytype AS $$ SELECT i, i FROM a order by i $$ LANGUAGE SQL;
+1
+select getfoo();
+1
+drop type mytype cascade;
+1
+begin; DECLARE mycursor CURSOR FOR SELECT * FROM a order by i; FETCH FORWARD 2 FROM mycursor; commit;
+1
+BEGIN; INSERT INTO a VALUES (1); SAVEPOINT my_savepoint; INSERT INTO a VALUES (1); RELEASE SAVEPOINT my_savepoint; COMMIT;
+1
+\d
+1
+analyze a;
+1
+analyze;
+1
+vacuum aa;
+0
+vacuum analyze;
+1
+truncate aa;
+1
+alter table a rename column i to j;
+1
+drop SEQUENCE myseq;
+1
+drop view av;
+1
+drop table aaa;
+1
+drop table aa;
+1
+drop table a;
+1
+drop schema sa CASCADE;

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/super/11.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/super/11.sql b/src/test/feature/Ranger/sql/super/11.sql
new file mode 100644
index 0000000..dc1ebf7
--- /dev/null
+++ b/src/test/feature/Ranger/sql/super/11.sql
@@ -0,0 +1,3 @@
+set session role=usersuper11;
+CREATE OPERATOR CLASS sva_special_ops FOR TYPE text USING btree AS OPERATOR 1 <#, FUNCTION 1 si_same(text, text);
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/super/12.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/super/12.sql b/src/test/feature/Ranger/sql/super/12.sql
new file mode 100644
index 0000000..1caae8e
--- /dev/null
+++ b/src/test/feature/Ranger/sql/super/12.sql
@@ -0,0 +1,3 @@
+set session role=usersuper12;
+drop OPERATOR CLASS sva_special_ops USING btree;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/super/17.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/super/17.sql b/src/test/feature/Ranger/sql/super/17.sql
new file mode 100644
index 0000000..798e037
--- /dev/null
+++ b/src/test/feature/Ranger/sql/super/17.sql
@@ -0,0 +1,3 @@
+set session role=usersuper17;
+CREATE RESOURCE QUEUE myqueue WITH (PARENT='pg_root', ACTIVE_STATEMENTS=20, MEMORY_LIMIT_CLUSTER=50%, CORE_LIMIT_CLUSTER=50%);   
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/super/18.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/super/18.sql b/src/test/feature/Ranger/sql/super/18.sql
new file mode 100644
index 0000000..e725d6f
--- /dev/null
+++ b/src/test/feature/Ranger/sql/super/18.sql
@@ -0,0 +1,3 @@
+set session role=usersuper18;
+DROP RESOURCE QUEUE myqueue;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/super/19.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/super/19.sql b/src/test/feature/Ranger/sql/super/19.sql
new file mode 100644
index 0000000..8de36b0
--- /dev/null
+++ b/src/test/feature/Ranger/sql/super/19.sql
@@ -0,0 +1,3 @@
+set session role=usersuper19;
+CREATE TABLESPACE mytblspace FILESPACE dfs_system;    
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/super/2.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/super/2.sql b/src/test/feature/Ranger/sql/super/2.sql
new file mode 100644
index 0000000..0ae854c
--- /dev/null
+++ b/src/test/feature/Ranger/sql/super/2.sql
@@ -0,0 +1,3 @@
+set session role=usersuper2;
+create language plpythonu;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/super/23.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/super/23.sql b/src/test/feature/Ranger/sql/super/23.sql
new file mode 100644
index 0000000..f83c498
--- /dev/null
+++ b/src/test/feature/Ranger/sql/super/23.sql
@@ -0,0 +1,3 @@
+set session role=usersuper23;
+drop tablespace mytblspace;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/super/24.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/super/24.sql b/src/test/feature/Ranger/sql/super/24.sql
new file mode 100644
index 0000000..113c6fe
--- /dev/null
+++ b/src/test/feature/Ranger/sql/super/24.sql
@@ -0,0 +1,3 @@
+set session role=usersuper24;
+COPY a FROM '/tmp/a.txt';
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/super/3.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/super/3.sql b/src/test/feature/Ranger/sql/super/3.sql
new file mode 100644
index 0000000..fd1377c
--- /dev/null
+++ b/src/test/feature/Ranger/sql/super/3.sql
@@ -0,0 +1,3 @@
+set session role=usersuper3;
+CREATE OR REPLACE FUNCTION f4() RETURNS TEXT AS $$ plpy.execute("select * from a order by i") $$ LANGUAGE plpythonu VOLATILE;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/super/5.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/super/5.sql b/src/test/feature/Ranger/sql/super/5.sql
new file mode 100644
index 0000000..a95e012
--- /dev/null
+++ b/src/test/feature/Ranger/sql/super/5.sql
@@ -0,0 +1,3 @@
+set session role=usersuper5;
+drop function f4();
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/super/6.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/super/6.sql b/src/test/feature/Ranger/sql/super/6.sql
new file mode 100644
index 0000000..9dd3a0c
--- /dev/null
+++ b/src/test/feature/Ranger/sql/super/6.sql
@@ -0,0 +1,3 @@
+set session role=usersuper6;
+drop language plpythonu;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/sql/super/63.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/sql/super/63.sql b/src/test/feature/Ranger/sql/super/63.sql
new file mode 100644
index 0000000..463ce54
--- /dev/null
+++ b/src/test/feature/Ranger/sql/super/63.sql
@@ -0,0 +1,3 @@
+set session role=usersuper63;
+vacuum analyze;
+

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/test_ranger.cpp
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/test_ranger.cpp b/src/test/feature/Ranger/test_ranger.cpp
new file mode 100644
index 0000000..1d9f08e
--- /dev/null
+++ b/src/test/feature/Ranger/test_ranger.cpp
@@ -0,0 +1,159 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "test_ranger.h"
+
+#include <string>
+#include <pwd.h>
+
+#include "lib/command.h"
+#include "lib/gpfdist.h"
+#include "lib/sql_util.h"
+#include "lib/string_util.h"
+
+using std::vector;
+using std::string;
+using hawq::test::SQLUtility;
+using hawq::test::Command;
+
+TEST_F(TestHawqRanger, BasicTest) {
+    SQLUtility util;
+
+    if (util.getGUCValue("hawq_acl_type") == "ranger")
+    {
+		hawq::test::GPfdist gpdfist(&util);
+		gpdfist.init_gpfdist();
+
+		string rootPath(util.getTestRootPath());
+		string initfile = hawq::test::stringFormat("Ranger/sql/init_file");
+		auto cmd = hawq::test::stringFormat("ls -l %s/Ranger/sql/normal/*.sql 2>/dev/null | wc -l", rootPath.c_str());
+		int sql_num = std::atoi(Command::getCommandOutput(cmd).c_str());
+		int writableTableCase = 28;
+		string rangerHost = RANGER_HOST;
+		cmd = hawq::test::stringFormat("cp %s/Ranger/data/copydata.txt /tmp/a.txt", rootPath.c_str());
+		Command::getCommandStatus(cmd);
+
+		// clear environment
+		for (int i = 1; i <= sql_num; i++) {
+			// delete user_num
+			std::string normalusername = hawq::test::stringFormat("usertest%d", i);
+			std::string superusername = hawq::test::stringFormat("usersuper%d", i);
+			util.execute(hawq::test::stringFormat("drop role %s;",normalusername.c_str()), false);
+			util.execute(hawq::test::stringFormat("drop role %s;",superusername.c_str()), false);
+			// delete policy
+			std::string cmd = hawq::test::stringFormat("ls -l %s/Ranger/policy/%d/ 2>/dev/null| grep \"^-\" | wc -l ", rootPath.c_str(), i);
+			int policy_num = std::atoi(Command::getCommandOutput(cmd).c_str());
+			for (int j = 1; j <= policy_num; j++) {
+				cmd = hawq::test::stringFormat("python %s/Ranger/rangerpolicy.py -h %s -d policy%d-%d", rootPath.c_str(), rangerHost.c_str(), i, j);
+				Command::getCommandStatus(cmd);
+			}
+		}
+
+		for (int i = 1; i <= sql_num; i++) {
+			// create user_num
+			std::string superusername = hawq::test::stringFormat("usersuper%d", i);;
+			std::string normalusername = hawq::test::stringFormat("usertest%d", i);;
+			util.execute(hawq::test::stringFormat("create role %s with login createdb superuser;", superusername.c_str()),true);
+			if(i == writableTableCase) { //for writable external table
+				util.execute(hawq::test::stringFormat("create role %s with login createdb CREATEEXTTABLE(type='writable') CREATEROLE;", normalusername.c_str()),true);
+			}
+			else {
+				util.execute(hawq::test::stringFormat("create role %s with login createdb CREATEEXTTABLE CREATEROLE;", normalusername.c_str()),true);
+			}
+			cmd = hawq::test::stringFormat("python %s/Ranger/rangeruser.py -h %s -u %s,%s", rootPath.c_str(),
+					rangerHost.c_str(),normalusername.c_str(), superusername.c_str());
+			Command::getCommandStatus(cmd);
+
+			//run sql by different users
+			string normal_sqlfile = hawq::test::stringFormat("Ranger/sql/normal/%d.sql", i);
+			string super_sqlfile = hawq::test::stringFormat("Ranger/sql/super/%d.sql", i);
+			string admin_sqlfile = hawq::test::stringFormat("Ranger/sql/admin/%d.sql", i);
+			string normal_ansfile_fail = hawq::test::stringFormat("Ranger/ans/normal%d_fail.ans", i);
+			string super_ansfile_fail = hawq::test::stringFormat("Ranger/ans/super%d_fail.ans", i);
+			string admin_ansfile = hawq::test::stringFormat("Ranger/ans/adminfirst%d.ans", i);
+
+			cmd = hawq::test::stringFormat("ls -l %s/Ranger/policy/%d/ 2>/dev/null| wc -l", rootPath.c_str(), i);
+			int policy_num = std::atoi(Command::getCommandOutput(cmd).c_str());
+
+			cmd = hawq::test::stringFormat("ls -l %s/Ranger/sql/super/%d.sql 2>/dev/null| wc -l", rootPath.c_str(), i);
+			int supersqlexist = std::atoi(Command::getCommandOutput(cmd).c_str());
+
+			if (policy_num > 0){
+				if (supersqlexist) {
+					util.execSQLFile(super_sqlfile, super_ansfile_fail, initfile, true, true);
+				}
+				else {
+					util.execSQLFile(normal_sqlfile, normal_ansfile_fail, initfile, true, true);
+				}
+			}
+
+			util.execSQLFile(admin_sqlfile, admin_ansfile, initfile, true, true);
+
+
+			for (int j = 1; j <= policy_num; j++) {
+				cmd = hawq::test::stringFormat("python %s/Ranger/rangerpolicy.py -h %s -a %s/Ranger/policy/%d/%d.json", rootPath.c_str(), rangerHost.c_str(), rootPath.c_str(), i, j);
+				Command::getCommandStatus(cmd);
+			}
+		}
+		sleep(60);
+
+
+		for (int i = 1; i <= sql_num; i++) {
+			//run sql by different users
+			string normal_sqlfile = hawq::test::stringFormat("Ranger/sql/normal/%d.sql", i);
+			string super_sqlfile = hawq::test::stringFormat("Ranger/sql/super/%d.sql", i);
+			string normal_ansfile_success = hawq::test::stringFormat("Ranger/ans/normal%d_success.ans", i);
+			string super_ansfile_success = hawq::test::stringFormat("Ranger/ans/super%d_success.ans", i);
+
+
+			cmd = hawq::test::stringFormat("ls -l %s/Ranger/policy/%d/ 2>/dev/null| wc -l", rootPath.c_str(), i);
+			int policy_num = std::atoi(Command::getCommandOutput(cmd).c_str());
+			cmd = hawq::test::stringFormat("ls -l %s/Ranger/sql/super/%d.sql 2>/dev/null | wc -l", rootPath.c_str(), i);
+			int supersqlexist = std::atoi(Command::getCommandOutput(cmd).c_str());
+			util.execSQLFile(normal_sqlfile, normal_ansfile_success, initfile, true, true);
+			if (supersqlexist) {
+				util.execSQLFile(super_sqlfile, super_ansfile_success, initfile, true, true);
+			}
+		}
+
+		//using gpadmin to clear database environment.
+		for (int i = 1; i <= sql_num; i++) {
+			string admin_sqlfile = hawq::test::stringFormat("Ranger/sql/admin/%d.sql", i);
+			string admin_ansfile = hawq::test::stringFormat("Ranger/ans/adminsecond%d.ans", i);
+			util.execSQLFile(admin_sqlfile, admin_ansfile, initfile, true, true);
+		}
+
+		for (int i = 1; i <= sql_num; i++) {
+			// delete user_num
+			std::string normalusername = hawq::test::stringFormat("usertest%d", i);
+			std::string superusername = hawq::test::stringFormat("usersuper%d", i);
+			util.execute(hawq::test::stringFormat("drop role %s;",normalusername.c_str()), false);
+			util.execute(hawq::test::stringFormat("drop role %s;",superusername.c_str()), false);
+			// delete policy
+			std::string cmd = hawq::test::stringFormat("ls -l %s/Ranger/policy/%d/ 2>/dev/null | wc -l", rootPath.c_str(), i);
+			int policy_num = std::atoi(Command::getCommandOutput(cmd).c_str());
+			for (int j = 1; j <= policy_num; j++) {
+				cmd = hawq::test::stringFormat("python %s/Ranger/rangerpolicy.py -h %s -d policy%d-%d", rootPath.c_str(), rangerHost.c_str(), i, j);
+				Command::getCommandStatus(cmd);
+			}
+		}
+
+		gpdfist.finalize_gpfdist();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/Ranger/test_ranger.h
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/test_ranger.h b/src/test/feature/Ranger/test_ranger.h
new file mode 100644
index 0000000..a12a71a
--- /dev/null
+++ b/src/test/feature/Ranger/test_ranger.h
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef TEST_HAWQ_RANGER_H
+#define TEST_HAWQ_RANGER_H
+
+#include "gtest/gtest.h"
+
+class TestHawqRanger : public ::testing::Test {
+public:
+	TestHawqRanger() {
+	}
+	~TestHawqRanger() {
+	}
+};
+
+#endif

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/lib/gpfdist.cpp
----------------------------------------------------------------------
diff --git a/src/test/feature/lib/gpfdist.cpp b/src/test/feature/lib/gpfdist.cpp
index fbd4cf1..b3f24aa 100644
--- a/src/test/feature/lib/gpfdist.cpp
+++ b/src/test/feature/lib/gpfdist.cpp
@@ -52,13 +52,6 @@ void GPfdist::init_gpfdist() {
 }
 
 void GPfdist::finalize_gpfdist() {
-	util->execute("drop external table EXT_NATION_WITH_EXIST_ERROR_TABLE;");
-	util->execute("drop external table EXT_NATION1;");
-	util->execute("drop table EXT_NATION_ERROR1 CASCADE;");
-	util->execute("drop external table EXT_NATION2;");
-	util->execute("drop table EXT_NATION_ERROR2 CASCADE;");
-	util->execute("drop external table EXT_NATION3;");
-	util->execute("drop table EXT_NATION_ERROR3 CASCADE;");
 	util->execute("select * from gpfdist_stop;");
 	util->execute("select * from gpfdist_status;");
 	util->execute("drop external table gpfdist_status;");

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/12089267/src/test/feature/lib/psql.cpp
----------------------------------------------------------------------
diff --git a/src/test/feature/lib/psql.cpp b/src/test/feature/lib/psql.cpp
index b448198..0e71d56 100644
--- a/src/test/feature/lib/psql.cpp
+++ b/src/test/feature/lib/psql.cpp
@@ -106,9 +106,9 @@ PSQL& PSQL::runSQLCommand(const string& sql_cmd) {
   return *this;
 }
 
-PSQL& PSQL::runSQLFile(const string& sql_file) {
+PSQL& PSQL::runSQLFile(const string& sql_file, bool printTupleOnly) {
   this->_last_status =
-      hawq::test::Command::getCommandStatus(this->_getPSQLFileCommand(sql_file));
+      hawq::test::Command::getCommandStatus(this->_getPSQLFileCommand(sql_file, printTupleOnly));
   return *this;
 }
 
@@ -210,9 +210,14 @@ const string PSQL::_getPSQLQueryCommand(const string& query) const {
   return command.append(" -c \"").append(query).append("\"");
 }
 
-const string PSQL::_getPSQLFileCommand(const string& file) const {
+const string PSQL::_getPSQLFileCommand(const string& file, bool printTupleOnly) const {
   string command = this->_getPSQLBaseCommand();
-  return command.append(" -a -f ").append(file);
+  if (printTupleOnly) {
+	  return command.append(" -a -A -t -f").append(file);
+  }
+  else {
+	  return command.append(" -a -f ").append(file);
+  }
 }
 
 bool PSQL::checkDiff(const string& expect_file,