hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kevinwilf...@apache.org
Subject svn commit: r1439557 - in /hive/trunk/ql/src: java/org/apache/hadoop/hive/ql/exec/ java/org/apache/hadoop/hive/ql/parse/ java/org/apache/hadoop/hive/ql/plan/ test/queries/clientpositive/ test/results/clientpositive/
Date Mon, 28 Jan 2013 18:42:49 GMT
Author: kevinwilfong
Date: Mon Jan 28 18:42:49 2013
New Revision: 1439557

URL: http://svn.apache.org/viewvc?rev=1439557&view=rev
Log:
HIVE-3903. Allow updating bucketing/sorting metadata of a partition through the CLI. (Samuel
Yuan via kevinwilfong)

Added:
    hive/trunk/ql/src/test/queries/clientpositive/alter_partition_clusterby_sortby.q
    hive/trunk/ql/src/test/queries/clientpositive/alter_table_not_sorted.q
    hive/trunk/ql/src/test/results/clientpositive/alter_partition_clusterby_sortby.q.out
    hive/trunk/ql/src/test/results/clientpositive/alter_table_not_sorted.q.out
Modified:
    hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java
    hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/DDLSemanticAnalyzer.java
    hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/Hive.g
    hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzerFactory.java
    hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/plan/AlterTableDesc.java
    hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/plan/HiveOperation.java

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java?rev=1439557&r1=1439556&r2=1439557&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java Mon Jan 28 18:42:49
2013
@@ -3155,29 +3155,28 @@ public class DDLTask extends Task<DDLWor
       // validate sort columns and bucket columns
       List<String> columns = Utilities.getColumnNamesFromFieldSchema(tbl
           .getCols());
-      Utilities.validateColumnNames(columns, alterTbl.getBucketColumns());
+      if (!alterTbl.isTurnOffSorting()) {
+        Utilities.validateColumnNames(columns, alterTbl.getBucketColumns());
+      }
       if (alterTbl.getSortColumns() != null) {
         Utilities.validateColumnNames(columns, Utilities
             .getColumnNamesFromSortCols(alterTbl.getSortColumns()));
       }
 
-      int numBuckets = -1;
-      ArrayList<String> bucketCols = null;
-      ArrayList<Order> sortCols = null;
-
-      // -1 buckets means to turn off bucketing
-      if (alterTbl.getNumberBuckets() == -1) {
-        bucketCols = new ArrayList<String>();
-        sortCols = new ArrayList<Order>();
-        numBuckets = -1;
+      StorageDescriptor sd = part == null ? tbl.getTTable().getSd() : part.getTPartition().getSd();
+
+      if (alterTbl.isTurnOffSorting()) {
+        sd.setSortCols(new ArrayList<Order>());
+      } else if (alterTbl.getNumberBuckets() == -1) {
+        // -1 buckets means to turn off bucketing
+        sd.setBucketCols(new ArrayList<String>());
+        sd.setNumBuckets(-1);
+        sd.setSortCols(new ArrayList<Order>());
       } else {
-        bucketCols = alterTbl.getBucketColumns();
-        sortCols = alterTbl.getSortColumns();
-        numBuckets = alterTbl.getNumberBuckets();
-      }
-      tbl.getTTable().getSd().setBucketCols(bucketCols);
-      tbl.getTTable().getSd().setNumBuckets(numBuckets);
-      tbl.getTTable().getSd().setSortCols(sortCols);
+        sd.setBucketCols(alterTbl.getBucketColumns());
+        sd.setNumBuckets(alterTbl.getNumberBuckets());
+        sd.setSortCols(alterTbl.getSortColumns());
+      }
     } else if (alterTbl.getOp() == AlterTableDesc.AlterTableTypes.ALTERLOCATION) {
       String newLocation = alterTbl.getNewLocation();
       try {

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/DDLSemanticAnalyzer.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/DDLSemanticAnalyzer.java?rev=1439557&r1=1439556&r2=1439557&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/DDLSemanticAnalyzer.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/DDLSemanticAnalyzer.java Mon Jan
28 18:42:49 2013
@@ -218,6 +218,8 @@ public class DDLSemanticAnalyzer extends
         analyzeAlterTableSkewedLocation(ast, tableName, partSpec);
       } else if (ast.getToken().getType() == HiveParser.TOK_TABLEBUCKETS) {
         analyzeAlterTableBucketNum(ast, tableName, partSpec);
+      } else if (ast.getToken().getType() == HiveParser.TOK_ALTERTABLE_CLUSTER_SORT) {
+        analyzeAlterTableClusterSort(ast, tableName, partSpec);
       }
       break;
     }
