You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by ha...@apache.org on 2012/04/21 04:41:58 UTC

svn commit: r1328569 - in /hive/branches/branch-0.9: ./ metastore/scripts/upgrade/ metastore/src/java/org/apache/hadoop/hive/metastore/ ql/src/java/org/apache/hadoop/hive/ql/exec/ ql/src/java/org/apache/hadoop/hive/ql/metadata/formatting/ ql/src/test/q...

Author: hashutosh
Date: Sat Apr 21 02:41:57 2012
New Revision: 1328569

URL: http://svn.apache.org/viewvc?rev=1328569&view=rev
Log:
HIVE-2966 : Revert HIVE-2795 Merged in from trunk. (Thejas Nair via Ashutosh Chauhan)

Added:
    hive/branches/branch-0.9/ql/src/test/queries/clientpositive/describe_formatted_view_partitioned_json.q
      - copied unchanged from r1328568, hive/trunk/ql/src/test/queries/clientpositive/describe_formatted_view_partitioned_json.q
    hive/branches/branch-0.9/ql/src/test/results/clientpositive/describe_formatted_view_partitioned_json.q.out
      - copied unchanged from r1328568, hive/trunk/ql/src/test/results/clientpositive/describe_formatted_view_partitioned_json.q.out
Removed:
    hive/branches/branch-0.9/metastore/scripts/upgrade/001-HIVE-2795.update_view_partitions.py
Modified:
    hive/branches/branch-0.9/   (props changed)
    hive/branches/branch-0.9/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
    hive/branches/branch-0.9/ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java
    hive/branches/branch-0.9/ql/src/java/org/apache/hadoop/hive/ql/metadata/formatting/MetaDataFormatUtils.java
    hive/branches/branch-0.9/ql/src/test/results/clientpositive/describe_formatted_view_partitioned.q.out

Propchange: hive/branches/branch-0.9/
------------------------------------------------------------------------------
  Merged /hive/trunk:r1328568

Modified: hive/branches/branch-0.9/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
URL: http://svn.apache.org/viewvc/hive/branches/branch-0.9/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java?rev=1328569&r1=1328568&r2=1328569&view=diff
==============================================================================
--- hive/branches/branch-0.9/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java (original)
+++ hive/branches/branch-0.9/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java Sat Apr 21 02:41:57 2012
@@ -1223,12 +1223,11 @@ public class HiveMetaStore extends Thrif
               "Unable to add partition because table or database do not exist");
         }
 
-        if (tbl.getTableType().equals(TableType.VIRTUAL_VIEW.toString()) && part.getSd() == null) {
-          part.setSd(tbl.getSd().deepCopy());
+        String partLocationStr = null;
+        if (part.getSd() != null) {
+          partLocationStr = part.getSd().getLocation();
         }
 
-        String partLocationStr = part.getSd().getLocation();
-
         if (partLocationStr == null || partLocationStr.isEmpty()) {
           // set default location if not specified and this is
           // a physical table partition (not a view)

Modified: hive/branches/branch-0.9/ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java
URL: http://svn.apache.org/viewvc/hive/branches/branch-0.9/ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java?rev=1328569&r1=1328568&r2=1328569&view=diff
==============================================================================
--- hive/branches/branch-0.9/ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java (original)
+++ hive/branches/branch-0.9/ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java Sat Apr 21 02:41:57 2012
@@ -190,10 +190,11 @@ public class DDLTask extends Task<DDLWor
     // Pick the formatter to use to display the results.  Either the
     // normal human readable output or a json object.
     if ("json".equals(conf.get(
-            HiveConf.ConfVars.HIVE_DDL_OUTPUT_FORMAT.varname, "text")))
+            HiveConf.ConfVars.HIVE_DDL_OUTPUT_FORMAT.varname, "text"))) {
       formatter = new JsonMetaDataFormatter();
-    else
+    } else {
       formatter = new TextMetaDataFormatter();
+    }
 
     INTERMEDIATE_ARCHIVED_DIR_SUFFIX =
       HiveConf.getVar(conf, ConfVars.METASTORE_INT_ARCHIVED);
