hawq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hubertzh...@apache.org
Subject incubator-hawq git commit: HAWQ-293. Enable writable external table to support on number syntax.
Date Wed, 30 Dec 2015 09:54:22 GMT
Repository: incubator-hawq
Updated Branches:
  refs/heads/master 2ba5a1966 -> dbde72018


HAWQ-293. Enable writable external table to support on number syntax.


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

Branch: refs/heads/master
Commit: dbde72018993960a0872de0281642493a4ee65ee
Parents: 2ba5a19
Author: hubertzhang <hzhang@pivotal.io>
Authored: Wed Dec 30 15:46:31 2015 +0800
Committer: hubertzhang <hzhang@pivotal.io>
Committed: Wed Dec 30 15:47:35 2015 +0800

----------------------------------------------------------------------
 src/backend/commands/tablecmds.c                 | 18 +++++++++++++++---
 src/backend/parser/gram.y                        |  7 -------
 src/test/regress/output/exttab1_optimizer.source |  4 ++--
 3 files changed, 17 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/dbde7201/src/backend/commands/tablecmds.c
----------------------------------------------------------------------
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index bbfecfc..1d44f43 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -370,7 +370,7 @@ static void update_ri_trigger_args(Oid relid,
 					   bool fk_scan,
 					   bool update_relname);
 static Datum transformLocationUris(List *locs, List* fmtopts, bool isweb, bool iswritable);
-static Datum transformExecOnClause(List	*on_clause, int *preferred_segment_num);
+static Datum transformExecOnClause(List	*on_clause, int *preferred_segment_num, bool iswritable);
 static char transformFormatType(char *formatname);
 static Datum transformFormatOpts(char formattype, List *formatOpts, int numcols, bool iswritable);
 
@@ -954,7 +954,7 @@ DefineExternalRelation(CreateExternalStmt *createExtStmt)
 			break;
 
 		case EXTTBL_TYPE_EXECUTE:
-			locationExec = transformExecOnClause(exttypeDesc->on_clause, &preferred_segment_num);
+			locationExec = transformExecOnClause(exttypeDesc->on_clause, &preferred_segment_num,
iswritable);
 			if (createStmt->policy)
 			{
 			  createStmt->policy->bucketnum = preferred_segment_num;
@@ -17595,7 +17595,7 @@ static Datum transformLocationUris(List *locs, List* fmtopts, bool
isweb, bool i
 
 }
 
-static Datum transformExecOnClause(List	*on_clause, int *preferred_segment_num)
+static Datum transformExecOnClause(List	*on_clause, int *preferred_segment_num, bool iswritable)
 {
 	ArrayBuildState *astate;
 	Datum		result;
@@ -17666,6 +17666,12 @@ static Datum transformExecOnClause(List	*on_clause, int *preferred_segment_num)
 		}
 		else if (strcmp(defel->defname, "master") == 0)
 		{
+			if(iswritable){
+			  ereport(ERROR,
+	 	      (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+			    errmsg("the ON master syntax for writable external tables is deprecated"),
+		      errOmitLocation(true)));
+			}
 			/* result: "MASTER_ONLY" */
 			exec_location_str = (char *) palloc(11 + 1);
 			exec_location_str = "MASTER_ONLY";
@@ -17673,6 +17679,12 @@ static Datum transformExecOnClause(List	*on_clause, int *preferred_segment_num)
 		}
 		else if (strcmp(defel->defname, "segment") == 0)
 		{
+			if(iswritable){
+			  ereport(ERROR,
+				  (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+			    errmsg("the ON segment syntax for writable external tables is deprecated"),
+	        errOmitLocation(true)));
+			}
 			/* result: "SEGMENT_ID:<segid>" */
 			value_int = intVal(defel->arg);
 			exec_location_str = (char *) palloc(10 + 1 + 8 + 1);

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/dbde7201/src/backend/parser/gram.y
----------------------------------------------------------------------
diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y
index 4bf54b3..d137fc0 100755
--- a/src/backend/parser/gram.y
+++ b/src/backend/parser/gram.y
@@ -4597,13 +4597,6 @@ CreateExternalStmt:	CREATE OptWritable EXTERNAL OptWeb OptTemp TABLE
qualified_n
 									extdesc->on_clause = lappend(extdesc->on_clause, 
 										   				   		 makeDefElem("all", (Node *)makeInteger(TRUE)));
 								}
-								else if(n->iswritable)
-								{
-									ereport(ERROR,
-											(errcode(ERRCODE_SYNTAX_ERROR),
-									 		 errmsg("ON clause may not be used with a writable external table"),
-									 		 errOmitLocation(true)));							
-								}
 							}
 
 							if(n->sreh && n->iswritable)

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/dbde7201/src/test/regress/output/exttab1_optimizer.source
----------------------------------------------------------------------
diff --git a/src/test/regress/output/exttab1_optimizer.source b/src/test/regress/output/exttab1_optimizer.source
index d578670..9519769 100755
--- a/src/test/regress/output/exttab1_optimizer.source
+++ b/src/test/regress/output/exttab1_optimizer.source
@@ -669,7 +669,7 @@ HINT:  use the gpfdist protocol or COPY FROM instead
 create writable external table wet_neg1(a text, b text) location('gpfdist://@hostname@:7070/wet.out',
'gpfdist://@hostname@:7070/wet.out') format 'text';
 ERROR:  location uri "gpfdist://@hostname@:7070/wet.out" appears more than once
 create writable external web table wet_pos5(a text, b text) execute 'some command' on segment
0 format 'text';
-ERROR:  ON clause may not be used with a writable external table
+ERROR:  the ON segment syntax for writable        external tables is deprecated
 --
 -- SELECT from WET (negative)
 --
@@ -896,4 +896,4 @@ select * from gpfdist_status;
 -- end_ignore
 drop external table gpfdist_status;
 drop external table gpfdist_start;
-drop external table gpfdist_stop;
\ No newline at end of file
+drop external table gpfdist_stop;


Mime
View raw message