hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From heyongqi...@apache.org
Subject svn commit: r1207701 - in /hive/trunk: 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/ ql/src/java/org/apache/hadoop/hive/ql/parse/ ql/src/java/org/apache/...
Date Mon, 28 Nov 2011 23:42:10 GMT
Author: heyongqiang
Date: Mon Nov 28 23:42:01 2011
New Revision: 1207701

URL: http://svn.apache.org/viewvc?rev=1207701&view=rev
Log:
HIVE-2605: Setting no_drop on a table should cascade to child partitions (namit via He Yongqiang)

Added:
    hive/trunk/ql/src/test/queries/clientnegative/protectmode_tbl6.q
    hive/trunk/ql/src/test/queries/clientnegative/protectmode_tbl7.q
    hive/trunk/ql/src/test/queries/clientnegative/protectmode_tbl8.q
    hive/trunk/ql/src/test/queries/clientpositive/protectmode2.q
    hive/trunk/ql/src/test/results/clientnegative/protectmode_tbl6.q.out
    hive/trunk/ql/src/test/results/clientnegative/protectmode_tbl7.q.out
    hive/trunk/ql/src/test/results/clientnegative/protectmode_tbl8.q.out
    hive/trunk/ql/src/test/results/clientpositive/protectmode2.q.out
Modified:
    hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/ProtectMode.java
    hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java
    hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/metadata/Partition.java
    hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/metadata/Table.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/plan/AlterTableDesc.java

