[ 
https://issues.apache.org/jira/browse/HIVE-16024?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15888596#comment-15888596
 ] 

Sahil Takiar commented on HIVE-16024:
-------------------------------------

We could do something similar to what the {{DDLTask.dropTable}} method does?

{code}
    int partitionBatchSize = HiveConf.getIntVar(conf,
        ConfVars.METASTORE_BATCH_RETRIEVE_TABLE_PARTITION_MAX);

    // We should check that all the partitions of the table can be dropped
    if (tbl != null && tbl.isPartitioned()) {
      List<String> partitionNames = db.getPartitionNames(tbl.getDbName(), 
tbl.getTableName(), (short)-1);

      for(int i=0; i < partitionNames.size(); i+= partitionBatchSize) {
        List<String> partNames = partitionNames.subList(i, 
Math.min(i+partitionBatchSize,
            partitionNames.size()));
        List<Partition> listPartitions = db.getPartitionsByNames(tbl, 
partNames);
        for (Partition p: listPartitions) {
          if (!p.canDrop()) {
            throw new HiveException("Table " + tbl.getTableName() +
                " Partition" + p.getName() +
                " is protected from being dropped");
          }
        }
      }
    }
{code}

> MSCK Repair Requires nonstrict hive.mapred.mode
> -----------------------------------------------
>
>                 Key: HIVE-16024
>                 URL: https://issues.apache.org/jira/browse/HIVE-16024
>             Project: Hive
>          Issue Type: Bug
>          Components: Metastore
>    Affects Versions: 2.2.0
>            Reporter: Barna Zsombor Klara
>            Assignee: Barna Zsombor Klara
>         Attachments: HIVE-16024.01.patch, HIVE-16024.02.patch
>
>
> MSCK repair fails when hive.mapred.mode is set to strict
> HIVE-13788 modified the way we read up partitions for a table to improve 
> performance. Unfortunately it is using PartitionPruner to load the partitions 
> which in turn is checking hive.mapred.mode.
> The previous code did not check hive.mapred.mode.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to