This is an automated email from the ASF dual-hosted git repository.

ztao1987 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hawq.git


The following commit(s) were added to refs/heads/master by this push:
     new ae505ed  HAWQ-1835. support comma delimited format option for external 
table
ae505ed is described below

commit ae505ed9123e932adc794f4d49b7145369a3cc0e
Author: ztao1987 <zhenglin.ta...@gmail.com>
AuthorDate: Fri Mar 25 16:45:42 2022 +0800

    HAWQ-1835. support comma delimited format option for external table
---
 src/backend/parser/gram.y | 28 ++++++++++++++++++++--------
 1 file changed, 20 insertions(+), 8 deletions(-)

diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y
index ea4b0ce..10cf319 100755
--- a/src/backend/parser/gram.y
+++ b/src/backend/parser/gram.y
@@ -5045,25 +5045,36 @@ format_opt:
 format_opt_list:
                        format_opt_item2
                        {
-                               $$ = list_make1($1);
+                               $$ = list_make1($1);
                        }
                        | format_opt_item2 '=' format_opt_item2
                        {
-                               $$ = list_make2($1,$3);
+                               $$ = list_make2($1, $3);
+                       }
+                       | format_opt_item2 AS format_opt_item2
+                       {
+                               $$ = list_make2($1, $3);
                        }
                        | format_opt_list format_opt_item2
                        {
-                               $$ = lappend($1, $2);
+                               $$ = lappend($1, $2);
                        }
                        | format_opt_list format_opt_item2 '=' format_opt_item2
                        {
-                               $$ = lappend(lappend($1, $2),$4);
+                               $$ = lappend(lappend($1, $2), $4);
+                       }
+                       | format_opt_list format_opt_item2 AS format_opt_item2
+                       {
+                               $$ = lappend(lappend($1, $2), $4);
+                       }
+                       | format_opt_list ',' format_opt_item2 '=' 
format_opt_item2
+                       {
+                               $$ = lappend(lappend($1, $3), $5);
                        }
                        ;
 
 format_opt_keyword:
-                         AS
-                       | DELIMITER
+                       DELIMITER
                        | NULL_P
                        | CSV
                        | HEADER_P
@@ -5094,11 +5105,12 @@ format_opt_item2:
                        {
                                $$ = makeDefElem("#ident", (Node 
*)makeString($1));
                        }
-                       | columnListPlus
+                       | '(' columnListPlus ')'
                        {
-                               $$ = makeDefElem("#collist", (Node *)$1);
+                               $$ = makeDefElem("#collist", (Node *)$2);
                        }
                        ;
+
 /*                     
 format_opt_item:
                        DELIMITER opt_as Sconst

Reply via email to