Modified: hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/ProtectMode.java
URL: http://svn.apache.org/viewvc/hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/ProtectMode.java?rev=1207701&r1=1207700&r2=1207701&view=diff
==============================================================================
--- hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/ProtectMode.java (original)
+++ hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/ProtectMode.java Mon Nov
28 23:42:01 2011
@@ -24,11 +24,13 @@ public class ProtectMode {
 
   public static String FLAG_OFFLINE = "OFFLINE";
   public static String FLAG_NO_DROP = "NO_DROP";
+  public static String FLAG_NO_DROP_CASCADE = "NO_DROP_CASCADE";
   public static String FLAG_READ_ONLY = "READ_ONLY";
 
   public boolean offline = false;
   public boolean readOnly = false;
   public boolean noDrop = false;
+  public boolean noDropCascade = false;
 
   static public ProtectMode getProtectModeFromString(String sourceString) {
     return new ProtectMode(sourceString);
@@ -41,6 +43,8 @@ public class ProtectMode {
         offline = true;
       } else if (token.equalsIgnoreCase(FLAG_NO_DROP)) {
         noDrop = true;
+      } else if (token.equalsIgnoreCase(FLAG_NO_DROP_CASCADE)) {
+        noDropCascade = true;
       } else if (token.equalsIgnoreCase(FLAG_READ_ONLY)) {
         readOnly = true;
       }
@@ -68,6 +72,16 @@ public class ProtectMode {
       }
     }
 
+    if (noDropCascade) {
+      if (retString != null) {
+        retString = retString + "," + FLAG_NO_DROP_CASCADE;
+      }
+      else
+      {
+        retString = FLAG_NO_DROP_CASCADE;
+      }
+    }
+
     if (readOnly) {
       if (retString != null) {
         retString = retString + "," + FLAG_READ_ONLY;

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=1207701&r1=1207700&r2=1207701&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 Nov 28 23:42:01
2011
@@ -1222,10 +1222,10 @@ public class DDLTask extends Task<DDLWor
         originalDir.getName() + INTERMEDIATE_ARCHIVED_DIR_SUFFIX);
     Path intermediateOriginalDir = new Path(originalDir.getParent(),
         originalDir.getName() + INTERMEDIATE_ORIGINAL_DIR_SUFFIX);
-    
+
     console.printInfo("intermediate.archived is " + intermediateArchivedDir.toString());
     console.printInfo("intermediate.original is " + intermediateOriginalDir.toString());
-    
+
     String archiveName = "data.har";
     FileSystem fs = null;
     try {
@@ -1412,7 +1412,7 @@ public class DDLTask extends Task<DDLWor
     List<Partition> partitions = db.getPartitions(tbl, partSpec);
 
     int partSpecLevel = partSpec.size();
-    
+
     Path originalDir = null;
 
     // when we have partial partitions specification we must assume partitions
@@ -1435,12 +1435,12 @@ public class DDLTask extends Task<DDLWor
     } else {
       Partition p = partitions.get(0);
       if(ArchiveUtils.isArchived(p)) {
-        originalDir = new Path(getOriginalLocation(p));        
+        originalDir = new Path(getOriginalLocation(p));
       } else {
         originalDir = new Path(p.getLocation());
       }
     }
-    
+
     URI originalUri = ArchiveUtils.addSlash(originalDir.toUri());
     Path intermediateArchivedDir = new Path(originalDir.getParent(),
         originalDir.getName() + INTERMEDIATE_ARCHIVED_DIR_SUFFIX);
@@ -1451,11 +1451,11 @@ public class DDLTask extends Task<DDLWor
       recovery = true;
       console.printInfo("Starting recovery after failed UNARCHIVE");
     }
-    
+
     for(Partition p: partitions) {
       checkArchiveProperty(partSpecLevel, recovery, p);
     }
-    
+
     String archiveName = "data.har";
     FileSystem fs = null;
     try {
@@ -1512,7 +1512,7 @@ public class DDLTask extends Task<DDLWor
     if (!pathExists(intermediateExtractedDir) &&
         !pathExists(intermediateArchivedDir)) {
       try {
-        
+
         // Copy the files out of the archive into the temporary directory
         String copySource = sourceDir.toString();
         String copyDest = tmpPath.toString();
@@ -1524,7 +1524,7 @@ public class DDLTask extends Task<DDLWor
         console.printInfo("Copying " + copySource + " to " + copyDest);
         FileSystem srcFs = FileSystem.get(sourceDir.toUri(), conf);
         srcFs.initialize(sourceDir.toUri(), conf);
-        
+
         FsShell fss = new FsShell(conf);
         int ret = 0;
         try {
@@ -2990,12 +2990,18 @@ public class DDLTask extends Task<DDLWor
       } else if (protectModeEnable
           && protectMode == AlterTableDesc.ProtectModeType.NO_DROP) {
         mode.noDrop = true;
+      } else if (protectModeEnable
+          && protectMode == AlterTableDesc.ProtectModeType.NO_DROP_CASCADE) {
+        mode.noDropCascade = true;
       } else if (!protectModeEnable
           && protectMode == AlterTableDesc.ProtectModeType.OFFLINE) {
         mode.offline = false;
       } else if (!protectModeEnable
           && protectMode == AlterTableDesc.ProtectModeType.NO_DROP) {
         mode.noDrop = false;
+      } else if (!protectModeEnable
+          && protectMode == AlterTableDesc.ProtectModeType.NO_DROP_CASCADE) {
+        mode.noDropCascade = false;
       }
 
       if (part != null) {

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/metadata/Partition.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/metadata/Partition.java?rev=1207701&r1=1207700&r2=1207701&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/metadata/Partition.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/metadata/Partition.java Mon Nov 28 23:42:01
2011
@@ -525,7 +525,7 @@ public class Partition implements Serial
    * @throws HiveException
    *           Thrown if we could not create the partition.
    */
-  public void setValues(Map<String, String> partSpec) 
+  public void setValues(Map<String, String> partSpec)
       throws HiveException {
     List<String> pvals = new ArrayList<String>();
     for (FieldSchema field : table.getPartCols()) {
@@ -584,7 +584,8 @@ public class Partition implements Serial
    */
   public boolean canDrop() {
     ProtectMode mode = getProtectMode();
-    return (!mode.noDrop && !mode.offline && !mode.readOnly);
+    ProtectMode parentMode = table.getProtectMode();
+    return (!mode.noDrop && !mode.offline && !mode.readOnly && !parentMode.noDropCascade);
   }
 
   /**

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/metadata/Table.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/metadata/Table.java?rev=1207701&r1=1207700&r2=1207701&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/metadata/Table.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/metadata/Table.java Mon Nov 28 23:42:01
2011
@@ -262,7 +262,7 @@ public class Table implements Serializab
       throw new RuntimeException(e);
     } catch (HiveException e) {
       throw new RuntimeException(e);
-    }    
+    }
   }
 
   public HiveStorageHandler getStorageHandler() {
@@ -713,7 +713,7 @@ public class Table implements Serializab
   public boolean isView() {
     return TableType.VIRTUAL_VIEW.equals(getTableType());
   }
-  
+
   /**
    * @return whether this table is actually an index table
    */
@@ -800,7 +800,7 @@ public class Table implements Serializab
    */
   public boolean canDrop() {
     ProtectMode mode = getProtectMode();
-    return (!mode.noDrop && !mode.offline && !mode.readOnly);
+    return (!mode.noDrop && !mode.offline && !mode.readOnly && !mode.noDropCascade);
   }
 
   /**

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=1207701&r1=1207700&r2=1207701&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 Nov
28 23:42:01 2011
@@ -830,7 +830,7 @@ public class DDLSemanticAnalyzer extends
     alterIdxDesc.setBaseTableName(baseTableName);
     alterIdxDesc.setDbName(db.getCurrentDatabase());
     alterIdxDesc.setSpec(partSpec);
-        
+
     Task<?> tsTask = TaskFactory.get(new DDLWork(alterIdxDesc), conf);
     for (Task<?> t : indexBuilder) {
       t.addDependentTask(tsTask);
@@ -1105,7 +1105,12 @@ public class DDLSemanticAnalyzer extends
       alterTblDesc.setProtectModeType(AlterTableDesc.ProtectModeType.OFFLINE);
       break;
     case HiveParser.TOK_NO_DROP:
-      alterTblDesc.setProtectModeType(AlterTableDesc.ProtectModeType.NO_DROP);
+      if (grandChild.getChildCount() > 0) {
+        alterTblDesc.setProtectModeType(AlterTableDesc.ProtectModeType.NO_DROP_CASCADE);
+      }
+      else {
+        alterTblDesc.setProtectModeType(AlterTableDesc.ProtectModeType.NO_DROP);
+      }
       break;
     case HiveParser.TOK_READONLY:
       throw new SemanticException(

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=1207701&r1=1207700&r2=1207701&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 Nov 28 23:42:01 2011
@@ -286,7 +286,7 @@ statement
 explainStatement
 @init { msgs.push("explain statement"); }
 @after { msgs.pop(); }
-	: KW_EXPLAIN (explainOptions=KW_EXTENDED|explainOptions=KW_FORMATTED)? execStatement 
+	: KW_EXPLAIN (explainOptions=KW_EXTENDED|explainOptions=KW_FORMATTED)? execStatement
       -> ^(TOK_EXPLAIN execStatement $explainOptions?)
 	;
 
@@ -416,7 +416,7 @@ dbPropertiesList
       keyValueProperty (COMMA keyValueProperty)* -> ^(TOK_DBPROPLIST keyValueProperty+)
     ;
 
- 
+
 switchDatabaseStatement
 @init { msgs.push("switch database statement"); }
 @after { msgs.pop(); }
@@ -482,7 +482,7 @@ createIndexStatement
       tableLocation?
       tablePropertiesPrefixed?
       indexComment?
-    ->^(TOK_CREATEINDEX $indexName $typeName $tab $indexedCols 
+    ->^(TOK_CREATEINDEX $indexName $typeName $tab $indexedCols
         autoRebuild?
         indexPropertiesPrefixed?
         indexTblName?
@@ -784,7 +784,7 @@ alterProtectModeMode
 @init { msgs.push("protect mode specification enable"); }
 @after { msgs.pop(); }
     : KW_OFFLINE  -> ^(TOK_OFFLINE)
-    | KW_NO_DROP  -> ^(TOK_NO_DROP)
+    | KW_NO_DROP KW_CASCADE? -> ^(TOK_NO_DROP KW_CASCADE?)
     | KW_READONLY  -> ^(TOK_READONLY)
     ;
 
@@ -848,7 +848,7 @@ showStatement
     -> ^(TOK_SHOW_TABLESTATUS showStmtIdentifier $db_name? partitionSpec?)
     | KW_SHOW KW_LOCKS (parttype=partTypeExpr)? (isExtended=KW_EXTENDED)? -> ^(TOK_SHOWLOCKS
$parttype? $isExtended?)
     | KW_SHOW (showOptions=KW_FORMATTED)? (KW_INDEX|KW_INDEXES) KW_ON showStmtIdentifier
((KW_FROM|KW_IN) db_name=Identifier)?
-    -> ^(TOK_SHOWINDEXES showStmtIdentifier $showOptions? $db_name?)  
+    -> ^(TOK_SHOWINDEXES showStmtIdentifier $showOptions? $db_name?)
     ;
 
 lockStatement
@@ -886,7 +886,7 @@ dropRoleStatement
 grantPrivileges
 @init {msgs.push("grant privileges");}
 @after {msgs.pop();}
-    : KW_GRANT privList=privilegeList 
+    : KW_GRANT privList=privilegeList
       privilegeObject?
       KW_TO principalSpecification
       (KW_WITH withOption)?
@@ -945,7 +945,7 @@ privilegeObject
 privilegeList
 @init {msgs.push("grant privilege list");}
 @after {msgs.pop();}
-    : privlegeDef (COMMA privlegeDef)* 
+    : privlegeDef (COMMA privlegeDef)*
     -> ^(TOK_PRIVILEGE_LIST privlegeDef+)
     ;
 
@@ -955,7 +955,7 @@ privlegeDef
     : privilegeType (LPAREN cols=columnNameList RPAREN)?
     -> ^(TOK_PRIVILEGE privilegeType $cols?)
     ;
-    
+
 privilegeType
 @init {msgs.push("privilege type");}
 @after {msgs.pop();}
@@ -1428,7 +1428,7 @@ insertClause
 @after { msgs.pop(); }
    :
      KW_INSERT KW_OVERWRITE destination -> ^(TOK_DESTINATION destination)
-   | KW_INSERT KW_INTO KW_TABLE tableOrPartition 
+   | KW_INSERT KW_INTO KW_TABLE tableOrPartition
        -> ^(TOK_INSERT_INTO ^(tableOrPartition))
    ;
 
@@ -1672,14 +1672,14 @@ splitSample
     :
     KW_TABLESAMPLE LPAREN  (numerator=Number) KW_PERCENT RPAREN -> ^(TOK_TABLESPLITSAMPLE
$numerator)
     ;
-    
+
 tableSample
 @init { msgs.push("table sample specification"); }
 @after { msgs.pop(); }
     :
     tableBucketSample |
     splitSample
-    ;    
+    ;
 
 tableSource
 @init { msgs.push("table source"); }
@@ -2117,16 +2117,16 @@ descFuncNames
 
 // Keywords
 
-kwUser 
-: 
+kwUser
+:
 {input.LT(1).getText().equalsIgnoreCase("user")}? Identifier;
 
-kwRole 
-: 
+kwRole
+:
 {input.LT(1).getText().equalsIgnoreCase("role")}? Identifier;
 
 kwInner
-: 
+:
 {input.LT(1).getText().equalsIgnoreCase("inner")}? Identifier;
 
 KW_TRUE : 'TRUE';

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=1207701&r1=1207700&r2=1207701&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 Nov 28 23:42:01
2011
@@ -47,7 +47,7 @@ public class AlterTableDesc extends DDLD
   };
 
   public static enum ProtectModeType {
-    NO_DROP, OFFLINE, READ_ONLY
+    NO_DROP, OFFLINE, READ_ONLY, NO_DROP_CASCADE
   };
 
 

Added: hive/trunk/ql/src/test/queries/clientnegative/protectmode_tbl6.q
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/queries/clientnegative/protectmode_tbl6.q?rev=1207701&view=auto
==============================================================================
--- hive/trunk/ql/src/test/queries/clientnegative/protectmode_tbl6.q (added)
+++ hive/trunk/ql/src/test/queries/clientnegative/protectmode_tbl6.q Mon Nov 28 23:42:01 2011
@@ -0,0 +1,8 @@
+-- protect mode: syntax to change protect mode works and queries are not blocked if a table
or partition is not in protect mode
+
+drop table tbl_protectmode_tbl6;
+
+create table tbl_protectmode_tbl6 (col string);
+alter table tbl_protectmode_tbl6 enable no_drop cascade;
+
+drop table tbl_protectmode_tbl6;

Added: hive/trunk/ql/src/test/queries/clientnegative/protectmode_tbl7.q
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/queries/clientnegative/protectmode_tbl7.q?rev=1207701&view=auto
==============================================================================
--- hive/trunk/ql/src/test/queries/clientnegative/protectmode_tbl7.q (added)
+++ hive/trunk/ql/src/test/queries/clientnegative/protectmode_tbl7.q Mon Nov 28 23:42:01 2011
@@ -0,0 +1,13 @@
+-- protect mode: syntax to change protect mode works and queries are not blocked if a table
or partition is not in protect mode
+
+drop table tbl_protectmode_tbl7;
+create table tbl_protectmode_tbl7  (col string) partitioned by (p string);
+alter table tbl_protectmode_tbl7 add partition (p='p1');
+alter table tbl_protectmode_tbl7 enable no_drop;
+
+alter table tbl_protectmode_tbl7 drop partition (p='p1');
+
+alter table tbl_protectmode_tbl7 add partition (p='p1');
+alter table tbl_protectmode_tbl7 enable no_drop cascade;
+
+alter table tbl_protectmode_tbl7 drop partition (p='p1');

Added: hive/trunk/ql/src/test/queries/clientnegative/protectmode_tbl8.q
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/queries/clientnegative/protectmode_tbl8.q?rev=1207701&view=auto
==============================================================================
--- hive/trunk/ql/src/test/queries/clientnegative/protectmode_tbl8.q (added)
+++ hive/trunk/ql/src/test/queries/clientnegative/protectmode_tbl8.q Mon Nov 28 23:42:01 2011
@@ -0,0 +1,13 @@
+-- protect mode: syntax to change protect mode works and queries are not blocked if a table
or partition is not in protect mode
+
+drop table tbl_protectmode_tbl8;
+create table tbl_protectmode_tbl8  (col string) partitioned by (p string);
+alter table tbl_protectmode_tbl8 add partition (p='p1');
+alter table tbl_protectmode_tbl8 enable no_drop;
+
+alter table tbl_protectmode_tbl8 drop partition (p='p1');
+
+alter table tbl_protectmode_tbl8 enable no_drop cascade;
+
+alter table tbl_protectmode_tbl8 add partition (p='p1');
+alter table tbl_protectmode_tbl8 drop partition (p='p1');

Added: hive/trunk/ql/src/test/queries/clientpositive/protectmode2.q
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/queries/clientpositive/protectmode2.q?rev=1207701&view=auto
==============================================================================
--- hive/trunk/ql/src/test/queries/clientpositive/protectmode2.q (added)
+++ hive/trunk/ql/src/test/queries/clientpositive/protectmode2.q Mon Nov 28 23:42:01 2011
@@ -0,0 +1,22 @@
+drop table tbl1;
+
+create table tbl1 (col string);
+alter table tbl1 enable no_drop cascade;
+desc extended tbl1;
+alter table tbl1 enable no_drop;
+desc extended tbl1;
+alter table tbl1 disable no_drop cascade;
+desc extended tbl1;
+alter table tbl1 disable no_drop;
+
+drop table tbl1;
+
+drop table tbl2;
+create table tbl2 (col string) partitioned by (p string);
+alter table tbl2 add partition (p='p1');
+alter table tbl2 add partition (p='p2');
+alter table tbl2 add partition (p='p3');
+alter table tbl2 enable no_drop cascade;
+desc extended tbl2;
+alter table tbl2 disable no_drop cascade;
+drop table tbl2;

Added: hive/trunk/ql/src/test/results/clientnegative/protectmode_tbl6.q.out
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/clientnegative/protectmode_tbl6.q.out?rev=1207701&view=auto
==============================================================================
--- hive/trunk/ql/src/test/results/clientnegative/protectmode_tbl6.q.out (added)
+++ hive/trunk/ql/src/test/results/clientnegative/protectmode_tbl6.q.out Mon Nov 28 23:42:01
2011
@@ -0,0 +1,27 @@
+PREHOOK: query: -- protect mode: syntax to change protect mode works and queries are not
blocked if a table or partition is not in protect mode
+
+drop table tbl_protectmode_tbl6
+PREHOOK: type: DROPTABLE
+POSTHOOK: query: -- protect mode: syntax to change protect mode works and queries are not
blocked if a table or partition is not in protect mode
+
+drop table tbl_protectmode_tbl6
+POSTHOOK: type: DROPTABLE
+PREHOOK: query: create table tbl_protectmode_tbl6 (col string)
+PREHOOK: type: CREATETABLE
+POSTHOOK: query: create table tbl_protectmode_tbl6 (col string)
+POSTHOOK: type: CREATETABLE
+POSTHOOK: Output: default@tbl_protectmode_tbl6
+PREHOOK: query: alter table tbl_protectmode_tbl6 enable no_drop cascade
+PREHOOK: type: ALTERTABLE_PROTECTMODE
+PREHOOK: Input: default@tbl_protectmode_tbl6
+PREHOOK: Output: default@tbl_protectmode_tbl6
+POSTHOOK: query: alter table tbl_protectmode_tbl6 enable no_drop cascade
+POSTHOOK: type: ALTERTABLE_PROTECTMODE
+POSTHOOK: Input: default@tbl_protectmode_tbl6
+POSTHOOK: Output: default@tbl_protectmode_tbl6
+PREHOOK: query: drop table tbl_protectmode_tbl6
+PREHOOK: type: DROPTABLE
+PREHOOK: Input: default@tbl_protectmode_tbl6
+PREHOOK: Output: default@tbl_protectmode_tbl6
+FAILED: Error in metadata: Table tbl_protectmode_tbl6 is protected from being dropped
+FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask

Added: hive/trunk/ql/src/test/results/clientnegative/protectmode_tbl7.q.out
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/clientnegative/protectmode_tbl7.q.out?rev=1207701&view=auto
==============================================================================
--- hive/trunk/ql/src/test/results/clientnegative/protectmode_tbl7.q.out (added)
+++ hive/trunk/ql/src/test/results/clientnegative/protectmode_tbl7.q.out Mon Nov 28 23:42:01
2011
@@ -0,0 +1,57 @@
+PREHOOK: query: -- protect mode: syntax to change protect mode works and queries are not
blocked if a table or partition is not in protect mode
+
+drop table tbl_protectmode_tbl7
+PREHOOK: type: DROPTABLE
+POSTHOOK: query: -- protect mode: syntax to change protect mode works and queries are not
blocked if a table or partition is not in protect mode
+
+drop table tbl_protectmode_tbl7
+POSTHOOK: type: DROPTABLE
+PREHOOK: query: create table tbl_protectmode_tbl7  (col string) partitioned by (p string)
+PREHOOK: type: CREATETABLE
+POSTHOOK: query: create table tbl_protectmode_tbl7  (col string) partitioned by (p string)
+POSTHOOK: type: CREATETABLE
+POSTHOOK: Output: default@tbl_protectmode_tbl7
+PREHOOK: query: alter table tbl_protectmode_tbl7 add partition (p='p1')
+PREHOOK: type: ALTERTABLE_ADDPARTS
+PREHOOK: Input: default@tbl_protectmode_tbl7
+POSTHOOK: query: alter table tbl_protectmode_tbl7 add partition (p='p1')
+POSTHOOK: type: ALTERTABLE_ADDPARTS
+POSTHOOK: Input: default@tbl_protectmode_tbl7
+POSTHOOK: Output: default@tbl_protectmode_tbl7@p=p1
+PREHOOK: query: alter table tbl_protectmode_tbl7 enable no_drop
+PREHOOK: type: ALTERTABLE_PROTECTMODE
+PREHOOK: Input: default@tbl_protectmode_tbl7
+PREHOOK: Output: default@tbl_protectmode_tbl7
+POSTHOOK: query: alter table tbl_protectmode_tbl7 enable no_drop
+POSTHOOK: type: ALTERTABLE_PROTECTMODE
+POSTHOOK: Input: default@tbl_protectmode_tbl7
+POSTHOOK: Output: default@tbl_protectmode_tbl7
+PREHOOK: query: alter table tbl_protectmode_tbl7 drop partition (p='p1')
+PREHOOK: type: ALTERTABLE_DROPPARTS
+PREHOOK: Input: default@tbl_protectmode_tbl7
+PREHOOK: Output: default@tbl_protectmode_tbl7@p=p1
+POSTHOOK: query: alter table tbl_protectmode_tbl7 drop partition (p='p1')
+POSTHOOK: type: ALTERTABLE_DROPPARTS
+POSTHOOK: Input: default@tbl_protectmode_tbl7
+POSTHOOK: Output: default@tbl_protectmode_tbl7@p=p1
+PREHOOK: query: alter table tbl_protectmode_tbl7 add partition (p='p1')
+PREHOOK: type: ALTERTABLE_ADDPARTS
+PREHOOK: Input: default@tbl_protectmode_tbl7
+POSTHOOK: query: alter table tbl_protectmode_tbl7 add partition (p='p1')
+POSTHOOK: type: ALTERTABLE_ADDPARTS
+POSTHOOK: Input: default@tbl_protectmode_tbl7
+POSTHOOK: Output: default@tbl_protectmode_tbl7@p=p1
+PREHOOK: query: alter table tbl_protectmode_tbl7 enable no_drop cascade
+PREHOOK: type: ALTERTABLE_PROTECTMODE
+PREHOOK: Input: default@tbl_protectmode_tbl7
+PREHOOK: Output: default@tbl_protectmode_tbl7
+POSTHOOK: query: alter table tbl_protectmode_tbl7 enable no_drop cascade
+POSTHOOK: type: ALTERTABLE_PROTECTMODE
+POSTHOOK: Input: default@tbl_protectmode_tbl7
+POSTHOOK: Output: default@tbl_protectmode_tbl7
+PREHOOK: query: alter table tbl_protectmode_tbl7 drop partition (p='p1')
+PREHOOK: type: ALTERTABLE_DROPPARTS
+PREHOOK: Input: default@tbl_protectmode_tbl7
+PREHOOK: Output: default@tbl_protectmode_tbl7@p=p1
+FAILED: Error in metadata: Table tbl_protectmode_tbl7 Partition p=p1 is protected from being
dropped
+FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask

Added: hive/trunk/ql/src/test/results/clientnegative/protectmode_tbl8.q.out
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/clientnegative/protectmode_tbl8.q.out?rev=1207701&view=auto
==============================================================================
--- hive/trunk/ql/src/test/results/clientnegative/protectmode_tbl8.q.out (added)
+++ hive/trunk/ql/src/test/results/clientnegative/protectmode_tbl8.q.out Mon Nov 28 23:42:01
2011
@@ -0,0 +1,57 @@
+PREHOOK: query: -- protect mode: syntax to change protect mode works and queries are not
blocked if a table or partition is not in protect mode
+
+drop table tbl_protectmode_tbl8
+PREHOOK: type: DROPTABLE
+POSTHOOK: query: -- protect mode: syntax to change protect mode works and queries are not
blocked if a table or partition is not in protect mode
+
+drop table tbl_protectmode_tbl8
+POSTHOOK: type: DROPTABLE
+PREHOOK: query: create table tbl_protectmode_tbl8  (col string) partitioned by (p string)
+PREHOOK: type: CREATETABLE
+POSTHOOK: query: create table tbl_protectmode_tbl8  (col string) partitioned by (p string)
+POSTHOOK: type: CREATETABLE
+POSTHOOK: Output: default@tbl_protectmode_tbl8
+PREHOOK: query: alter table tbl_protectmode_tbl8 add partition (p='p1')
+PREHOOK: type: ALTERTABLE_ADDPARTS
+PREHOOK: Input: default@tbl_protectmode_tbl8
+POSTHOOK: query: alter table tbl_protectmode_tbl8 add partition (p='p1')
+POSTHOOK: type: ALTERTABLE_ADDPARTS
+POSTHOOK: Input: default@tbl_protectmode_tbl8
+POSTHOOK: Output: default@tbl_protectmode_tbl8@p=p1
+PREHOOK: query: alter table tbl_protectmode_tbl8 enable no_drop
+PREHOOK: type: ALTERTABLE_PROTECTMODE
+PREHOOK: Input: default@tbl_protectmode_tbl8
+PREHOOK: Output: default@tbl_protectmode_tbl8
+POSTHOOK: query: alter table tbl_protectmode_tbl8 enable no_drop
+POSTHOOK: type: ALTERTABLE_PROTECTMODE
+POSTHOOK: Input: default@tbl_protectmode_tbl8
+POSTHOOK: Output: default@tbl_protectmode_tbl8
+PREHOOK: query: alter table tbl_protectmode_tbl8 drop partition (p='p1')
+PREHOOK: type: ALTERTABLE_DROPPARTS
+PREHOOK: Input: default@tbl_protectmode_tbl8
+PREHOOK: Output: default@tbl_protectmode_tbl8@p=p1
+POSTHOOK: query: alter table tbl_protectmode_tbl8 drop partition (p='p1')
+POSTHOOK: type: ALTERTABLE_DROPPARTS
+POSTHOOK: Input: default@tbl_protectmode_tbl8
+POSTHOOK: Output: default@tbl_protectmode_tbl8@p=p1
+PREHOOK: query: alter table tbl_protectmode_tbl8 enable no_drop cascade
+PREHOOK: type: ALTERTABLE_PROTECTMODE
+PREHOOK: Input: default@tbl_protectmode_tbl8
+PREHOOK: Output: default@tbl_protectmode_tbl8
+POSTHOOK: query: alter table tbl_protectmode_tbl8 enable no_drop cascade
+POSTHOOK: type: ALTERTABLE_PROTECTMODE
+POSTHOOK: Input: default@tbl_protectmode_tbl8
+POSTHOOK: Output: default@tbl_protectmode_tbl8
+PREHOOK: query: alter table tbl_protectmode_tbl8 add partition (p='p1')
+PREHOOK: type: ALTERTABLE_ADDPARTS
+PREHOOK: Input: default@tbl_protectmode_tbl8
+POSTHOOK: query: alter table tbl_protectmode_tbl8 add partition (p='p1')
+POSTHOOK: type: ALTERTABLE_ADDPARTS
+POSTHOOK: Input: default@tbl_protectmode_tbl8
+POSTHOOK: Output: default@tbl_protectmode_tbl8@p=p1
+PREHOOK: query: alter table tbl_protectmode_tbl8 drop partition (p='p1')
+PREHOOK: type: ALTERTABLE_DROPPARTS
+PREHOOK: Input: default@tbl_protectmode_tbl8
+PREHOOK: Output: default@tbl_protectmode_tbl8@p=p1
+FAILED: Error in metadata: Table tbl_protectmode_tbl8 Partition p=p1 is protected from being
dropped
+FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask

Added: hive/trunk/ql/src/test/results/clientpositive/protectmode2.q.out
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/clientpositive/protectmode2.q.out?rev=1207701&view=auto
==============================================================================
--- hive/trunk/ql/src/test/results/clientpositive/protectmode2.q.out (added)
+++ hive/trunk/ql/src/test/results/clientpositive/protectmode2.q.out Mon Nov 28 23:42:01 2011
@@ -0,0 +1,132 @@
+PREHOOK: query: drop table tbl1
+PREHOOK: type: DROPTABLE
+POSTHOOK: query: drop table tbl1
+POSTHOOK: type: DROPTABLE
+PREHOOK: query: create table tbl1 (col string)
+PREHOOK: type: CREATETABLE
+POSTHOOK: query: create table tbl1 (col string)
+POSTHOOK: type: CREATETABLE
+POSTHOOK: Output: default@tbl1
+PREHOOK: query: alter table tbl1 enable no_drop cascade
+PREHOOK: type: ALTERTABLE_PROTECTMODE
+PREHOOK: Input: default@tbl1
+PREHOOK: Output: default@tbl1
+POSTHOOK: query: alter table tbl1 enable no_drop cascade
+POSTHOOK: type: ALTERTABLE_PROTECTMODE
+POSTHOOK: Input: default@tbl1
+POSTHOOK: Output: default@tbl1
+PREHOOK: query: desc extended tbl1
+PREHOOK: type: DESCTABLE
+POSTHOOK: query: desc extended tbl1
+POSTHOOK: type: DESCTABLE
+col	string	
+	 	 
+Detailed Table Information	Table(tableName:tbl1, dbName:default, owner:njain, createTime:1322077526,
lastAccessTime:0, retention:0, sd:StorageDescriptor(cols:[FieldSchema(name:col, type:string,
comment:null)], location:pfile:/data/users/njain/hive1/build/ql/test/data/warehouse/tbl1,
inputFormat:org.apache.hadoop.mapred.TextInputFormat, outputFormat:org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat,
compressed:false, numBuckets:-1, serdeInfo:SerDeInfo(name:null, serializationLib:org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe,
parameters:{serialization.format=1}), bucketCols:[], sortCols:[], parameters:{}), partitionKeys:[],
parameters:{last_modified_by=njain, last_modified_time=1322077527, PROTECT_MODE=NO_DROP_CASCADE,
transient_lastDdlTime=1322077527}, viewOriginalText:null, viewExpandedText:null, tableType:MANAGED_TABLE)

+PREHOOK: query: alter table tbl1 enable no_drop
+PREHOOK: type: ALTERTABLE_PROTECTMODE
+PREHOOK: Input: default@tbl1
+PREHOOK: Output: default@tbl1
+POSTHOOK: query: alter table tbl1 enable no_drop
+POSTHOOK: type: ALTERTABLE_PROTECTMODE
+POSTHOOK: Input: default@tbl1
+POSTHOOK: Output: default@tbl1
+PREHOOK: query: desc extended tbl1
+PREHOOK: type: DESCTABLE
+POSTHOOK: query: desc extended tbl1
+POSTHOOK: type: DESCTABLE
+col	string	
+	 	 
+Detailed Table Information	Table(tableName:tbl1, dbName:default, owner:njain, createTime:1322077526,
lastAccessTime:0, retention:0, sd:StorageDescriptor(cols:[FieldSchema(name:col, type:string,
comment:null)], location:pfile:/data/users/njain/hive1/build/ql/test/data/warehouse/tbl1,
inputFormat:org.apache.hadoop.mapred.TextInputFormat, outputFormat:org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat,
compressed:false, numBuckets:-1, serdeInfo:SerDeInfo(name:null, serializationLib:org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe,
parameters:{serialization.format=1}), bucketCols:[], sortCols:[], parameters:{}), partitionKeys:[],
parameters:{last_modified_by=njain, last_modified_time=1322077527, PROTECT_MODE=NO_DROP,NO_DROP_CASCADE,
transient_lastDdlTime=1322077527}, viewOriginalText:null, viewExpandedText:null, tableType:MANAGED_TABLE)

+PREHOOK: query: alter table tbl1 disable no_drop cascade
+PREHOOK: type: ALTERTABLE_PROTECTMODE
+PREHOOK: Input: default@tbl1
+PREHOOK: Output: default@tbl1
+POSTHOOK: query: alter table tbl1 disable no_drop cascade
+POSTHOOK: type: ALTERTABLE_PROTECTMODE
+POSTHOOK: Input: default@tbl1
+POSTHOOK: Output: default@tbl1
+PREHOOK: query: desc extended tbl1
+PREHOOK: type: DESCTABLE
+POSTHOOK: query: desc extended tbl1
+POSTHOOK: type: DESCTABLE
+col	string	
+	 	 
+Detailed Table Information	Table(tableName:tbl1, dbName:default, owner:njain, createTime:1322077526,
lastAccessTime:0, retention:0, sd:StorageDescriptor(cols:[FieldSchema(name:col, type:string,
comment:null)], location:pfile:/data/users/njain/hive1/build/ql/test/data/warehouse/tbl1,
inputFormat:org.apache.hadoop.mapred.TextInputFormat, outputFormat:org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat,
compressed:false, numBuckets:-1, serdeInfo:SerDeInfo(name:null, serializationLib:org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe,
parameters:{serialization.format=1}), bucketCols:[], sortCols:[], parameters:{}), partitionKeys:[],
parameters:{last_modified_by=njain, last_modified_time=1322077527, PROTECT_MODE=NO_DROP, transient_lastDdlTime=1322077527},
viewOriginalText:null, viewExpandedText:null, tableType:MANAGED_TABLE)	
+PREHOOK: query: alter table tbl1 disable no_drop
+PREHOOK: type: ALTERTABLE_PROTECTMODE
+PREHOOK: Input: default@tbl1
+PREHOOK: Output: default@tbl1
+POSTHOOK: query: alter table tbl1 disable no_drop
+POSTHOOK: type: ALTERTABLE_PROTECTMODE
+POSTHOOK: Input: default@tbl1
+POSTHOOK: Output: default@tbl1
+PREHOOK: query: drop table tbl1
+PREHOOK: type: DROPTABLE
+PREHOOK: Input: default@tbl1
+PREHOOK: Output: default@tbl1
+POSTHOOK: query: drop table tbl1
+POSTHOOK: type: DROPTABLE
+POSTHOOK: Input: default@tbl1
+POSTHOOK: Output: default@tbl1
+PREHOOK: query: drop table tbl2
+PREHOOK: type: DROPTABLE
+POSTHOOK: query: drop table tbl2
+POSTHOOK: type: DROPTABLE
+PREHOOK: query: create table tbl2 (col string) partitioned by (p string)
+PREHOOK: type: CREATETABLE
+POSTHOOK: query: create table tbl2 (col string) partitioned by (p string)
+POSTHOOK: type: CREATETABLE
+POSTHOOK: Output: default@tbl2
+PREHOOK: query: alter table tbl2 add partition (p='p1')
+PREHOOK: type: ALTERTABLE_ADDPARTS
+PREHOOK: Input: default@tbl2
+POSTHOOK: query: alter table tbl2 add partition (p='p1')
+POSTHOOK: type: ALTERTABLE_ADDPARTS
+POSTHOOK: Input: default@tbl2
+POSTHOOK: Output: default@tbl2@p=p1
+PREHOOK: query: alter table tbl2 add partition (p='p2')
+PREHOOK: type: ALTERTABLE_ADDPARTS
+PREHOOK: Input: default@tbl2
+POSTHOOK: query: alter table tbl2 add partition (p='p2')
+POSTHOOK: type: ALTERTABLE_ADDPARTS
+POSTHOOK: Input: default@tbl2
+POSTHOOK: Output: default@tbl2@p=p2
+PREHOOK: query: alter table tbl2 add partition (p='p3')
+PREHOOK: type: ALTERTABLE_ADDPARTS
+PREHOOK: Input: default@tbl2
+POSTHOOK: query: alter table tbl2 add partition (p='p3')
+POSTHOOK: type: ALTERTABLE_ADDPARTS
+POSTHOOK: Input: default@tbl2
+POSTHOOK: Output: default@tbl2@p=p3
+PREHOOK: query: alter table tbl2 enable no_drop cascade
+PREHOOK: type: ALTERTABLE_PROTECTMODE
+PREHOOK: Input: default@tbl2
+PREHOOK: Output: default@tbl2
+POSTHOOK: query: alter table tbl2 enable no_drop cascade
+POSTHOOK: type: ALTERTABLE_PROTECTMODE
+POSTHOOK: Input: default@tbl2
+POSTHOOK: Output: default@tbl2
+PREHOOK: query: desc extended tbl2
+PREHOOK: type: DESCTABLE
+POSTHOOK: query: desc extended tbl2
+POSTHOOK: type: DESCTABLE
+col	string	
+p	string	
+	 	 
+Detailed Table Information	Table(tableName:tbl2, dbName:default, owner:njain, createTime:1322077528,
lastAccessTime:0, retention:0, sd:StorageDescriptor(cols:[FieldSchema(name:col, type:string,
comment:null), FieldSchema(name:p, type:string, comment:null)], location:pfile:/data/users/njain/hive1/build/ql/test/data/warehouse/tbl2,
inputFormat:org.apache.hadoop.mapred.TextInputFormat, outputFormat:org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat,
compressed:false, numBuckets:-1, serdeInfo:SerDeInfo(name:null, serializationLib:org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe,
parameters:{serialization.format=1}), bucketCols:[], sortCols:[], parameters:{}), partitionKeys:[FieldSchema(name:p,
type:string, comment:null)], parameters:{last_modified_by=njain, last_modified_time=1322077529,
PROTECT_MODE=NO_DROP_CASCADE, transient_lastDdlTime=1322077529}, viewOriginalText:null, viewExpandedText:null,
tableType:MANAGED_TABLE)	
+PREHOOK: query: alter table tbl2 disable no_drop cascade
+PREHOOK: type: ALTERTABLE_PROTECTMODE
+PREHOOK: Input: default@tbl2
+PREHOOK: Output: default@tbl2
+POSTHOOK: query: alter table tbl2 disable no_drop cascade
+POSTHOOK: type: ALTERTABLE_PROTECTMODE
+POSTHOOK: Input: default@tbl2
+POSTHOOK: Output: default@tbl2
+PREHOOK: query: drop table tbl2
+PREHOOK: type: DROPTABLE
+PREHOOK: Input: default@tbl2
+PREHOOK: Output: default@tbl2
+POSTHOOK: query: drop table tbl2
+POSTHOOK: type: DROPTABLE
+POSTHOOK: Input: default@tbl2
+POSTHOOK: Output: default@tbl2



Mime
View raw message