@@ -334,9 +336,6 @@ public class DDLSemanticAnalyzer extends
     case HiveParser.TOK_DROPTABLE_PROPERTIES:
       analyzeAlterTableProps(ast, false, true);
       break;
-    case HiveParser.TOK_ALTERTABLE_CLUSTER_SORT:
-      analyzeAlterTableClusterSort(ast);
-      break;
     case HiveParser.TOK_ALTERINDEX_REBUILD:
       analyzeAlterIndexRebuild(ast);
       break;
@@ -1388,24 +1387,23 @@ public class DDLSemanticAnalyzer extends
     }
   }
 
-  private void analyzeAlterTableClusterSort(ASTNode ast)
-      throws SemanticException {
-    String tableName = getUnescapedName((ASTNode)ast.getChild(0));
-    Table tab = getTable(tableName, true);
-
-    inputs.add(new ReadEntity(tab));
-    outputs.add(new WriteEntity(tab));
-
-    validateAlterTableType(tab, AlterTableTypes.ADDCLUSTERSORTCOLUMN);
+  private void analyzeAlterTableClusterSort(ASTNode ast, String tableName,
+      HashMap<String, String> partSpec) throws SemanticException {
+    addInputsOutputsAlterTable(tableName, partSpec);
 
-    if (ast.getChildCount() == 1) {
-      // This means that we want to turn off bucketing
-      AlterTableDesc alterTblDesc = new AlterTableDesc(tableName, -1,
-          new ArrayList<String>(), new ArrayList<Order>());
-      rootTasks.add(TaskFactory.get(new DDLWork(getInputs(), getOutputs(),
-          alterTblDesc), conf));
-    } else {
-      ASTNode buckets = (ASTNode) ast.getChild(1);
+    AlterTableDesc alterTblDesc;
+    switch (ast.getChild(0).getType()) {
+    case HiveParser.TOK_NOT_CLUSTERED:
+      alterTblDesc = new AlterTableDesc(tableName, -1, new ArrayList<String>(),
+          new ArrayList<Order>(), partSpec);
+      rootTasks.add(TaskFactory.get(new DDLWork(getInputs(), getOutputs(), alterTblDesc),
conf));
+      break;
+    case HiveParser.TOK_NOT_SORTED:
+      alterTblDesc = new AlterTableDesc(tableName, true, partSpec);
+      rootTasks.add(TaskFactory.get(new DDLWork(getInputs(), getOutputs(), alterTblDesc),
conf));
+      break;
+    case HiveParser.TOK_TABLEBUCKETS:
+      ASTNode buckets = (ASTNode) ast.getChild(0);
       List<String> bucketCols = getColumnNames((ASTNode) buckets.getChild(0));
       List<Order> sortCols = new ArrayList<Order>();
       int numBuckets = -1;
@@ -1419,10 +1417,11 @@ public class DDLSemanticAnalyzer extends
         throw new SemanticException(ErrorMsg.INVALID_BUCKET_NUMBER.getMsg());
       }
 
-      AlterTableDesc alterTblDesc = new AlterTableDesc(tableName, numBuckets,
-          bucketCols, sortCols);
+      alterTblDesc = new AlterTableDesc(tableName, numBuckets,
+          bucketCols, sortCols, partSpec);
       rootTasks.add(TaskFactory.get(new DDLWork(getInputs(), getOutputs(),
           alterTblDesc), conf));
+      break;
     }
   }
 

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/Hive.g
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/Hive.g?rev=1439557&r1=1439556&r2=1439557&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/Hive.g (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/Hive.g Mon Jan 28 18:42:49 2013
@@ -184,6 +184,8 @@ TOK_READONLY;
 TOK_NO_DROP;
 TOK_STORAGEHANDLER;
 TOK_ALTERTABLE_CLUSTER_SORT;
+TOK_NOT_CLUSTERED;
+TOK_NOT_SORTED;
 TOK_TABCOLNAME;
 TOK_TABLELOCATION;
 TOK_PARTITIONLOCATION;
@@ -625,7 +627,6 @@ alterTableStatementSuffix
     | alterStatementSuffixUnArchive
     | alterStatementSuffixProperties
     | alterTblPartitionStatement
-    | alterStatementSuffixClusterbySortby
     | alterStatementSuffixSkewedby
     ;
 
@@ -794,6 +795,7 @@ alterTblPartitionStatementSuffix
   | alterStatementSuffixRenamePart
   | alterStatementSuffixBucketNum
   | alterTblPartitionStatementSuffixSkewedLocation
+  | alterStatementSuffixClusterbySortby
   ;
 
 alterStatementSuffixFileFormat
@@ -803,6 +805,14 @@ alterStatementSuffixFileFormat
 	-> ^(TOK_ALTERTABLE_FILEFORMAT fileFormat)
 	;
 
+alterStatementSuffixClusterbySortby
+@init {msgs.push("alter partition cluster by sort by statement");}
+@after {msgs.pop();}
+  : KW_NOT KW_CLUSTERED -> ^(TOK_ALTERTABLE_CLUSTER_SORT TOK_NOT_CLUSTERED)
+  | KW_NOT KW_SORTED -> ^(TOK_ALTERTABLE_CLUSTER_SORT TOK_NOT_SORTED)
+  | tableBuckets -> ^(TOK_ALTERTABLE_CLUSTER_SORT tableBuckets)
+  ;
+
 alterTblPartitionStatementSuffixSkewedLocation
 @init {msgs.push("alter partition skewed location");}
 @after {msgs.pop();}
@@ -895,16 +905,6 @@ alterStatementSuffixBucketNum
     -> ^(TOK_TABLEBUCKETS $num)
     ;
 
-alterStatementSuffixClusterbySortby
-@init {msgs.push("alter cluster by sort by statement");}
-@after{msgs.pop();}
-	:name=Identifier tableBuckets
-	->^(TOK_ALTERTABLE_CLUSTER_SORT $name tableBuckets)
-	|
-	name=Identifier KW_NOT KW_CLUSTERED
-	->^(TOK_ALTERTABLE_CLUSTER_SORT $name)
-	;
-
 fileFormat
 @init { msgs.push("file format specification"); }
 @after { msgs.pop(); }

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzerFactory.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzerFactory.java?rev=1439557&r1=1439556&r2=1439557&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzerFactory.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzerFactory.java Mon
Jan 28 18:42:49 2013
@@ -58,7 +58,6 @@ public final class SemanticAnalyzerFacto
     commandType.put(HiveParser.TOK_ALTERTABLE_UNARCHIVE, HiveOperation.ALTERTABLE_UNARCHIVE);
     commandType.put(HiveParser.TOK_ALTERTABLE_PROPERTIES, HiveOperation.ALTERTABLE_PROPERTIES);
     commandType.put(HiveParser.TOK_DROPTABLE_PROPERTIES, HiveOperation.ALTERTABLE_PROPERTIES);
-    commandType.put(HiveParser.TOK_ALTERTABLE_CLUSTER_SORT, HiveOperation.ALTERTABLE_CLUSTER_SORT);
     commandType.put(HiveParser.TOK_SHOWDATABASES, HiveOperation.SHOWDATABASES);
     commandType.put(HiveParser.TOK_SHOWTABLES, HiveOperation.SHOWTABLES);
     commandType.put(HiveParser.TOK_SHOWCOLUMNS, HiveOperation.SHOWCOLUMNS);
@@ -126,6 +125,9 @@ public final class SemanticAnalyzerFacto
     tablePartitionCommandType.put(HiveParser.TOK_TABLEBUCKETS,
         new HiveOperation[] {HiveOperation.ALTERTABLE_BUCKETNUM,
             HiveOperation.ALTERPARTITION_BUCKETNUM});
+    tablePartitionCommandType.put(HiveParser.TOK_ALTERTABLE_CLUSTER_SORT,
+        new HiveOperation[] {HiveOperation.ALTERTABLE_CLUSTER_SORT,
+            HiveOperation.ALTERTABLE_CLUSTER_SORT});
   }
 
   public static BaseSemanticAnalyzer get(HiveConf conf, ASTNode tree)

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/plan/AlterTableDesc.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/plan/AlterTableDesc.java?rev=1439557&r1=1439556&r2=1439557&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/plan/AlterTableDesc.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/plan/AlterTableDesc.java Mon Jan 28 18:42:49
2013
@@ -87,6 +87,7 @@ public class AlterTableDesc extends DDLD
   List<List<String>> skewedColValues;
   Table table;
   boolean isDropIfExists = false;
+  boolean isTurnOffSorting = false;
 
   public AlterTableDesc() {
   }
@@ -180,12 +181,20 @@ public class AlterTableDesc extends DDLD
   }
 
   public AlterTableDesc(String tableName, int numBuckets,
-      List<String> bucketCols, List<Order> sortCols) {
+      List<String> bucketCols, List<Order> sortCols, HashMap<String, String>
partSpec) {
     oldName = tableName;
     op = AlterTableTypes.ADDCLUSTERSORTCOLUMN;
     numberBuckets = numBuckets;
     bucketColumns = new ArrayList<String>(bucketCols);
     sortColumns = new ArrayList<Order>(sortCols);
+    this.partSpec = partSpec;
+  }
+
+  public AlterTableDesc(String tableName, boolean sortingOff, HashMap<String, String>
partSpec) {
+    oldName = tableName;
+    op = AlterTableTypes.ADDCLUSTERSORTCOLUMN;
+    isTurnOffSorting = sortingOff;
+    this.partSpec = partSpec;
   }
 
   public AlterTableDesc(String tableName, String newLocation,
@@ -589,6 +598,13 @@ public class AlterTableDesc extends DDLD
   }
 
   /**
+   * @return isTurnOffSorting
+   */
+  public boolean isTurnOffSorting() {
+    return isTurnOffSorting;
+  }
+
+  /**
    * @return the turnOffSkewed
    */
   public boolean isTurnOffSkewed() {

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/plan/HiveOperation.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/plan/HiveOperation.java?rev=1439557&r1=1439556&r2=1439557&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/plan/HiveOperation.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/plan/HiveOperation.java Mon Jan 28 18:42:49
2013
@@ -48,7 +48,8 @@ public enum HiveOperation {
   ALTERPARTITION_SERIALIZER("ALTERPARTITION_SERIALIZER", new Privilege[]{Privilege.ALTER_METADATA},
null),
   ALTERTABLE_SERDEPROPERTIES("ALTERTABLE_SERDEPROPERTIES", new Privilege[]{Privilege.ALTER_METADATA},
null),
   ALTERPARTITION_SERDEPROPERTIES("ALTERPARTITION_SERDEPROPERTIES", new Privilege[]{Privilege.ALTER_METADATA},
null),
-  ALTERTABLE_CLUSTER_SORT("ALTERTABLE_CLUSTER_SORT", new Privilege[]{Privilege.ALTER_METADATA},
null),
+  ALTERTABLE_CLUSTER_SORT("ALTERTABLE_CLUSTER_SORT",
+      new Privilege[]{Privilege.ALTER_METADATA}, null),
   ANALYZE_TABLE("ANALYZE_TABLE", null, null),
   ALTERTABLE_BUCKETNUM("ALTERTABLE_BUCKETNUM",
       new Privilege[]{Privilege.ALTER_METADATA}, null),

Added: hive/trunk/ql/src/test/queries/clientpositive/alter_partition_clusterby_sortby.q
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/queries/clientpositive/alter_partition_clusterby_sortby.q?rev=1439557&view=auto
==============================================================================
--- hive/trunk/ql/src/test/queries/clientpositive/alter_partition_clusterby_sortby.q (added)
+++ hive/trunk/ql/src/test/queries/clientpositive/alter_partition_clusterby_sortby.q Mon Jan
28 18:42:49 2013
@@ -0,0 +1,23 @@
+create table alter_table_partition_clusterby_sortby (a int, b int) partitioned by (c string)
clustered by (a, b) sorted by (a desc, b asc) into 4 buckets;
+alter table alter_table_partition_clusterby_sortby add partition(c='abc');
+
+-- Turn off sorting for a partition
+
+alter table alter_table_partition_clusterby_sortby partition(c='abc') not sorted;
+desc formatted alter_table_partition_clusterby_sortby partition(c='abc');
+
+-- Modify clustering for a partition
+
+alter table alter_table_partition_clusterby_sortby partition(c='abc') clustered by (b) sorted
by (b desc) into 4 buckets;
+desc formatted alter_table_partition_clusterby_sortby partition(c='abc');
+
+-- Turn off clustering for a partition
+
+alter table alter_table_partition_clusterby_sortby partition(c='abc') not clustered;
+desc formatted alter_table_partition_clusterby_sortby partition(c='abc');
+
+-- Table properties should be unchanged
+
+desc formatted alter_table_partition_clusterby_sortby;
+
+drop table alter_table_partition_clusterby_sortby;

Added: hive/trunk/ql/src/test/queries/clientpositive/alter_table_not_sorted.q
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/queries/clientpositive/alter_table_not_sorted.q?rev=1439557&view=auto
==============================================================================
--- hive/trunk/ql/src/test/queries/clientpositive/alter_table_not_sorted.q (added)
+++ hive/trunk/ql/src/test/queries/clientpositive/alter_table_not_sorted.q Mon Jan 28 18:42:49
2013
@@ -0,0 +1,7 @@
+create table alter_table_not_sorted (a int, b int) clustered by (a) sorted by (a) into 4
buckets;
+desc formatted alter_table_not_sorted;
+
+alter table alter_table_not_sorted not sorted;
+desc formatted alter_table_not_sorted;
+
+drop table alter_table_not_sorted;

Added: hive/trunk/ql/src/test/results/clientpositive/alter_partition_clusterby_sortby.q.out
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/clientpositive/alter_partition_clusterby_sortby.q.out?rev=1439557&view=auto
==============================================================================
--- hive/trunk/ql/src/test/results/clientpositive/alter_partition_clusterby_sortby.q.out (added)
+++ hive/trunk/ql/src/test/results/clientpositive/alter_partition_clusterby_sortby.q.out Mon
Jan 28 18:42:49 2013
@@ -0,0 +1,200 @@
+PREHOOK: query: create table alter_table_partition_clusterby_sortby (a int, b int) partitioned
by (c string) clustered by (a, b) sorted by (a desc, b asc) into 4 buckets
+PREHOOK: type: CREATETABLE
+POSTHOOK: query: create table alter_table_partition_clusterby_sortby (a int, b int) partitioned
by (c string) clustered by (a, b) sorted by (a desc, b asc) into 4 buckets
+POSTHOOK: type: CREATETABLE
+POSTHOOK: Output: default@alter_table_partition_clusterby_sortby
+PREHOOK: query: alter table alter_table_partition_clusterby_sortby add partition(c='abc')
+PREHOOK: type: ALTERTABLE_ADDPARTS
+PREHOOK: Input: default@alter_table_partition_clusterby_sortby
+POSTHOOK: query: alter table alter_table_partition_clusterby_sortby add partition(c='abc')
+POSTHOOK: type: ALTERTABLE_ADDPARTS
+POSTHOOK: Input: default@alter_table_partition_clusterby_sortby
+POSTHOOK: Output: default@alter_table_partition_clusterby_sortby@c=abc
+PREHOOK: query: -- Turn off sorting for a partition
+
+alter table alter_table_partition_clusterby_sortby partition(c='abc') not sorted
+PREHOOK: type: ALTERTABLE_CLUSTER_SORT
+PREHOOK: Input: default@alter_table_partition_clusterby_sortby
+PREHOOK: Output: default@alter_table_partition_clusterby_sortby@c=abc
+POSTHOOK: query: -- Turn off sorting for a partition
+
+alter table alter_table_partition_clusterby_sortby partition(c='abc') not sorted
+POSTHOOK: type: ALTERTABLE_CLUSTER_SORT
+POSTHOOK: Input: default@alter_table_partition_clusterby_sortby
+POSTHOOK: Input: default@alter_table_partition_clusterby_sortby@c=abc
+POSTHOOK: Output: default@alter_table_partition_clusterby_sortby@c=abc
+PREHOOK: query: desc formatted alter_table_partition_clusterby_sortby partition(c='abc')
+PREHOOK: type: DESCTABLE
+POSTHOOK: query: desc formatted alter_table_partition_clusterby_sortby partition(c='abc')
+POSTHOOK: type: DESCTABLE
+# col_name            	data_type           	comment             
+	 	 
+a                   	int                 	None                
+b                   	int                 	None                
+	 	 
+# Partition Information	 	 
+# col_name            	data_type           	comment             
+	 	 
+c                   	string              	None                
+	 	 
+# Detailed Partition Information	 	 
+Partition Value:    	[abc]               	 
+Database:           	default             	 
+Table:              	alter_table_partition_clusterby_sortby	 
+#### A masked pattern was here ####
+Protect Mode:       	None                	 
+#### A masked pattern was here ####
+Partition Parameters:	 	 
+#### A masked pattern was here ####
+	 	 
+# Storage Information	 	 
+SerDe Library:      	org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe	 
+InputFormat:        	org.apache.hadoop.mapred.TextInputFormat	 
+OutputFormat:       	org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat	 
+Compressed:         	No                  	 
+Num Buckets:        	4                   	 
+Bucket Columns:     	[a, b]              	 
+Sort Columns:       	[]                  	 
+Storage Desc Params:	 	 
+	serialization.format	1                   
+PREHOOK: query: -- Modify clustering for a partition
+
+alter table alter_table_partition_clusterby_sortby partition(c='abc') clustered by (b) sorted
by (b desc) into 4 buckets
+PREHOOK: type: ALTERTABLE_CLUSTER_SORT
+PREHOOK: Input: default@alter_table_partition_clusterby_sortby
+PREHOOK: Output: default@alter_table_partition_clusterby_sortby@c=abc
+POSTHOOK: query: -- Modify clustering for a partition
+
+alter table alter_table_partition_clusterby_sortby partition(c='abc') clustered by (b) sorted
by (b desc) into 4 buckets
+POSTHOOK: type: ALTERTABLE_CLUSTER_SORT
+POSTHOOK: Input: default@alter_table_partition_clusterby_sortby
+POSTHOOK: Input: default@alter_table_partition_clusterby_sortby@c=abc
+POSTHOOK: Output: default@alter_table_partition_clusterby_sortby@c=abc
+PREHOOK: query: desc formatted alter_table_partition_clusterby_sortby partition(c='abc')
+PREHOOK: type: DESCTABLE
+POSTHOOK: query: desc formatted alter_table_partition_clusterby_sortby partition(c='abc')
+POSTHOOK: type: DESCTABLE
+# col_name            	data_type           	comment             
+	 	 
+a                   	int                 	None                
+b                   	int                 	None                
+	 	 
+# Partition Information	 	 
+# col_name            	data_type           	comment             
+	 	 
+c                   	string              	None                
+	 	 
+# Detailed Partition Information	 	 
+Partition Value:    	[abc]               	 
+Database:           	default             	 
+Table:              	alter_table_partition_clusterby_sortby	 
+#### A masked pattern was here ####
+Protect Mode:       	None                	 
+#### A masked pattern was here ####
+Partition Parameters:	 	 
+#### A masked pattern was here ####
+	 	 
+# Storage Information	 	 
+SerDe Library:      	org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe	 
+InputFormat:        	org.apache.hadoop.mapred.TextInputFormat	 
+OutputFormat:       	org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat	 
+Compressed:         	No                  	 
+Num Buckets:        	4                   	 
+Bucket Columns:     	[b]                 	 
+Sort Columns:       	[Order(col:b, order:0)]	 
+Storage Desc Params:	 	 
+	serialization.format	1                   
+PREHOOK: query: -- Turn off clustering for a partition
+
+alter table alter_table_partition_clusterby_sortby partition(c='abc') not clustered
+PREHOOK: type: ALTERTABLE_CLUSTER_SORT
+PREHOOK: Input: default@alter_table_partition_clusterby_sortby
+PREHOOK: Output: default@alter_table_partition_clusterby_sortby@c=abc
+POSTHOOK: query: -- Turn off clustering for a partition
+
+alter table alter_table_partition_clusterby_sortby partition(c='abc') not clustered
+POSTHOOK: type: ALTERTABLE_CLUSTER_SORT
+POSTHOOK: Input: default@alter_table_partition_clusterby_sortby
+POSTHOOK: Input: default@alter_table_partition_clusterby_sortby@c=abc
+POSTHOOK: Output: default@alter_table_partition_clusterby_sortby@c=abc
+PREHOOK: query: desc formatted alter_table_partition_clusterby_sortby partition(c='abc')
+PREHOOK: type: DESCTABLE
+POSTHOOK: query: desc formatted alter_table_partition_clusterby_sortby partition(c='abc')
+POSTHOOK: type: DESCTABLE
+# col_name            	data_type           	comment             
+	 	 
+a                   	int                 	None                
+b                   	int                 	None                
+	 	 
+# Partition Information	 	 
+# col_name            	data_type           	comment             
+	 	 
+c                   	string              	None                
+	 	 
+# Detailed Partition Information	 	 
+Partition Value:    	[abc]               	 
+Database:           	default             	 
+Table:              	alter_table_partition_clusterby_sortby	 
+#### A masked pattern was here ####
+Protect Mode:       	None                	 
+#### A masked pattern was here ####
+Partition Parameters:	 	 
+#### A masked pattern was here ####
+	 	 
+# Storage Information	 	 
+SerDe Library:      	org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe	 
+InputFormat:        	org.apache.hadoop.mapred.TextInputFormat	 
+OutputFormat:       	org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat	 
+Compressed:         	No                  	 
+Num Buckets:        	-1                  	 
+Bucket Columns:     	[]                  	 
+Sort Columns:       	[]                  	 
+Storage Desc Params:	 	 
+	serialization.format	1                   
+PREHOOK: query: -- Table properties should be unchanged
+
+desc formatted alter_table_partition_clusterby_sortby
+PREHOOK: type: DESCTABLE
+POSTHOOK: query: -- Table properties should be unchanged
+
+desc formatted alter_table_partition_clusterby_sortby
+POSTHOOK: type: DESCTABLE
+# col_name            	data_type           	comment             
+	 	 
+a                   	int                 	None                
+b                   	int                 	None                
+	 	 
+# Partition Information	 	 
+# col_name            	data_type           	comment             
+	 	 
+c                   	string              	None                
+	 	 
+# Detailed Table Information	 	 
+Database:           	default             	 
+#### A masked pattern was here ####
+Protect Mode:       	None                	 
+Retention:          	0                   	 
+#### A masked pattern was here ####
+Table Type:         	MANAGED_TABLE       	 
+Table Parameters:	 	 
+	SORTBUCKETCOLSPREFIX	TRUE                
+#### A masked pattern was here ####
+	 	 
+# Storage Information	 	 
+SerDe Library:      	org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe	 
+InputFormat:        	org.apache.hadoop.mapred.TextInputFormat	 
+OutputFormat:       	org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat	 
+Compressed:         	No                  	 
+Num Buckets:        	4                   	 
+Bucket Columns:     	[a, b]              	 
+Sort Columns:       	[Order(col:a, order:0), Order(col:b, order:1)]	 
+Storage Desc Params:	 	 
+	serialization.format	1                   
+PREHOOK: query: drop table alter_table_partition_clusterby_sortby
+PREHOOK: type: DROPTABLE
+PREHOOK: Input: default@alter_table_partition_clusterby_sortby
+PREHOOK: Output: default@alter_table_partition_clusterby_sortby
+POSTHOOK: query: drop table alter_table_partition_clusterby_sortby
+POSTHOOK: type: DROPTABLE
+POSTHOOK: Input: default@alter_table_partition_clusterby_sortby
+POSTHOOK: Output: default@alter_table_partition_clusterby_sortby

Added: hive/trunk/ql/src/test/results/clientpositive/alter_table_not_sorted.q.out
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/clientpositive/alter_table_not_sorted.q.out?rev=1439557&view=auto
==============================================================================
--- hive/trunk/ql/src/test/results/clientpositive/alter_table_not_sorted.q.out (added)
+++ hive/trunk/ql/src/test/results/clientpositive/alter_table_not_sorted.q.out Mon Jan 28
18:42:49 2013
@@ -0,0 +1,81 @@
+PREHOOK: query: create table alter_table_not_sorted (a int, b int) clustered by (a) sorted
by (a) into 4 buckets
+PREHOOK: type: CREATETABLE
+POSTHOOK: query: create table alter_table_not_sorted (a int, b int) clustered by (a) sorted
by (a) into 4 buckets
+POSTHOOK: type: CREATETABLE
+POSTHOOK: Output: default@alter_table_not_sorted
+PREHOOK: query: desc formatted alter_table_not_sorted
+PREHOOK: type: DESCTABLE
+POSTHOOK: query: desc formatted alter_table_not_sorted
+POSTHOOK: type: DESCTABLE
+# col_name            	data_type           	comment             
+	 	 
+a                   	int                 	None                
+b                   	int                 	None                
+	 	 
+# Detailed Table Information	 	 
+Database:           	default             	 
+#### A masked pattern was here ####
+Protect Mode:       	None                	 
+Retention:          	0                   	 
+#### A masked pattern was here ####
+Table Type:         	MANAGED_TABLE       	 
+Table Parameters:	 	 
+	SORTBUCKETCOLSPREFIX	TRUE                
+#### A masked pattern was here ####
+	 	 
+# Storage Information	 	 
+SerDe Library:      	org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe	 
+InputFormat:        	org.apache.hadoop.mapred.TextInputFormat	 
+OutputFormat:       	org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat	 
+Compressed:         	No                  	 
+Num Buckets:        	4                   	 
+Bucket Columns:     	[a]                 	 
+Sort Columns:       	[Order(col:a, order:1)]	 
+Storage Desc Params:	 	 
+	serialization.format	1                   
+PREHOOK: query: alter table alter_table_not_sorted not sorted
+PREHOOK: type: ALTERTABLE_CLUSTER_SORT
+PREHOOK: Input: default@alter_table_not_sorted
+PREHOOK: Output: default@alter_table_not_sorted
+POSTHOOK: query: alter table alter_table_not_sorted not sorted
+POSTHOOK: type: ALTERTABLE_CLUSTER_SORT
+POSTHOOK: Input: default@alter_table_not_sorted
+POSTHOOK: Output: default@alter_table_not_sorted
+PREHOOK: query: desc formatted alter_table_not_sorted
+PREHOOK: type: DESCTABLE
+POSTHOOK: query: desc formatted alter_table_not_sorted
+POSTHOOK: type: DESCTABLE
+# col_name            	data_type           	comment             
+	 	 
+a                   	int                 	None                
+b                   	int                 	None                
+	 	 
+# Detailed Table Information	 	 
+Database:           	default             	 
+#### A masked pattern was here ####
+Protect Mode:       	None                	 
+Retention:          	0                   	 
+#### A masked pattern was here ####
+Table Type:         	MANAGED_TABLE       	 
+Table Parameters:	 	 
+	SORTBUCKETCOLSPREFIX	TRUE                
+#### A masked pattern was here ####
+	 	 
+# Storage Information	 	 
+SerDe Library:      	org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe	 
+InputFormat:        	org.apache.hadoop.mapred.TextInputFormat	 
+OutputFormat:       	org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat	 
+Compressed:         	No                  	 
+Num Buckets:        	4                   	 
+Bucket Columns:     	[a]                 	 
+Sort Columns:       	[]                  	 
+Storage Desc Params:	 	 
+	serialization.format	1                   
+PREHOOK: query: drop table alter_table_not_sorted
+PREHOOK: type: DROPTABLE
+PREHOOK: Input: default@alter_table_not_sorted
+PREHOOK: Output: default@alter_table_not_sorted
+POSTHOOK: query: drop table alter_table_not_sorted
+POSTHOOK: type: DROPTABLE
+POSTHOOK: Input: default@alter_table_not_sorted
+POSTHOOK: Output: default@alter_table_not_sorted



Mime
View raw message