Return-Path: X-Original-To: apmail-hive-dev-archive@www.apache.org Delivered-To: apmail-hive-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A7E7817816 for ; Fri, 17 Apr 2015 18:33:59 +0000 (UTC) Received: (qmail 84063 invoked by uid 500); 17 Apr 2015 18:33:59 -0000 Delivered-To: apmail-hive-dev-archive@hive.apache.org Received: (qmail 83993 invoked by uid 500); 17 Apr 2015 18:33:59 -0000 Mailing-List: contact dev-help@hive.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hive.apache.org Delivered-To: mailing list dev@hive.apache.org Received: (qmail 83818 invoked by uid 99); 17 Apr 2015 18:33:59 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 17 Apr 2015 18:33:59 +0000 Date: Fri, 17 Apr 2015 18:33:59 +0000 (UTC) From: "Sushanth Sowmyan (JIRA)" To: dev@hive.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Created] (HIVE-10381) Allow pushing of property-key-value based predicate filter to Metastore dropPartitions MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 Sushanth Sowmyan created HIVE-10381: --------------------------------------- Summary: Allow pushing of property-key-value based predicate filter to Metastore dropPartitions Key: HIVE-10381 URL: https://issues.apache.org/jira/browse/HIVE-10381 Project: Hive Issue Type: Sub-task Reporter: Sushanth Sowmyan After HIVE-10228, we now have a case wherein we assume, based on our knowledge of how replication will work, that DROP_PARTITION replication will act on a per-partition level. In order to be robust, however, we do handle the case where this might not be the case, wherein the DROP_PARTITION replication command generated would work across multiple partitions, it's just that that handling is very inefficient if ever used, since it has to fetch each of those partitions from the metastore, decide whether or not it matches the ReplicationSpec.allowEventReplacementInto filter, and then drop it. Ideally, we should allow pushing this filter to the metastore, and let the metastore do a smart drop based on that. {code} ReplicationSpec replicationSpec = dropTbl.getReplicationSpec(); if (replicationSpec.isInReplicationScope()){ // TODO: Current implementation of replication will result in DROP_PARTITION under replication // scope being called per-partition instead of multiple partitions. However, to be robust, we // must still handle the case of multiple partitions in case this assumption changes in the // future. However, if this assumption changes, we will not be very performant if we fetch // each partition one-by-one, and then decide on inspection whether or not this is a candidate // for dropping. Thus, we need a way to push this filter (replicationSpec.allowEventReplacementInto) // to the metastore to allow it to do drop a partition or not, depending on a Predicate on the // parameter key values. for (DropTableDesc.PartSpec partSpec : dropTbl.getPartSpecs()){ try { for (Partition p : Iterables.filter( db.getPartitionsByFilter(tbl, partSpec.getPartSpec().getExprString()), replicationSpec.allowEventReplacementInto())){ db.dropPartition(tbl.getDbName(),tbl.getTableName(),p.getValues(),true); } } catch (NoSuchObjectException e){ // ignore NSOE because that means there's nothing to drop. } catch (Exception e) { throw new HiveException(e.getMessage(), e); } } return; } {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)