Repository: incubator-hawq
Updated Branches:
  refs/heads/master 2097cee21 -> 4bbd4a15d


HAWQ-990. Union clause break with distributed by clause.


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

Branch: refs/heads/master
Commit: 4bbd4a15d28bdf4900620d7eab784089011747df
Parents: 2097cee
Author: xunzhang <[email protected]>
Authored: Tue Aug 9 12:28:45 2016 +0800
Committer: rlei <[email protected]>
Committed: Tue Aug 9 12:57:54 2016 +0800

----------------------------------------------------------------------
 src/backend/parser/analyze.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/4bbd4a15/src/backend/parser/analyze.c
----------------------------------------------------------------------
diff --git a/src/backend/parser/analyze.c b/src/backend/parser/analyze.c
index 1f48c36..1937471 100644
--- a/src/backend/parser/analyze.c
+++ b/src/backend/parser/analyze.c
@@ -12235,13 +12235,11 @@ setQryDistributionPolicy(SelectStmt *stmt, Query *qry)
                        } /*foreach */
                }
 
-               if (policy->nattrs > 0)
-               {
-                       policy->bucketnum = 
GetRelOpt_bucket_num_fromOptions(stmt->intoClause->options, 
GetHashDistPartitionNum());
-               }
-               else
-               {
-                       policy->bucketnum = 
GetRelOpt_bucket_num_fromOptions(stmt->intoClause->options, 
GetDefaultPartitionNum());
+               List *options = stmt->intoClause != NULL ? 
stmt->intoClause->options : NULL;
+               if (policy->nattrs > 0) {
+                 policy->bucketnum = GetRelOpt_bucket_num_fromOptions(options, 
GetHashDistPartitionNum());
+               } else {
+                 policy->bucketnum = GetRelOpt_bucket_num_fromOptions(options, 
GetDefaultPartitionNum());
                }
        }
 

Reply via email to