Skip to content

Commit

Permalink
HIVE-11145 Remove OFFLINE and NO_DROP from tables and partitions (gat…
Browse files Browse the repository at this point in the history
…es, reviewed by Ashutosh Chauhan)
  • Loading branch information
Alan Gates committed Jul 16, 2015
1 parent 7338d8e commit d6ec52e
Show file tree
Hide file tree
Showing 320 changed files with 150 additions and 2,473 deletions.
Expand Up @@ -52,7 +52,6 @@ boolean_col boolean from deserializer
# Detailed Table Information
Database: default
#### A masked pattern was here ####
Protect Mode: None
Retention: 0
#### A masked pattern was here ####
Table Type: MANAGED_TABLE
Expand Down
Expand Up @@ -52,7 +52,6 @@ boolean_col boolean from deserializer
# Detailed Table Information
Database: default
#### A masked pattern was here ####
Protect Mode: None
Retention: 0
#### A masked pattern was here ####
Table Type: MANAGED_TABLE
Expand Down Expand Up @@ -228,7 +227,6 @@ boolean_col boolean from deserializer
# Detailed Table Information
Database: default
#### A masked pattern was here ####
Protect Mode: None
Retention: 0
#### A masked pattern was here ####
Table Type: EXTERNAL_TABLE
Expand Down
7 changes: 0 additions & 7 deletions hbase-handler/src/test/results/positive/hbase_stats.q.out
Expand Up @@ -38,7 +38,6 @@ value string default
# Detailed Table Information
Database: default
#### A masked pattern was here ####
Protect Mode: None
Retention: 0
#### A masked pattern was here ####
Table Type: MANAGED_TABLE
Expand Down Expand Up @@ -142,7 +141,6 @@ hr string
# Detailed Table Information
Database: default
#### A masked pattern was here ####
Protect Mode: None
Retention: 0
#### A masked pattern was here ####
Table Type: MANAGED_TABLE
Expand Down Expand Up @@ -181,8 +179,6 @@ Partition Value: [2010-04-08, 11]
Database: default
Table: stats_part
#### A masked pattern was here ####
Protect Mode: None
#### A masked pattern was here ####
Partition Parameters:
COLUMN_STATS_ACCURATE true
numFiles 1
Expand Down Expand Up @@ -223,8 +219,6 @@ Partition Value: [2010-04-08, 12]
Database: default
Table: stats_part
#### A masked pattern was here ####
Protect Mode: None
#### A masked pattern was here ####
Partition Parameters:
COLUMN_STATS_ACCURATE true
numFiles 1
Expand Down Expand Up @@ -283,7 +277,6 @@ hr string
# Detailed Table Information
Database: default
#### A masked pattern was here ####
Protect Mode: None
Retention: 0
#### A masked pattern was here ####
Table Type: MANAGED_TABLE
Expand Down
7 changes: 0 additions & 7 deletions hbase-handler/src/test/results/positive/hbase_stats2.q.out
Expand Up @@ -38,7 +38,6 @@ value string default
# Detailed Table Information
Database: default
#### A masked pattern was here ####
Protect Mode: None
Retention: 0
#### A masked pattern was here ####
Table Type: MANAGED_TABLE
Expand Down Expand Up @@ -142,7 +141,6 @@ hr string
# Detailed Table Information
Database: default
#### A masked pattern was here ####
Protect Mode: None
Retention: 0
#### A masked pattern was here ####
Table Type: MANAGED_TABLE
Expand Down Expand Up @@ -181,8 +179,6 @@ Partition Value: [2010-04-08, 11]
Database: default
Table: stats_part
#### A masked pattern was here ####
Protect Mode: None
#### A masked pattern was here ####
Partition Parameters:
COLUMN_STATS_ACCURATE true
numFiles 1
Expand Down Expand Up @@ -223,8 +219,6 @@ Partition Value: [2010-04-08, 12]
Database: default
Table: stats_part
#### A masked pattern was here ####
Protect Mode: None
#### A masked pattern was here ####
Partition Parameters:
COLUMN_STATS_ACCURATE true
numFiles 1
Expand Down Expand Up @@ -283,7 +277,6 @@ hr string
# Detailed Table Information
Database: default
#### A masked pattern was here ####
Protect Mode: None
Retention: 0
#### A masked pattern was here ####
Table Type: MANAGED_TABLE
Expand Down
12 changes: 0 additions & 12 deletions hbase-handler/src/test/results/positive/hbase_stats3.q.out
Expand Up @@ -40,8 +40,6 @@ Partition Value: [2010-04-08, 13]
Database: default
Table: stats_part
#### A masked pattern was here ####
Protect Mode: None
#### A masked pattern was here ####
Partition Parameters:
COLUMN_STATS_ACCURATE true
numFiles 1
Expand Down Expand Up @@ -94,8 +92,6 @@ Partition Value: [2010-04-08, 13]
Database: default
Table: stats_part
#### A masked pattern was here ####
Protect Mode: None
#### A masked pattern was here ####
Partition Parameters:
COLUMN_STATS_ACCURATE true
numFiles 1
Expand Down Expand Up @@ -148,8 +144,6 @@ Partition Value: [2010-04-08, 13]
Database: default
Table: stats_part
#### A masked pattern was here ####
Protect Mode: None
#### A masked pattern was here ####
Partition Parameters:
COLUMN_STATS_ACCURATE true
numFiles 1
Expand Down Expand Up @@ -206,8 +200,6 @@ Partition Value: [2010-04-08, 13]
Database: default
Table: stats_part
#### A masked pattern was here ####
Protect Mode: None
#### A masked pattern was here ####
Partition Parameters:
COLUMN_STATS_ACCURATE true
numFiles 1
Expand Down Expand Up @@ -260,8 +252,6 @@ Partition Value: [2010-04-08, 13]
Database: default
Table: stats_part
#### A masked pattern was here ####
Protect Mode: None
#### A masked pattern was here ####
Partition Parameters:
COLUMN_STATS_ACCURATE true
numFiles 1
Expand Down Expand Up @@ -314,8 +304,6 @@ Partition Value: [2010-04-08, 13]
Database: default
Table: stats_part
#### A masked pattern was here ####
Protect Mode: None
#### A masked pattern was here ####
Partition Parameters:
COLUMN_STATS_ACCURATE true
numFiles 1
Expand Down
Expand Up @@ -43,8 +43,6 @@ Partition Value: [1]
Database: default
Table: tmptable
#### A masked pattern was here ####
Protect Mode: None
#### A masked pattern was here ####
Partition Parameters:
COLUMN_STATS_ACCURATE true
numFiles 1
Expand Down
Expand Up @@ -18,9 +18,6 @@
*/
package org.apache.hive.hcatalog.cli.SemanticAnalysis;