@@ -2355,8 +2356,9 @@ public class DDLTask extends Task<DDLWor
                           formatter.MISSING);
       } else {
           Map<String, String> params = null;
-          if(descDatabase.isExt())
-              params = database.getParameters();
+          if(descDatabase.isExt()) {
+            params = database.getParameters();
+          }
 
           formatter.showDatabaseDescription(outStream,
                                             database.getName(),
@@ -2513,7 +2515,8 @@ public class DDLTask extends Task<DDLWor
 
       List<FieldSchema> cols = null;
       if (colPath.equals(tableName)) {
-        cols = (part == null) ? tbl.getCols() : part.getCols();
+        cols = (part == null || tbl.getTableType() == TableType.VIRTUAL_VIEW) ?
+            tbl.getCols() : part.getCols();
 
         if (!descTbl.isFormatted()) {
           if (tableName.equals(colPath)) {

Modified: hive/branches/branch-0.9/ql/src/java/org/apache/hadoop/hive/ql/metadata/formatting/MetaDataFormatUtils.java
URL: http://svn.apache.org/viewvc/hive/branches/branch-0.9/ql/src/java/org/apache/hadoop/hive/ql/metadata/formatting/MetaDataFormatUtils.java?rev=1328569&r1=1328568&r2=1328569&view=diff
==============================================================================
--- hive/branches/branch-0.9/ql/src/java/org/apache/hadoop/hive/ql/metadata/formatting/MetaDataFormatUtils.java (original)
+++ hive/branches/branch-0.9/ql/src/java/org/apache/hadoop/hive/ql/metadata/formatting/MetaDataFormatUtils.java Sat Apr 21 02:41:57 2012
@@ -25,6 +25,7 @@ import java.util.List;
 import java.util.Map;
 
 import org.apache.commons.lang.StringEscapeUtils;
+import org.apache.hadoop.hive.metastore.TableType;
 import org.apache.hadoop.hive.metastore.api.FieldSchema;
 import org.apache.hadoop.hive.metastore.api.Index;
 import org.apache.hadoop.hive.metastore.api.StorageDescriptor;
@@ -147,8 +148,10 @@ public final class MetaDataFormatUtils {
     getPartitionMetaDataInformation(tableInfo, part);
 
     // Storage information.
-    tableInfo.append(LINE_DELIM).append("# Storage Information").append(LINE_DELIM);
-    getStorageDescriptorInfo(tableInfo, part.getTPartition().getSd());
+    if (part.getTable().getTableType() != TableType.VIRTUAL_VIEW) {
+      tableInfo.append(LINE_DELIM).append("# Storage Information").append(LINE_DELIM);
+      getStorageDescriptorInfo(tableInfo, part.getTPartition().getSd());
+    }
 
     return tableInfo.toString();
   }

Modified: hive/branches/branch-0.9/ql/src/test/results/clientpositive/describe_formatted_view_partitioned.q.out
URL: http://svn.apache.org/viewvc/hive/branches/branch-0.9/ql/src/test/results/clientpositive/describe_formatted_view_partitioned.q.out?rev=1328569&r1=1328568&r2=1328569&view=diff
==============================================================================
--- hive/branches/branch-0.9/ql/src/test/results/clientpositive/describe_formatted_view_partitioned.q.out (original)
+++ hive/branches/branch-0.9/ql/src/test/results/clientpositive/describe_formatted_view_partitioned.q.out Sat Apr 21 02:41:57 2012
@@ -52,15 +52,6 @@ Protect Mode:       	None               
 #### A masked pattern was here ####
 Partition Parameters:	 	 
 #### A masked pattern was here ####
-	 	 
-# Storage Information	 	 
-SerDe Library:      	null                	 
-InputFormat:        	org.apache.hadoop.mapred.SequenceFileInputFormat	 
-OutputFormat:       	org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat	 
-Compressed:         	No                  	 
-Num Buckets:        	-1                  	 
-Bucket Columns:     	[]                  	 
-Sort Columns:       	[]                  	 
 PREHOOK: query: DROP VIEW view_partitioned
 PREHOOK: type: DROPVIEW
 PREHOOK: Input: default@view_partitioned