You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hawq.apache.org by wl...@apache.org on 2016/09/20 03:06:21 UTC

incubator-hawq git commit: HAWQ-1035. Map sub partition table name to the table list in .yml configuration file

Repository: incubator-hawq
Updated Branches:
  refs/heads/master 044411285 -> 525e1cf9e


HAWQ-1035. Map sub partition table name to the table list in .yml configuration file


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

Branch: refs/heads/master
Commit: 525e1cf9e6f58c5bcf4fc4ac4240ca898231311f
Parents: 0444112
Author: Wen Lin <wl...@pivotal.io>
Authored: Tue Sep 20 11:05:20 2016 +0800
Committer: Wen Lin <wl...@pivotal.io>
Committed: Tue Sep 20 11:05:20 2016 +0800

----------------------------------------------------------------------
 tools/bin/hawqregister | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/525e1cf9/tools/bin/hawqregister
----------------------------------------------------------------------
diff --git a/tools/bin/hawqregister b/tools/bin/hawqregister
index 1366bce..932fef1 100755
--- a/tools/bin/hawqregister
+++ b/tools/bin/hawqregister
@@ -181,6 +181,11 @@ class GpRegisterAccessor(object):
         rows = self.exec_query(query)
         return rows[0]['attrnums']
 
+    def get_partition_info(self, tablename):
+        ''' Get partition information from pg_partitions, return a constraint-tablename dictionary '''
+        query = "SELECT partitiontablename, partitionboundary FROM pg_partitions WHERE tablename = '%s'" % tablename
+        return self.exec_query(query)
+
     def get_bucket_number(self, tablename):
         query = "select oid from pg_class where relname = '%s';" % tablename.split('.')[-1].lower()
         rows = self.exec_query(query)
@@ -458,6 +463,12 @@ class HawqRegister(object):
         if self.file_format == 'Parquet':
             self._check_parquet_format(self.files)
 
+    def _get_partition_info(self):
+        dic = {}
+        for ele in self.accessor.get_partition_info(self.tablename):
+            dic[ele['partitionboundary']] = ele['partitiontablename']
+        return dic
+
     def _check_files_and_table_in_same_hdfs_cluster(self, filepath, tabledir):
         '''Check whether all the files refered by 'filepath' and the location corresponding to the table are in the same hdfs cluster'''
         if not filepath:
@@ -585,6 +596,15 @@ class HawqRegister(object):
         query += "end transaction;"
         return self.utility_accessor.update_catalog(query)
 
+    def _mapping_tablename_from_yml(self, partitions):
+        ''' Mapping table name from yml file, return a list of (table_name,(file_path, file_size)) '''
+        mappings = []
+        for pos, constraint in enumerate(self.partitions_constraint):
+            if partitions.has_key(constraint):
+                mappings = ([(partitions[constraint], (self.partitions_filepaths[pos][i], self.partitions_filesizes[pos][i]))
+                            for i in xrange(len(self.partitions_filepaths[pos]))])
+        return mappings
+
     def register(self):
         if not self.do_not_move:
             self._move_files_in_hdfs()