import java.io.Serializable;
import java.util.List;

import org.apache.hadoop.hive.metastore.api.Database;
import org.apache.hadoop.hive.ql.exec.Task;
import org.apache.hadoop.hive.ql.exec.Utilities;
Expand Down Expand Up @@ -50,6 +47,9 @@
import org.apache.hive.hcatalog.common.ErrorType;
import org.apache.hive.hcatalog.common.HCatException;

import java.io.Serializable;
import java.util.List;

public class HCatSemanticAnalyzer extends HCatSemanticAnalyzerBase {

private AbstractSemanticAnalyzerHook hook;
Expand Down Expand Up @@ -237,7 +237,6 @@ public void postAnalyze(HiveSemanticAnalyzerHookContext context,
case HiveParser.TOK_ALTERTABLE_EXCHANGEPARTITION:
case HiveParser.TOK_ALTERTABLE_SKEWED:
case HiveParser.TOK_ALTERTABLE_FILEFORMAT:
case HiveParser.TOK_ALTERTABLE_PROTECTMODE:
case HiveParser.TOK_ALTERTABLE_LOCATION:
case HiveParser.TOK_ALTERTABLE_MERGEFILES:
case HiveParser.TOK_ALTERTABLE_RENAMEPART:
Expand Down
Expand Up @@ -18,13 +18,6 @@
*/
package org.apache.hive.hcatalog.api;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import com.google.common.base.Function;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
Expand Down Expand Up @@ -76,6 +69,12 @@
import org.slf4j.LoggerFactory;

import javax.annotation.Nullable;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

/**
* The HCatClientHMSImpl is the Hive Metastore client based implementation of
Expand Down Expand Up @@ -588,7 +587,6 @@ private void dropPartitionsUsingExpressions(Table table, Map<String, String> par
Utilities.serializeExpressionToKryo(partitionExpression));
hmsClient.dropPartitions(table.getDbName(), table.getTableName(), Arrays.asList(serializedPartitionExpression),
deleteData && !isExternal(table), // Delete data?
false, // Ignore Protection?
ifExists, // Fail if table doesn't exist?
false); // Need results back?
}
Expand Down
Expand Up @@ -230,7 +230,9 @@
import java.util.regex.Pattern;

import static org.apache.commons.lang.StringUtils.join;
import static org.apache.hadoop.hive.metastore.MetaStoreUtils.*;
import static org.apache.hadoop.hive.metastore.MetaStoreUtils.DEFAULT_DATABASE_COMMENT;
import static org.apache.hadoop.hive.metastore.MetaStoreUtils.DEFAULT_DATABASE_NAME;
import static org.apache.hadoop.hive.metastore.MetaStoreUtils.validateName;

/**
* TODO:pc remove application logic to a separate interface.
Expand Down Expand Up @@ -2774,10 +2776,9 @@ public DropPartitionsResult drop_partitions_req(
}

for (Partition part : parts) {
if (!ignoreProtection && !MetaStoreUtils.canDropPartition(tbl, part)) {
throw new MetaException("Table " + tbl.getTableName()
+ " Partition " + part + " is protected from being dropped");
}

// TODO - we need to speed this up for the normal path where all partitions are under
// the table and we don't have to stat every partition

firePreEvent(new PreDropPartitionEvent(tbl, part, deleteData, this));
if (colNames != null) {
Expand Down
Expand Up @@ -842,7 +842,6 @@ public List<Partition> dropPartitions(String dbName, String tblName,
rps.setExprs(exprs);
DropPartitionsRequest req = new DropPartitionsRequest(dbName, tblName, rps);
req.setDeleteData(options.deleteData);
req.setIgnoreProtection(options.ignoreProtection);
req.setNeedResult(options.returnResults);
req.setIfExists(options.ifExists);
if (options.purgeData) {
Expand All @@ -854,27 +853,25 @@ public List<Partition> dropPartitions(String dbName, String tblName,

@Override
public List<Partition> dropPartitions(String dbName, String tblName,
List<ObjectPair<Integer, byte[]>> partExprs, boolean deleteData, boolean ignoreProtection,
List<ObjectPair<Integer, byte[]>> partExprs, boolean deleteData,
boolean ifExists, boolean needResult) throws NoSuchObjectException, MetaException, TException {

return dropPartitions(dbName, tblName, partExprs,
PartitionDropOptions.instance()
.deleteData(deleteData)
.ignoreProtection(ignoreProtection)
.ifExists(ifExists)
.returnResults(needResult));

}

@Override
public List<Partition> dropPartitions(String dbName, String tblName,
List<ObjectPair<Integer, byte[]>> partExprs, boolean deleteData, boolean ignoreProtection,
List<ObjectPair<Integer, byte[]>> partExprs, boolean deleteData,
boolean ifExists) throws NoSuchObjectException, MetaException, TException {
// By default, we need the results from dropPartitions();
return dropPartitions(dbName, tblName, partExprs,
PartitionDropOptions.instance()
.deleteData(deleteData)
.ignoreProtection(ignoreProtection)
.ifExists(ifExists));
}

Expand Down

0 comments on commit d6ec52e

Please sign in to comment.