hawq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject [03/17] incubator-hawq git commit: HAWQ-1122. Fix translator to show missing message from exception
Date Fri, 28 Oct 2016 03:53:06 GMT
HAWQ-1122. Fix translator to show missing message from exception

This is cherry-picked from greenplum-db/gpdb@7f10e308c957505b2f9d896e1983ac3c13b5ed94


Project: http://git-wip-us.apache.org/repos/asf/incubator-hawq/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-hawq/commit/59389975
Tree: http://git-wip-us.apache.org/repos/asf/incubator-hawq/tree/59389975
Diff: http://git-wip-us.apache.org/repos/asf/incubator-hawq/diff/59389975

Branch: refs/heads/master
Commit: 59389975f63e9db00bc554c20b2d1b6a69743eee
Parents: 7c69aac
Author: Karthikeyan Jambu Rajaraman <karthi.jrk@gmail.com>
Authored: Thu Aug 18 15:41:18 2016 -0700
Committer: rlei <rlei@pivotal.io>
Committed: Fri Oct 28 11:52:20 2016 +0800

----------------------------------------------------------------------
 src/backend/gpopt/utils/COptTasks.cpp      | 16 +++++++++++++++-
 src/include/gpopt/utils/COptTasks.h        |  4 ++++
 src/test/regress/expected/gp_optimizer.out | 22 ++++++++++++++++++++++
 src/test/regress/init_file                 |  4 ++++
 src/test/regress/sql/gp_optimizer.sql      | 14 ++++++++++++++
 5 files changed, 59 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/59389975/src/backend/gpopt/utils/COptTasks.cpp
----------------------------------------------------------------------
diff --git a/src/backend/gpopt/utils/COptTasks.cpp b/src/backend/gpopt/utils/COptTasks.cpp
index 52ef8b5..247ba2a 100644
--- a/src/backend/gpopt/utils/COptTasks.cpp
+++ b/src/backend/gpopt/utils/COptTasks.cpp
@@ -589,7 +589,21 @@ COptTasks::Execute
 	params.abort_requested = &abort_flag;
 
 	// execute task and send log message to server log
-	(void) gpos_exec(&params);
+	GPOS_TRY
+	{
+		(void) gpos_exec(&params);
+	}
+	GPOS_CATCH_EX(ex)
+	{
+		LogErrorAndDelete(err_buf);
+		GPOS_RETHROW(ex);
+	}
+	GPOS_CATCH_END;
+	LogErrorAndDelete(err_buf);
+}
+
+void
+COptTasks::LogErrorAndDelete(CHAR* err_buf) {
 
 	if ('\0' != err_buf[0])
 	{

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/59389975/src/include/gpopt/utils/COptTasks.h
----------------------------------------------------------------------
diff --git a/src/include/gpopt/utils/COptTasks.h b/src/include/gpopt/utils/COptTasks.h
index fe24475..2f1b510 100644
--- a/src/include/gpopt/utils/COptTasks.h
+++ b/src/include/gpopt/utils/COptTasks.h
@@ -183,6 +183,10 @@ class COptTasks
 		static
 		void Execute ( void *(*pfunc) (void *), void *pfuncArg);
 
+		// print error and delete the given error buffer
+		static
+		void LogErrorAndDelete(CHAR* err_buf);
+
 		// task that does the translation from xml to dxl to pplstmt
 		static
 		void* PvPlstmtFromDXLTask(void *pv);

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/59389975/src/test/regress/expected/gp_optimizer.out
----------------------------------------------------------------------
diff --git a/src/test/regress/expected/gp_optimizer.out b/src/test/regress/expected/gp_optimizer.out
index 424f3b0..0babe20 100644
--- a/src/test/regress/expected/gp_optimizer.out
+++ b/src/test/regress/expected/gp_optimizer.out
@@ -8858,6 +8858,28 @@ EXPLAIN SELECT * FROM bitmap_test WHERE a in ('1', '2', 47);
  Optimizer status: PQO version 1.647
 (5 rows)
 
+-- Test Logging for unsupported features in ORCA
+-- start_ignore
+drop table if exists foo;
+NOTICE:  table "foo" does not exist, skipping
+-- end_ignore
+create table foo(a int, b int);
+NOTICE:  Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a' as the Greenplum
Database data distribution key for this table.
+HINT:  The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s)
chosen are the optimal data distribution key to minimize skew.
+set client_min_messages='log';
+select count(*) from foo group by cube(a,b);
+LOG:  statement: select count(*) from foo group by cube(a,b);
+LOG:  2016-08-19 10:46:53:360703 PDT,THD000,NOTICE,"Feature not supported by the Pivotal
Query Optimizer: Cube",
+LOG:  Planner produced plan :0
+ count 
+-------
+(0 rows)
+
+reset client_min_messages;
+LOG:  statement: reset client_min_messages;
+-- start_ignore
+drop table foo;
+-- end_ignore
 -- clean up
 drop schema orca cascade;
 NOTICE:  drop cascades to table orca.bm_dyn_test_onepart_1_prt_part5

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/59389975/src/test/regress/init_file
----------------------------------------------------------------------
diff --git a/src/test/regress/init_file b/src/test/regress/init_file
index 8790e3b..acb999d 100644
--- a/src/test/regress/init_file
+++ b/src/test/regress/init_file
@@ -47,4 +47,8 @@ s/overlaps existing partition "r\d+"/partition "r##########"/
 # Mask out some numbers (part of temp table schema) that vary from run to run.
 m/Table "pg_temp_\d+.temp/
 s/Table "pg_temp_\d+.temp/Table "pg_temp_#####/
+
+# Mask out Log & timestamp for orca message that has feature not supported.
+m/^LOG.*\"Feature/
+s/^LOG.*\"Feature/\"Feature/
 -- end_matchsubs

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/59389975/src/test/regress/sql/gp_optimizer.sql
----------------------------------------------------------------------
diff --git a/src/test/regress/sql/gp_optimizer.sql b/src/test/regress/sql/gp_optimizer.sql
index d0c43c7..63d2a0d 100644
--- a/src/test/regress/sql/gp_optimizer.sql
+++ b/src/test/regress/sql/gp_optimizer.sql
@@ -858,5 +858,19 @@ EXPLAIN SELECT * FROM bitmap_test WHERE a in ('2', 47);
 EXPLAIN SELECT * FROM bitmap_test WHERE a in ('1', '2');
 EXPLAIN SELECT * FROM bitmap_test WHERE a in ('1', '2', 47);
 
+-- Test Logging for unsupported features in ORCA
+-- start_ignore
+drop table if exists foo;
+-- end_ignore
+
+create table foo(a int, b int);
+set client_min_messages='log';
+select count(*) from foo group by cube(a,b);
+reset client_min_messages;
+
+-- start_ignore
+drop table foo;
+-- end_ignore
+
 -- clean up
 drop schema orca cascade;


Mime
View raw message