You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by am...@apache.org on 2015/12/22 05:36:08 UTC

[1/3] hive git commit: HIVE-11487 : Adds getNumPartitionsByFilter api in metastore api

Repository: hive
Updated Branches:
  refs/heads/master a60fec2eb -> cdcc35e61


http://git-wip-us.apache.org/repos/asf/hive/blob/cdcc35e6/metastore/src/gen/thrift/gen-php/metastore/ThriftHiveMetastore.php
----------------------------------------------------------------------
diff --git a/metastore/src/gen/thrift/gen-php/metastore/ThriftHiveMetastore.php b/metastore/src/gen/thrift/gen-php/metastore/ThriftHiveMetastore.php
index 75f4a47..d0289fe 100644
--- a/metastore/src/gen/thrift/gen-php/metastore/ThriftHiveMetastore.php
+++ b/metastore/src/gen/thrift/gen-php/metastore/ThriftHiveMetastore.php
@@ -533,6 +533,15 @@ interface ThriftHiveMetastoreIf extends \FacebookServiceIf {
   /**
    * @param string $db_name
    * @param string $tbl_name
+   * @param string $filter
+   * @return int
+   * @throws \metastore\MetaException
+   * @throws \metastore\NoSuchObjectException
+   */
+  public function get_num_partitions_by_filter($db_name, $tbl_name, $filter);
+  /**
+   * @param string $db_name
+   * @param string $tbl_name
    * @param string[] $names
    * @return \metastore\Partition[]
    * @throws \metastore\MetaException
@@ -4485,6 +4494,65 @@ class ThriftHiveMetastoreClient extends \FacebookServiceClient implements \metas
     throw new \Exception("get_partitions_by_expr failed: unknown result");
   }
 
+  public function get_num_partitions_by_filter($db_name, $tbl_name, $filter)
+  {
+    $this->send_get_num_partitions_by_filter($db_name, $tbl_name, $filter);
+    return $this->recv_get_num_partitions_by_filter();
+  }
+
+  public function send_get_num_partitions_by_filter($db_name, $tbl_name, $filter)
+  {
+    $args = new \metastore\ThriftHiveMetastore_get_num_partitions_by_filter_args();
+    $args->db_name = $db_name;
+    $args->tbl_name = $tbl_name;
+    $args->filter = $filter;
+    $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');
+    if ($bin_accel)
+    {
+      thrift_protocol_write_binary($this->output_, 'get_num_partitions_by_filter', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());
+    }
+    else
+    {
+      $this->output_->writeMessageBegin('get_num_partitions_by_filter', TMessageType::CALL, $this->seqid_);
+      $args->write($this->output_);
+      $this->output_->writeMessageEnd();
+      $this->output_->getTransport()->flush();
+    }
+  }
+
+  public function recv_get_num_partitions_by_filter()
+  {
+    $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary');
+    if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\metastore\ThriftHiveMetastore_get_num_partitions_by_filter_result', $this->input_->isStrictRead());
+    else
+    {
+      $rseqid = 0;
+      $fname = null;
+      $mtype = 0;
+
+      $this->input_->readMessageBegin($fname, $mtype, $rseqid);
+      if ($mtype == TMessageType::EXCEPTION) {
+        $x = new TApplicationException();
+        $x->read($this->input_);
+        $this->input_->readMessageEnd();
+        throw $x;
+      }
+      $result = new \metastore\ThriftHiveMetastore_get_num_partitions_by_filter_result();
+      $result->read($this->input_);
+      $this->input_->readMessageEnd();
+    }
+    if ($result->success !== null) {
+      return $result->success;
+    }
+    if ($result->o1 !== null) {
+      throw $result->o1;
+    }
+    if ($result->o2 !== null) {
+      throw $result->o2;
+    }
+    throw new \Exception("get_num_partitions_by_filter failed: unknown result");
+  }
+
   public function get_partitions_by_names($db_name, $tbl_name, array $names)
   {
     $this->send_get_partitions_by_names($db_name, $tbl_name, $names);
@@ -23936,6 +24004,252 @@ class ThriftHiveMetastore_get_partitions_by_expr_result {
 
 }
 
+class ThriftHiveMetastore_get_num_partitions_by_filter_args {
+  static $_TSPEC;
+
+  /**
+   * @var string
+   */
+  public $db_name = null;
+  /**
+   * @var string
+   */
+  public $tbl_name = null;
+  /**
+   * @var string
+   */
+  public $filter = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        1 => array(
+          'var' => 'db_name',
+          'type' => TType::STRING,
+          ),
+        2 => array(
+          'var' => 'tbl_name',
+          'type' => TType::STRING,
+          ),
+        3 => array(
+          'var' => 'filter',
+          'type' => TType::STRING,
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['db_name'])) {
+        $this->db_name = $vals['db_name'];
+      }
+      if (isset($vals['tbl_name'])) {
+        $this->tbl_name = $vals['tbl_name'];
+      }
+      if (isset($vals['filter'])) {
+        $this->filter = $vals['filter'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'ThriftHiveMetastore_get_num_partitions_by_filter_args';
+  }
+
+  public function read($input)
+  {
+    $xfer = 0;
+    $fname = null;
+    $ftype = 0;
+    $fid = 0;
+    $xfer += $input->readStructBegin($fname);
+    while (true)
+    {
+      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
+      if ($ftype == TType::STOP) {
+        break;
+      }
+      switch ($fid)
+      {
+        case 1:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->db_name);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 2:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->tbl_name);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 3:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->filter);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        default:
+          $xfer += $input->skip($ftype);
+          break;
+      }
+      $xfer += $input->readFieldEnd();
+    }
+    $xfer += $input->readStructEnd();
+    return $xfer;
+  }
+
+  public function write($output) {
+    $xfer = 0;
+    $xfer += $output->writeStructBegin('ThriftHiveMetastore_get_num_partitions_by_filter_args');
+    if ($this->db_name !== null) {
+      $xfer += $output->writeFieldBegin('db_name', TType::STRING, 1);
+      $xfer += $output->writeString($this->db_name);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->tbl_name !== null) {
+      $xfer += $output->writeFieldBegin('tbl_name', TType::STRING, 2);
+      $xfer += $output->writeString($this->tbl_name);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->filter !== null) {
+      $xfer += $output->writeFieldBegin('filter', TType::STRING, 3);
+      $xfer += $output->writeString($this->filter);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
+class ThriftHiveMetastore_get_num_partitions_by_filter_result {
+  static $_TSPEC;
+
+  /**
+   * @var int
+   */
+  public $success = null;
+  /**
+   * @var \metastore\MetaException
+   */
+  public $o1 = null;
+  /**
+   * @var \metastore\NoSuchObjectException
+   */
+  public $o2 = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        0 => array(
+          'var' => 'success',
+          'type' => TType::I32,
+          ),
+        1 => array(
+          'var' => 'o1',
+          'type' => TType::STRUCT,
+          'class' => '\metastore\MetaException',
+          ),
+        2 => array(
+          'var' => 'o2',
+          'type' => TType::STRUCT,
+          'class' => '\metastore\NoSuchObjectException',
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['success'])) {
+        $this->success = $vals['success'];
+      }
+      if (isset($vals['o1'])) {
+        $this->o1 = $vals['o1'];
+      }
+      if (isset($vals['o2'])) {
+        $this->o2 = $vals['o2'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'ThriftHiveMetastore_get_num_partitions_by_filter_result';
+  }
+
+  public function read($input)
+  {
+    $xfer = 0;
+    $fname = null;
+    $ftype = 0;
+    $fid = 0;
+    $xfer += $input->readStructBegin($fname);
+    while (true)
+    {
+      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
+      if ($ftype == TType::STOP) {
+        break;
+      }
+      switch ($fid)
+      {
+        case 0:
+          if ($ftype == TType::I32) {
+            $xfer += $input->readI32($this->success);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 1:
+          if ($ftype == TType::STRUCT) {
+            $this->o1 = new \metastore\MetaException();
+            $xfer += $this->o1->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 2:
+          if ($ftype == TType::STRUCT) {
+            $this->o2 = new \metastore\NoSuchObjectException();
+            $xfer += $this->o2->read($input);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        default:
+          $xfer += $input->skip($ftype);
+          break;
+      }
+      $xfer += $input->readFieldEnd();
+    }
+    $xfer += $input->readStructEnd();
+    return $xfer;
+  }
+
+  public function write($output) {
+    $xfer = 0;
+    $xfer += $output->writeStructBegin('ThriftHiveMetastore_get_num_partitions_by_filter_result');
+    if ($this->success !== null) {
+      $xfer += $output->writeFieldBegin('success', TType::I32, 0);
+      $xfer += $output->writeI32($this->success);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->o1 !== null) {
+      $xfer += $output->writeFieldBegin('o1', TType::STRUCT, 1);
+      $xfer += $this->o1->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->o2 !== null) {
+      $xfer += $output->writeFieldBegin('o2', TType::STRUCT, 2);
+      $xfer += $this->o2->write($output);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
 class ThriftHiveMetastore_get_partitions_by_names_args {
   static $_TSPEC;
 
@@ -39709,3 +40023,4 @@ class ThriftHiveMetastore_cache_file_metadata_result {
 
 }
 
+

http://git-wip-us.apache.org/repos/asf/hive/blob/cdcc35e6/metastore/src/gen/thrift/gen-py/hive_metastore/ThriftHiveMetastore-remote
----------------------------------------------------------------------
diff --git a/metastore/src/gen/thrift/gen-py/hive_metastore/ThriftHiveMetastore-remote b/metastore/src/gen/thrift/gen-py/hive_metastore/ThriftHiveMetastore-remote
index 9564ded..407f73c 100755
--- a/metastore/src/gen/thrift/gen-py/hive_metastore/ThriftHiveMetastore-remote
+++ b/metastore/src/gen/thrift/gen-py/hive_metastore/ThriftHiveMetastore-remote
@@ -82,6 +82,7 @@ if len(sys.argv) <= 1 or sys.argv[1] == '--help':
   print('   get_partitions_by_filter(string db_name, string tbl_name, string filter, i16 max_parts)')
   print('   get_part_specs_by_filter(string db_name, string tbl_name, string filter, i32 max_parts)')
   print('  PartitionsByExprResult get_partitions_by_expr(PartitionsByExprRequest req)')
+  print('  i32 get_num_partitions_by_filter(string db_name, string tbl_name, string filter)')
   print('   get_partitions_by_names(string db_name, string tbl_name,  names)')
   print('  void alter_partition(string db_name, string tbl_name, Partition new_part)')
   print('  void alter_partitions(string db_name, string tbl_name,  new_parts)')
@@ -573,6 +574,12 @@ elif cmd == 'get_partitions_by_expr':
     sys.exit(1)
   pp.pprint(client.get_partitions_by_expr(eval(args[0]),))
 
+elif cmd == 'get_num_partitions_by_filter':
+  if len(args) != 3:
+    print('get_num_partitions_by_filter requires 3 args')
+    sys.exit(1)
+  pp.pprint(client.get_num_partitions_by_filter(args[0],args[1],args[2],))
+
 elif cmd == 'get_partitions_by_names':
   if len(args) != 3:
     print('get_partitions_by_names requires 3 args')

http://git-wip-us.apache.org/repos/asf/hive/blob/cdcc35e6/metastore/src/gen/thrift/gen-py/hive_metastore/ThriftHiveMetastore.py
----------------------------------------------------------------------
diff --git a/metastore/src/gen/thrift/gen-py/hive_metastore/ThriftHiveMetastore.py b/metastore/src/gen/thrift/gen-py/hive_metastore/ThriftHiveMetastore.py
index 97acb5d..26d8a02 100644
--- a/metastore/src/gen/thrift/gen-py/hive_metastore/ThriftHiveMetastore.py
+++ b/metastore/src/gen/thrift/gen-py/hive_metastore/ThriftHiveMetastore.py
@@ -524,6 +524,15 @@ class Iface(fb303.FacebookService.Iface):
     """
     pass
 
+  def get_num_partitions_by_filter(self, db_name, tbl_name, filter):
+    """
+    Parameters:
+     - db_name
+     - tbl_name
+     - filter
+    """
+    pass
+
   def get_partitions_by_names(self, db_name, tbl_name, names):
     """
     Parameters:
@@ -3323,6 +3332,45 @@ class Client(fb303.FacebookService.Client, Iface):
       raise result.o2
     raise TApplicationException(TApplicationException.MISSING_RESULT, "get_partitions_by_expr failed: unknown result")
 
+  def get_num_partitions_by_filter(self, db_name, tbl_name, filter):
+    """
+    Parameters:
+     - db_name
+     - tbl_name
+     - filter
+    """
+    self.send_get_num_partitions_by_filter(db_name, tbl_name, filter)
+    return self.recv_get_num_partitions_by_filter()
+
+  def send_get_num_partitions_by_filter(self, db_name, tbl_name, filter):
+    self._oprot.writeMessageBegin('get_num_partitions_by_filter', TMessageType.CALL, self._seqid)
+    args = get_num_partitions_by_filter_args()
+    args.db_name = db_name
+    args.tbl_name = tbl_name
+    args.filter = filter
+    args.write(self._oprot)
+    self._oprot.writeMessageEnd()
+    self._oprot.trans.flush()
+
+  def recv_get_num_partitions_by_filter(self):
+    iprot = self._iprot
+    (fname, mtype, rseqid) = iprot.readMessageBegin()
+    if mtype == TMessageType.EXCEPTION:
+      x = TApplicationException()
+      x.read(iprot)
+      iprot.readMessageEnd()
+      raise x
+    result = get_num_partitions_by_filter_result()
+    result.read(iprot)
+    iprot.readMessageEnd()
+    if result.success is not None:
+      return result.success
+    if result.o1 is not None:
+      raise result.o1
+    if result.o2 is not None:
+      raise result.o2
+    raise TApplicationException(TApplicationException.MISSING_RESULT, "get_num_partitions_by_filter failed: unknown result")
+
   def get_partitions_by_names(self, db_name, tbl_name, names):
     """
     Parameters:
@@ -5973,6 +6021,7 @@ class Processor(fb303.FacebookService.Processor, Iface, TProcessor):
     self._processMap["get_partitions_by_filter"] = Processor.process_get_partitions_by_filter
     self._processMap["get_part_specs_by_filter"] = Processor.process_get_part_specs_by_filter
     self._processMap["get_partitions_by_expr"] = Processor.process_get_partitions_by_expr
+    self._processMap["get_num_partitions_by_filter"] = Processor.process_get_num_partitions_by_filter
     self._processMap["get_partitions_by_names"] = Processor.process_get_partitions_by_names
     self._processMap["alter_partition"] = Processor.process_alter_partition
     self._processMap["alter_partitions"] = Processor.process_alter_partitions
@@ -7564,6 +7613,31 @@ class Processor(fb303.FacebookService.Processor, Iface, TProcessor):
     oprot.writeMessageEnd()
     oprot.trans.flush()
 
+  def process_get_num_partitions_by_filter(self, seqid, iprot, oprot):
+    args = get_num_partitions_by_filter_args()
+    args.read(iprot)
+    iprot.readMessageEnd()
+    result = get_num_partitions_by_filter_result()
+    try:
+      result.success = self._handler.get_num_partitions_by_filter(args.db_name, args.tbl_name, args.filter)
+      msg_type = TMessageType.REPLY
+    except (TTransport.TTransportException, KeyboardInterrupt, SystemExit):
+      raise
+    except MetaException as o1:
+      msg_type = TMessageType.REPLY
+      result.o1 = o1
+    except NoSuchObjectException as o2:
+      msg_type = TMessageType.REPLY
+      result.o2 = o2
+    except Exception as ex:
+      msg_type = TMessageType.EXCEPTION
+      logging.exception(ex)
+      result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error')
+    oprot.writeMessageBegin("get_num_partitions_by_filter", msg_type, seqid)
+    result.write(oprot)
+    oprot.writeMessageEnd()
+    oprot.trans.flush()
+
   def process_get_partitions_by_names(self, seqid, iprot, oprot):
     args = get_partitions_by_names_args()
     args.read(iprot)
@@ -20186,6 +20260,189 @@ class get_partitions_by_expr_result:
   def __ne__(self, other):
     return not (self == other)
 
+class get_num_partitions_by_filter_args:
+  """
+  Attributes:
+   - db_name
+   - tbl_name
+   - filter
+  """
+
+  thrift_spec = (
+    None, # 0
+    (1, TType.STRING, 'db_name', None, None, ), # 1
+    (2, TType.STRING, 'tbl_name', None, None, ), # 2
+    (3, TType.STRING, 'filter', None, None, ), # 3
+  )
+
+  def __init__(self, db_name=None, tbl_name=None, filter=None,):
+    self.db_name = db_name
+    self.tbl_name = tbl_name
+    self.filter = filter
+
+  def read(self, iprot):
+    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
+      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
+      return
+    iprot.readStructBegin()
+    while True:
+      (fname, ftype, fid) = iprot.readFieldBegin()
+      if ftype == TType.STOP:
+        break
+      if fid == 1:
+        if ftype == TType.STRING:
+          self.db_name = iprot.readString()
+        else:
+          iprot.skip(ftype)
+      elif fid == 2:
+        if ftype == TType.STRING:
+          self.tbl_name = iprot.readString()
+        else:
+          iprot.skip(ftype)
+      elif fid == 3:
+        if ftype == TType.STRING:
+          self.filter = iprot.readString()
+        else:
+          iprot.skip(ftype)
+      else:
+        iprot.skip(ftype)
+      iprot.readFieldEnd()
+    iprot.readStructEnd()
+
+  def write(self, oprot):
+    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
+      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
+      return
+    oprot.writeStructBegin('get_num_partitions_by_filter_args')
+    if self.db_name is not None:
+      oprot.writeFieldBegin('db_name', TType.STRING, 1)
+      oprot.writeString(self.db_name)
+      oprot.writeFieldEnd()
+    if self.tbl_name is not None:
+      oprot.writeFieldBegin('tbl_name', TType.STRING, 2)
+      oprot.writeString(self.tbl_name)
+      oprot.writeFieldEnd()
+    if self.filter is not None:
+      oprot.writeFieldBegin('filter', TType.STRING, 3)
+      oprot.writeString(self.filter)
+      oprot.writeFieldEnd()
+    oprot.writeFieldStop()
+    oprot.writeStructEnd()
+
+  def validate(self):
+    return
+
+
+  def __hash__(self):
+    value = 17
+    value = (value * 31) ^ hash(self.db_name)
+    value = (value * 31) ^ hash(self.tbl_name)
+    value = (value * 31) ^ hash(self.filter)
+    return value
+
+  def __repr__(self):
+    L = ['%s=%r' % (key, value)
+      for key, value in self.__dict__.iteritems()]
+    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
+
+  def __eq__(self, other):
+    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
+
+  def __ne__(self, other):
+    return not (self == other)
+
+class get_num_partitions_by_filter_result:
+  """
+  Attributes:
+   - success
+   - o1
+   - o2
+  """
+
+  thrift_spec = (
+    (0, TType.I32, 'success', None, None, ), # 0
+    (1, TType.STRUCT, 'o1', (MetaException, MetaException.thrift_spec), None, ), # 1
+    (2, TType.STRUCT, 'o2', (NoSuchObjectException, NoSuchObjectException.thrift_spec), None, ), # 2
+  )
+
+  def __init__(self, success=None, o1=None, o2=None,):
+    self.success = success
+    self.o1 = o1
+    self.o2 = o2
+
+  def read(self, iprot):
+    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
+      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
+      return
+    iprot.readStructBegin()
+    while True:
+      (fname, ftype, fid) = iprot.readFieldBegin()
+      if ftype == TType.STOP:
+        break
+      if fid == 0:
+        if ftype == TType.I32:
+          self.success = iprot.readI32()
+        else:
+          iprot.skip(ftype)
+      elif fid == 1:
+        if ftype == TType.STRUCT:
+          self.o1 = MetaException()
+          self.o1.read(iprot)
+        else:
+          iprot.skip(ftype)
+      elif fid == 2:
+        if ftype == TType.STRUCT:
+          self.o2 = NoSuchObjectException()
+          self.o2.read(iprot)
+        else:
+          iprot.skip(ftype)
+      else:
+        iprot.skip(ftype)
+      iprot.readFieldEnd()
+    iprot.readStructEnd()
+
+  def write(self, oprot):
+    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
+      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
+      return
+    oprot.writeStructBegin('get_num_partitions_by_filter_result')
+    if self.success is not None:
+      oprot.writeFieldBegin('success', TType.I32, 0)
+      oprot.writeI32(self.success)
+      oprot.writeFieldEnd()
+    if self.o1 is not None:
+      oprot.writeFieldBegin('o1', TType.STRUCT, 1)
+      self.o1.write(oprot)
+      oprot.writeFieldEnd()
+    if self.o2 is not None:
+      oprot.writeFieldBegin('o2', TType.STRUCT, 2)
+      self.o2.write(oprot)
+      oprot.writeFieldEnd()
+    oprot.writeFieldStop()
+    oprot.writeStructEnd()
+
+  def validate(self):
+    return
+
+
+  def __hash__(self):
+    value = 17
+    value = (value * 31) ^ hash(self.success)
+    value = (value * 31) ^ hash(self.o1)
+    value = (value * 31) ^ hash(self.o2)
+    return value
+
+  def __repr__(self):
+    L = ['%s=%r' % (key, value)
+      for key, value in self.__dict__.iteritems()]
+    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
+
+  def __eq__(self, other):
+    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
+
+  def __ne__(self, other):
+    return not (self == other)
+
 class get_partitions_by_names_args:
   """
   Attributes:

http://git-wip-us.apache.org/repos/asf/hive/blob/cdcc35e6/metastore/src/gen/thrift/gen-rb/thrift_hive_metastore.rb
----------------------------------------------------------------------
diff --git a/metastore/src/gen/thrift/gen-rb/thrift_hive_metastore.rb b/metastore/src/gen/thrift/gen-rb/thrift_hive_metastore.rb
index a90a180..9b9a27c 100644
--- a/metastore/src/gen/thrift/gen-rb/thrift_hive_metastore.rb
+++ b/metastore/src/gen/thrift/gen-rb/thrift_hive_metastore.rb
@@ -1004,6 +1004,23 @@ module ThriftHiveMetastore
       raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'get_partitions_by_expr failed: unknown result')
     end
 
+    def get_num_partitions_by_filter(db_name, tbl_name, filter)
+      send_get_num_partitions_by_filter(db_name, tbl_name, filter)
+      return recv_get_num_partitions_by_filter()
+    end
+
+    def send_get_num_partitions_by_filter(db_name, tbl_name, filter)
+      send_message('get_num_partitions_by_filter', Get_num_partitions_by_filter_args, :db_name => db_name, :tbl_name => tbl_name, :filter => filter)
+    end
+
+    def recv_get_num_partitions_by_filter()
+      result = receive_message(Get_num_partitions_by_filter_result)
+      return result.success unless result.success.nil?
+      raise result.o1 unless result.o1.nil?
+      raise result.o2 unless result.o2.nil?
+      raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'get_num_partitions_by_filter failed: unknown result')
+    end
+
     def get_partitions_by_names(db_name, tbl_name, names)
       send_get_partitions_by_names(db_name, tbl_name, names)
       return recv_get_partitions_by_names()
@@ -3007,6 +3024,19 @@ module ThriftHiveMetastore
       write_result(result, oprot, 'get_partitions_by_expr', seqid)
     end
 
+    def process_get_num_partitions_by_filter(seqid, iprot, oprot)
+      args = read_args(iprot, Get_num_partitions_by_filter_args)
+      result = Get_num_partitions_by_filter_result.new()
+      begin
+        result.success = @handler.get_num_partitions_by_filter(args.db_name, args.tbl_name, args.filter)
+      rescue ::MetaException => o1
+        result.o1 = o1
+      rescue ::NoSuchObjectException => o2
+        result.o2 = o2
+      end
+      write_result(result, oprot, 'get_num_partitions_by_filter', seqid)
+    end
+
     def process_get_partitions_by_names(seqid, iprot, oprot)
       args = read_args(iprot, Get_partitions_by_names_args)
       result = Get_partitions_by_names_result.new()
@@ -6176,6 +6206,46 @@ module ThriftHiveMetastore
     ::Thrift::Struct.generate_accessors self
   end
 
+  class Get_num_partitions_by_filter_args
+    include ::Thrift::Struct, ::Thrift::Struct_Union
+    DB_NAME = 1
+    TBL_NAME = 2
+    FILTER = 3
+
+    FIELDS = {
+      DB_NAME => {:type => ::Thrift::Types::STRING, :name => 'db_name'},
+      TBL_NAME => {:type => ::Thrift::Types::STRING, :name => 'tbl_name'},
+      FILTER => {:type => ::Thrift::Types::STRING, :name => 'filter'}
+    }
+
+    def struct_fields; FIELDS; end
+
+    def validate
+    end
+
+    ::Thrift::Struct.generate_accessors self
+  end
+
+  class Get_num_partitions_by_filter_result
+    include ::Thrift::Struct, ::Thrift::Struct_Union
+    SUCCESS = 0
+    O1 = 1
+    O2 = 2
+
+    FIELDS = {
+      SUCCESS => {:type => ::Thrift::Types::I32, :name => 'success'},
+      O1 => {:type => ::Thrift::Types::STRUCT, :name => 'o1', :class => ::MetaException},
+      O2 => {:type => ::Thrift::Types::STRUCT, :name => 'o2', :class => ::NoSuchObjectException}
+    }
+
+    def struct_fields; FIELDS; end
+
+    def validate
+    end
+
+    ::Thrift::Struct.generate_accessors self
+  end
+
   class Get_partitions_by_names_args
     include ::Thrift::Struct, ::Thrift::Struct_Union
     DB_NAME = 1

http://git-wip-us.apache.org/repos/asf/hive/blob/cdcc35e6/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
----------------------------------------------------------------------
diff --git a/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java b/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
index 81d7128..ace644b 100644
--- a/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
+++ b/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
@@ -4559,6 +4559,25 @@ public class HiveMetaStore extends ThriftHiveMetastore {
     }
 
     @Override
+    public int get_num_partitions_by_filter(final String dbName,
+                                            final String tblName, final String filter)
+            throws MetaException, NoSuchObjectException, TException {
+      startTableFunction("get_num_partitions_by_filter", dbName, tblName);
+
+      int ret = -1;
+      Exception ex = null;
+      try {
+        ret = getMS().getNumPartitionsByFilter(dbName, tblName, filter);
+      } catch (Exception e) {
+        ex = e;
+        rethrowException(e);
+      } finally {
+        endFunction("get_num_partitions_by_filter", ret != -1, ex, tblName);
+      }
+      return ret;
+    }
+
+    @Override
     public List<Partition> get_partitions_by_names(final String dbName,
         final String tblName, final List<String> partNames)
         throws MetaException, NoSuchObjectException, TException {

http://git-wip-us.apache.org/repos/asf/hive/blob/cdcc35e6/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java
----------------------------------------------------------------------
diff --git a/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java b/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java
index a17c6d8..09a6aea 100644
--- a/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java
+++ b/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java
@@ -1204,7 +1204,6 @@ public class HiveMetaStoreClient implements IMetaStoreClient {
     return !r.isSetHasUnknownPartitions() || r.isHasUnknownPartitions(); // Assume the worst.
   }
 
-
   /**
    * @param name
    * @return the database
@@ -1395,6 +1394,24 @@ public class HiveMetaStoreClient implements IMetaStoreClient {
         client.get_partition_names_ps(db_name, tbl_name, part_vals, max_parts));
   }
 
+  /**
+   * Get number of partitions matching specified filter
+   * @param db_name the database name
+   * @param tbl_name the table name
+   * @param filter the filter string,
+   *    for example "part1 = \"p1_abc\" and part2 <= "\p2_test\"". Filtering can
+   *    be done only on string partition keys.
+   * @return number of partitions
+   * @throws MetaException
+   * @throws NoSuchObjectException
+   * @throws TException
+   */
+  public int getNumPartitionsByFilter(String db_name, String tbl_name,
+                                      String filter) throws MetaException,
+          NoSuchObjectException, TException {
+    return client.get_num_partitions_by_filter(db_name, tbl_name, filter);
+  }
+
   @Override
   public void alter_partition(String dbName, String tblName, Partition newPart)
       throws InvalidOperationException, MetaException, TException {

http://git-wip-us.apache.org/repos/asf/hive/blob/cdcc35e6/metastore/src/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java
----------------------------------------------------------------------
diff --git a/metastore/src/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java b/metastore/src/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java
index 25e0d38..4284d54 100644
--- a/metastore/src/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java
+++ b/metastore/src/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java
@@ -530,6 +530,22 @@ public interface IMetaStoreClient {
       throws MetaException, TException, NoSuchObjectException;
 
   /**
+   * Get number of partitions matching specified filter
+   * @param dbName the database name
+   * @param tableName the table name
+   * @param filter the filter string,
+   *    for example "part1 = \"p1_abc\" and part2 <= "\p2_test\"". Filtering can
+   *    be done only on string partition keys.
+   * @return number of partitions
+   * @throws MetaException
+   * @throws NoSuchObjectException
+   * @throws TException
+   */
+  public int getNumPartitionsByFilter(String dbName, String tableName,
+                                      String filter) throws MetaException, NoSuchObjectException, TException;
+
+
+    /**
    * Get list of partitions matching specified filter
    * @param db_name the database name
    * @param tbl_name the table name

http://git-wip-us.apache.org/repos/asf/hive/blob/cdcc35e6/metastore/src/java/org/apache/hadoop/hive/metastore/MetaStoreDirectSql.java
----------------------------------------------------------------------
diff --git a/metastore/src/java/org/apache/hadoop/hive/metastore/MetaStoreDirectSql.java b/metastore/src/java/org/apache/hadoop/hive/metastore/MetaStoreDirectSql.java
index 36b316a..be54b9c 100644
--- a/metastore/src/java/org/apache/hadoop/hive/metastore/MetaStoreDirectSql.java
+++ b/metastore/src/java/org/apache/hadoop/hive/metastore/MetaStoreDirectSql.java
@@ -385,6 +385,20 @@ class MetaStoreDirectSql {
         isViewTable, sqlFilter, params, joins, max);
   }
 
+  public int getNumPartitionsViaSqlFilter(Table table, ExpressionTree tree) throws MetaException {
+    List<Object> params = new ArrayList<Object>();
+    List<String>joins = new ArrayList<String>();
+    // Derby and Oracle do not interpret filters ANSI-properly in some cases and need a workaround.
+    boolean dbHasJoinCastBug = (dbType == DB.DERBY || dbType == DB.ORACLE);
+    String sqlFilter = PartitionFilterGenerator.generateSqlFilter(
+        table, tree, params, joins, dbHasJoinCastBug, defaultPartName);
+    if (sqlFilter == null) {
+      return 0; // Cannot make SQL filter to push down.
+    }
+    return getNumPartitionsViaSqlFilterInternal(table.getDbName(), table.getTableName(), sqlFilter, params, joins);
+  }
+
+
   /**
    * Gets all partitions of a table by using direct SQL queries.
    * @param dbName Metastore db name.
@@ -807,6 +821,39 @@ class MetaStoreDirectSql {
     return orderedResult;
   }
 
+  private int getNumPartitionsViaSqlFilterInternal(String dbName, String tblName,
+                                                   String sqlFilter, List<Object> paramsForFilter,
+                                                   List<String> joinsForFilter) throws MetaException {
+    boolean doTrace = LOG.isDebugEnabled();
+    dbName = dbName.toLowerCase();
+    tblName = tblName.toLowerCase();
+
+    // Get number of partitions by doing count on PART_ID.
+    String queryText = "select count(\"PARTITIONS\".\"PART_ID\") from \"PARTITIONS\""
+      + "  inner join \"TBLS\" on \"PARTITIONS\".\"TBL_ID\" = \"TBLS\".\"TBL_ID\" "
+      + "    and \"TBLS\".\"TBL_NAME\" = ? "
+      + "  inner join \"DBS\" on \"TBLS\".\"DB_ID\" = \"DBS\".\"DB_ID\" "
+      + "     and \"DBS\".\"NAME\" = ? "
+      + join(joinsForFilter, ' ')
+      + (sqlFilter == null ? "" : (" where " + sqlFilter));
+
+    Object[] params = new Object[paramsForFilter.size() + 2];
+    params[0] = tblName;
+    params[1] = dbName;
+    for (int i = 0; i < paramsForFilter.size(); ++i) {
+      params[i + 2] = paramsForFilter.get(i);
+    }
+
+    long start = doTrace ? System.nanoTime() : 0;
+    Query query = pm.newQuery("javax.jdo.query.SQL", queryText);
+    @SuppressWarnings("unchecked")
+    int sqlResult = extractSqlInt(query.executeWithArray(params));
+    long queryTime = doTrace ? System.nanoTime() : 0;
+    timingTrace(doTrace, queryText, start, queryTime);
+    return sqlResult;
+  }
+
+
   private void timingTrace(boolean doTrace, String queryText, long start, long queryTime) {
     if (!doTrace) return;
     LOG.debug("Direct SQL query in " + (queryTime - start) / 1000000.0 + "ms + " +

http://git-wip-us.apache.org/repos/asf/hive/blob/cdcc35e6/metastore/src/java/org/apache/hadoop/hive/metastore/ObjectStore.java
----------------------------------------------------------------------
diff --git a/metastore/src/java/org/apache/hadoop/hive/metastore/ObjectStore.java b/metastore/src/java/org/apache/hadoop/hive/metastore/ObjectStore.java
index 05d5b57..e1b8b6c 100644
--- a/metastore/src/java/org/apache/hadoop/hive/metastore/ObjectStore.java
+++ b/metastore/src/java/org/apache/hadoop/hive/metastore/ObjectStore.java
@@ -2279,6 +2279,7 @@ public class ObjectStore implements RawStore, Configurable {
         }
         return result;
       }
+
       @Override
       protected List<Partition> getJdoResult(
           GetHelper<List<Partition>> ctx) throws MetaException, NoSuchObjectException {
@@ -2365,6 +2366,12 @@ public class ObjectStore implements RawStore, Configurable {
     return results;
   }
 
+
+  private Integer getNumPartitionsViaOrmFilter(Table table, ExpressionTree tree, boolean isValidatedFilter)
+    throws MetaException {
+    return getPartitionsViaOrmFilter(table, tree, (short) -1, isValidatedFilter).size();
+  }
+
   /**
    * Gets partition names from the table via ORM (JDOQL) name filter.
    * @param dbName Database name.
@@ -2646,6 +2653,36 @@ public class ObjectStore implements RawStore, Configurable {
     }
   }
 
+  @Override
+  public int getNumPartitionsByFilter(String dbName, String tblName,
+                                      String filter) throws MetaException, NoSuchObjectException {
+    return getNumPartitionsByFilterInternal(dbName, tblName, filter,
+      true, true);
+  }
+
+  protected int getNumPartitionsByFilterInternal(String dbName, String tblName,
+                                                 String filter, boolean allowSql, boolean allowJdo)
+    throws MetaException, NoSuchObjectException {
+    final ExpressionTree tree = (filter != null && !filter.isEmpty())
+      ? PartFilterExprUtil.getFilterParser(filter).tree : ExpressionTree.EMPTY_TREE;
+    return new GetHelper<Integer>(dbName, tblName, allowSql, allowJdo) {
+      @Override
+      protected String describeResult() {
+        return null;
+      }
+
+      @Override
+      protected Integer getSqlResult(GetHelper<Integer> ctx) throws MetaException {
+        return directSql.getNumPartitionsViaSqlFilter(ctx.getTable(), tree);
+      }
+      @Override
+      protected Integer getJdoResult(
+        GetHelper<Integer> ctx) throws MetaException, NoSuchObjectException {
+        return getNumPartitionsViaOrmFilter(ctx.getTable(), tree, true);
+      }
+    }.run(true);
+  }
+
   protected List<Partition> getPartitionsByFilterInternal(String dbName, String tblName,
       String filter, final short maxParts, boolean allowSql, boolean allowJdo)
       throws MetaException, NoSuchObjectException {

http://git-wip-us.apache.org/repos/asf/hive/blob/cdcc35e6/metastore/src/java/org/apache/hadoop/hive/metastore/RawStore.java
----------------------------------------------------------------------
diff --git a/metastore/src/java/org/apache/hadoop/hive/metastore/RawStore.java b/metastore/src/java/org/apache/hadoop/hive/metastore/RawStore.java
index d228f24..cbd5957 100644
--- a/metastore/src/java/org/apache/hadoop/hive/metastore/RawStore.java
+++ b/metastore/src/java/org/apache/hadoop/hive/metastore/RawStore.java
@@ -223,6 +223,9 @@ public interface RawStore extends Configurable {
       byte[] expr, String defaultPartitionName, short maxParts, List<Partition> result)
       throws TException;
 
+  public abstract int getNumPartitionsByFilter(String dbName, String tblName, String filter)
+    throws MetaException, NoSuchObjectException;
+
   public abstract List<Partition> getPartitionsByNames(
       String dbName, String tblName, List<String> partNames)
       throws MetaException, NoSuchObjectException;

http://git-wip-us.apache.org/repos/asf/hive/blob/cdcc35e6/metastore/src/java/org/apache/hadoop/hive/metastore/hbase/HBaseStore.java
----------------------------------------------------------------------
diff --git a/metastore/src/java/org/apache/hadoop/hive/metastore/hbase/HBaseStore.java b/metastore/src/java/org/apache/hadoop/hive/metastore/hbase/HBaseStore.java
index fcf983f..0ffdbe0 100644
--- a/metastore/src/java/org/apache/hadoop/hive/metastore/hbase/HBaseStore.java
+++ b/metastore/src/java/org/apache/hadoop/hive/metastore/hbase/HBaseStore.java
@@ -758,6 +758,21 @@ public class HBaseStore implements RawStore {
     }
   }
 
+  @Override
+  public int getNumPartitionsByFilter(String dbName, String tblName, String filter)
+    throws MetaException, NoSuchObjectException {
+    final ExpressionTree exprTree = (filter != null && !filter.isEmpty()) ? PartFilterExprUtil
+      .getFilterParser(filter).tree : ExpressionTree.EMPTY_TREE;
+    List<Partition> result = new ArrayList<Partition>();
+    boolean commit = false;
+    openTransaction();
+    try {
+      return getPartitionsByFilter(dbName, tblName, filter, Short.MAX_VALUE).size();
+    } finally {
+      commitOrRoleBack(commit);
+    }
+  }
+
   /**
    * Gets the partition names from a table, pruned using an expression.
    * @param table Table.

http://git-wip-us.apache.org/repos/asf/hive/blob/cdcc35e6/metastore/src/test/org/apache/hadoop/hive/metastore/DummyRawStoreControlledCommit.java
----------------------------------------------------------------------
diff --git a/metastore/src/test/org/apache/hadoop/hive/metastore/DummyRawStoreControlledCommit.java b/metastore/src/test/org/apache/hadoop/hive/metastore/DummyRawStoreControlledCommit.java
index 477a3be..660dd4e 100644
--- a/metastore/src/test/org/apache/hadoop/hive/metastore/DummyRawStoreControlledCommit.java
+++ b/metastore/src/test/org/apache/hadoop/hive/metastore/DummyRawStoreControlledCommit.java
@@ -310,6 +310,12 @@ public class DummyRawStoreControlledCommit implements RawStore, Configurable {
   }
 
   @Override
+  public int getNumPartitionsByFilter(String dbName, String tblName,
+                                      String filter) throws MetaException, NoSuchObjectException {
+    return objectStore.getNumPartitionsByFilter(dbName, tblName, filter);
+  }
+
+  @Override
   public List<Partition> getPartitionsByNames(String dbName, String tblName,
       List<String> partNames) throws MetaException, NoSuchObjectException {
     return objectStore.getPartitionsByNames(dbName, tblName, partNames);

http://git-wip-us.apache.org/repos/asf/hive/blob/cdcc35e6/metastore/src/test/org/apache/hadoop/hive/metastore/DummyRawStoreForJdoConnection.java
----------------------------------------------------------------------
diff --git a/metastore/src/test/org/apache/hadoop/hive/metastore/DummyRawStoreForJdoConnection.java b/metastore/src/test/org/apache/hadoop/hive/metastore/DummyRawStoreForJdoConnection.java
index ecabd5d..9103102 100644
--- a/metastore/src/test/org/apache/hadoop/hive/metastore/DummyRawStoreForJdoConnection.java
+++ b/metastore/src/test/org/apache/hadoop/hive/metastore/DummyRawStoreForJdoConnection.java
@@ -341,6 +341,12 @@ public class DummyRawStoreForJdoConnection implements RawStore {
   }
 
   @Override
+  public int getNumPartitionsByFilter(String dbName, String tblName, String filter)
+    throws MetaException, NoSuchObjectException {
+    return -1;
+  }
+
+  @Override
   public Table markPartitionForEvent(String dbName, String tblName, Map<String, String> partVals,
       PartitionEventType evtType) throws MetaException, UnknownTableException,
       InvalidPartitionException, UnknownPartitionException {

http://git-wip-us.apache.org/repos/asf/hive/blob/cdcc35e6/metastore/src/test/org/apache/hadoop/hive/metastore/TestObjectStore.java
----------------------------------------------------------------------
diff --git a/metastore/src/test/org/apache/hadoop/hive/metastore/TestObjectStore.java b/metastore/src/test/org/apache/hadoop/hive/metastore/TestObjectStore.java
index 1157033..2e1f5f4 100644
--- a/metastore/src/test/org/apache/hadoop/hive/metastore/TestObjectStore.java
+++ b/metastore/src/test/org/apache/hadoop/hive/metastore/TestObjectStore.java
@@ -37,6 +37,7 @@ import org.apache.hadoop.hive.metastore.api.SerDeInfo;
 import org.apache.hadoop.hive.metastore.api.StorageDescriptor;
 import org.apache.hadoop.hive.metastore.api.Table;
 import org.apache.hadoop.hive.ql.io.sarg.SearchArgument;
+import org.apache.hadoop.hive.serde.serdeConstants;
 import org.apache.hadoop.hive.serde2.typeinfo.PrimitiveTypeInfo;
 import org.junit.After;
 import org.junit.Assert;
@@ -163,8 +164,8 @@ public class TestObjectStore {
     StorageDescriptor sd = new StorageDescriptor(null, "location", null, null, false, 0, new SerDeInfo("SerDeName", "serializationLib", null), null, null, null);
     HashMap<String,String> tableParams = new HashMap<String,String>();
     tableParams.put("EXTERNAL", "false");
-    FieldSchema partitionKey1 = new FieldSchema("Country", "String", "");
-    FieldSchema partitionKey2 = new FieldSchema("State", "String", "");
+    FieldSchema partitionKey1 = new FieldSchema("Country", serdeConstants.STRING_TYPE_NAME, "");
+    FieldSchema partitionKey2 = new FieldSchema("State", serdeConstants.STRING_TYPE_NAME, "");
     Table tbl1 = new Table(TABLE1, DB1, "owner", 1, 2, 3, sd, Arrays.asList(partitionKey1, partitionKey2), tableParams, "viewOriginalText", "viewExpandedText", "MANAGED_TABLE");
     objectStore.createTable(tbl1);
     HashMap<String, String> partitionParams = new HashMap<String, String>();
@@ -182,6 +183,12 @@ public class TestObjectStore {
     Assert.assertEquals(111, partitions.get(0).getCreateTime());
     Assert.assertEquals(222, partitions.get(1).getCreateTime());
 
+    int numPartitions  = objectStore.getNumPartitionsByFilter(DB1, TABLE1, "");
+    Assert.assertEquals(partitions.size(), numPartitions);
+
+    numPartitions  = objectStore.getNumPartitionsByFilter(DB1, TABLE1, "country = \"US\"");
+    Assert.assertEquals(2, numPartitions);
+
     objectStore.dropPartition(DB1, TABLE1, value1);
     partitions = objectStore.getPartitions(DB1, TABLE1, 10);
     Assert.assertEquals(1, partitions.size());

http://git-wip-us.apache.org/repos/asf/hive/blob/cdcc35e6/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java b/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java
index 29df4f9..dca1198 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java
@@ -2373,6 +2373,30 @@ private void constructOneLBLocationMap(FileStatus fSta,
     return hasUnknownParts;
   }
 
+  /**
+   * Get a number of Partitions by filter.
+   * @param tbl The table containing the partitions.
+   * @param filter A string represent partition predicates.
+   * @return the number of partitions satisfying the partition predicates.
+   * @throws HiveException
+   * @throws MetaException
+   * @throws NoSuchObjectException
+   * @throws TException
+   */
+  public int getNumPartitionsByFilter(Table tbl, String filter)
+    throws HiveException, MetaException, NoSuchObjectException, TException {
+
+    if (!tbl.isPartitioned()) {
+      throw new HiveException("Partition spec should only be supplied for a " +
+        "partitioned table");
+    }
+
+    int numParts = getMSC().getNumPartitionsByFilter(
+      tbl.getDbName(), tbl.getTableName(), filter);
+
+    return numParts;
+  }
+
   public void validatePartitionNameCharacters(List<String> partVals) throws HiveException {
     try {
       getMSC().validatePartitionNameCharacters(partVals);

http://git-wip-us.apache.org/repos/asf/hive/blob/cdcc35e6/service/src/gen/thrift/gen-py/hive_service/ThriftHive-remote
----------------------------------------------------------------------
diff --git a/service/src/gen/thrift/gen-py/hive_service/ThriftHive-remote b/service/src/gen/thrift/gen-py/hive_service/ThriftHive-remote
index 4bd7a5a..ec21b6c 100755
--- a/service/src/gen/thrift/gen-py/hive_service/ThriftHive-remote
+++ b/service/src/gen/thrift/gen-py/hive_service/ThriftHive-remote
@@ -91,6 +91,7 @@ if len(sys.argv) <= 1 or sys.argv[1] == '--help':
   print('   get_partitions_by_filter(string db_name, string tbl_name, string filter, i16 max_parts)')
   print('   get_part_specs_by_filter(string db_name, string tbl_name, string filter, i32 max_parts)')
   print('  PartitionsByExprResult get_partitions_by_expr(PartitionsByExprRequest req)')
+  print('  i32 get_num_partitions_by_filter(string db_name, string tbl_name, string filter)')
   print('   get_partitions_by_names(string db_name, string tbl_name,  names)')
   print('  void alter_partition(string db_name, string tbl_name, Partition new_part)')
   print('  void alter_partitions(string db_name, string tbl_name,  new_parts)')
@@ -636,6 +637,12 @@ elif cmd == 'get_partitions_by_expr':
     sys.exit(1)
   pp.pprint(client.get_partitions_by_expr(eval(args[0]),))
 
+elif cmd == 'get_num_partitions_by_filter':
+  if len(args) != 3:
+    print('get_num_partitions_by_filter requires 3 args')
+    sys.exit(1)
+  pp.pprint(client.get_num_partitions_by_filter(args[0],args[1],args[2],))
+
 elif cmd == 'get_partitions_by_names':
   if len(args) != 3:
     print('get_partitions_by_names requires 3 args')


[2/3] hive git commit: HIVE-11487 : Adds getNumPartitionsByFilter api in metastore api

Posted by am...@apache.org.
http://git-wip-us.apache.org/repos/asf/hive/blob/cdcc35e6/metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/ThriftHiveMetastore.java
----------------------------------------------------------------------
diff --git a/metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/ThriftHiveMetastore.java b/metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/ThriftHiveMetastore.java
index 47b7afa..7ae18a1 100644
--- a/metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/ThriftHiveMetastore.java
+++ b/metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/ThriftHiveMetastore.java
@@ -158,6 +158,8 @@ public class ThriftHiveMetastore {
 
     public PartitionsByExprResult get_partitions_by_expr(PartitionsByExprRequest req) throws MetaException, NoSuchObjectException, org.apache.thrift.TException;
 
+    public int get_num_partitions_by_filter(String db_name, String tbl_name, String filter) throws MetaException, NoSuchObjectException, org.apache.thrift.TException;
+
     public List<Partition> get_partitions_by_names(String db_name, String tbl_name, List<String> names) throws MetaException, NoSuchObjectException, org.apache.thrift.TException;
 
     public void alter_partition(String db_name, String tbl_name, Partition new_part) throws InvalidOperationException, MetaException, org.apache.thrift.TException;
@@ -426,6 +428,8 @@ public class ThriftHiveMetastore {
 
     public void get_partitions_by_expr(PartitionsByExprRequest req, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
 
+    public void get_num_partitions_by_filter(String db_name, String tbl_name, String filter, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
+
     public void get_partitions_by_names(String db_name, String tbl_name, List<String> names, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
 
     public void alter_partition(String db_name, String tbl_name, Partition new_part, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
@@ -2394,6 +2398,37 @@ public class ThriftHiveMetastore {
       throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "get_partitions_by_expr failed: unknown result");
     }
 
+    public int get_num_partitions_by_filter(String db_name, String tbl_name, String filter) throws MetaException, NoSuchObjectException, org.apache.thrift.TException
+    {
+      send_get_num_partitions_by_filter(db_name, tbl_name, filter);
+      return recv_get_num_partitions_by_filter();
+    }
+
+    public void send_get_num_partitions_by_filter(String db_name, String tbl_name, String filter) throws org.apache.thrift.TException
+    {
+      get_num_partitions_by_filter_args args = new get_num_partitions_by_filter_args();
+      args.setDb_name(db_name);
+      args.setTbl_name(tbl_name);
+      args.setFilter(filter);
+      sendBase("get_num_partitions_by_filter", args);
+    }
+
+    public int recv_get_num_partitions_by_filter() throws MetaException, NoSuchObjectException, org.apache.thrift.TException
+    {
+      get_num_partitions_by_filter_result result = new get_num_partitions_by_filter_result();
+      receiveBase(result, "get_num_partitions_by_filter");
+      if (result.isSetSuccess()) {
+        return result.success;
+      }
+      if (result.o1 != null) {
+        throw result.o1;
+      }
+      if (result.o2 != null) {
+        throw result.o2;
+      }
+      throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "get_num_partitions_by_filter failed: unknown result");
+    }
+
     public List<Partition> get_partitions_by_names(String db_name, String tbl_name, List<String> names) throws MetaException, NoSuchObjectException, org.apache.thrift.TException
     {
       send_get_partitions_by_names(db_name, tbl_name, names);
@@ -6620,6 +6655,44 @@ public class ThriftHiveMetastore {
       }
     }
 
+    public void get_num_partitions_by_filter(String db_name, String tbl_name, String filter, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
+      checkReady();
+      get_num_partitions_by_filter_call method_call = new get_num_partitions_by_filter_call(db_name, tbl_name, filter, resultHandler, this, ___protocolFactory, ___transport);
+      this.___currentMethod = method_call;
+      ___manager.call(method_call);
+    }
+
+    public static class get_num_partitions_by_filter_call extends org.apache.thrift.async.TAsyncMethodCall {
+      private String db_name;
+      private String tbl_name;
+      private String filter;
+      public get_num_partitions_by_filter_call(String db_name, String tbl_name, String filter, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
+        super(client, protocolFactory, transport, resultHandler, false);
+        this.db_name = db_name;
+        this.tbl_name = tbl_name;
+        this.filter = filter;
+      }
+
+      public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
+        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("get_num_partitions_by_filter", org.apache.thrift.protocol.TMessageType.CALL, 0));
+        get_num_partitions_by_filter_args args = new get_num_partitions_by_filter_args();
+        args.setDb_name(db_name);
+        args.setTbl_name(tbl_name);
+        args.setFilter(filter);
+        args.write(prot);
+        prot.writeMessageEnd();
+      }
+
+      public int getResult() throws MetaException, NoSuchObjectException, org.apache.thrift.TException {
+        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
+          throw new IllegalStateException("Method call not finished!");
+        }
+        org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
+        org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
+        return (new Client(prot)).recv_get_num_partitions_by_filter();
+      }
+    }
+
     public void get_partitions_by_names(String db_name, String tbl_name, List<String> names, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
       checkReady();
       get_partitions_by_names_call method_call = new get_partitions_by_names_call(db_name, tbl_name, names, resultHandler, this, ___protocolFactory, ___transport);
@@ -9227,6 +9300,7 @@ public class ThriftHiveMetastore {
       processMap.put("get_partitions_by_filter", new get_partitions_by_filter());
       processMap.put("get_part_specs_by_filter", new get_part_specs_by_filter());
       processMap.put("get_partitions_by_expr", new get_partitions_by_expr());
+      processMap.put("get_num_partitions_by_filter", new get_num_partitions_by_filter());
       processMap.put("get_partitions_by_names", new get_partitions_by_names());
       processMap.put("alter_partition", new alter_partition());
       processMap.put("alter_partitions", new alter_partitions());
@@ -10854,6 +10928,33 @@ public class ThriftHiveMetastore {
       }
     }
 
+    public static class get_num_partitions_by_filter<I extends Iface> extends org.apache.thrift.ProcessFunction<I, get_num_partitions_by_filter_args> {
+      public get_num_partitions_by_filter() {
+        super("get_num_partitions_by_filter");
+      }
+
+      public get_num_partitions_by_filter_args getEmptyArgsInstance() {
+        return new get_num_partitions_by_filter_args();
+      }
+
+      protected boolean isOneway() {
+        return false;
+      }
+
+      public get_num_partitions_by_filter_result getResult(I iface, get_num_partitions_by_filter_args args) throws org.apache.thrift.TException {
+        get_num_partitions_by_filter_result result = new get_num_partitions_by_filter_result();
+        try {
+          result.success = iface.get_num_partitions_by_filter(args.db_name, args.tbl_name, args.filter);
+          result.setSuccessIsSet(true);
+        } catch (MetaException o1) {
+          result.o1 = o1;
+        } catch (NoSuchObjectException o2) {
+          result.o2 = o2;
+        }
+        return result;
+      }
+    }
+
     public static class get_partitions_by_names<I extends Iface> extends org.apache.thrift.ProcessFunction<I, get_partitions_by_names_args> {
       public get_partitions_by_names() {
         super("get_partitions_by_names");
@@ -12770,6 +12871,7 @@ public class ThriftHiveMetastore {
       processMap.put("get_partitions_by_filter", new get_partitions_by_filter());
       processMap.put("get_part_specs_by_filter", new get_part_specs_by_filter());
       processMap.put("get_partitions_by_expr", new get_partitions_by_expr());
+      processMap.put("get_num_partitions_by_filter", new get_num_partitions_by_filter());
       processMap.put("get_partitions_by_names", new get_partitions_by_names());
       processMap.put("alter_partition", new alter_partition());
       processMap.put("alter_partitions", new alter_partitions());
@@ -16525,6 +16627,69 @@ public class ThriftHiveMetastore {
       }
     }
 
+    public static class get_num_partitions_by_filter<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, get_num_partitions_by_filter_args, Integer> {
+      public get_num_partitions_by_filter() {
+        super("get_num_partitions_by_filter");
+      }
+
+      public get_num_partitions_by_filter_args getEmptyArgsInstance() {
+        return new get_num_partitions_by_filter_args();
+      }
+
+      public AsyncMethodCallback<Integer> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
+        final org.apache.thrift.AsyncProcessFunction fcall = this;
+        return new AsyncMethodCallback<Integer>() { 
+          public void onComplete(Integer o) {
+            get_num_partitions_by_filter_result result = new get_num_partitions_by_filter_result();
+            result.success = o;
+            result.setSuccessIsSet(true);
+            try {
+              fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
+              return;
+            } catch (Exception e) {
+              LOGGER.error("Exception writing to internal frame buffer", e);
+            }
+            fb.close();
+          }
+          public void onError(Exception e) {
+            byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
+            org.apache.thrift.TBase msg;
+            get_num_partitions_by_filter_result result = new get_num_partitions_by_filter_result();
+            if (e instanceof MetaException) {
+                        result.o1 = (MetaException) e;
+                        result.setO1IsSet(true);
+                        msg = result;
+            }
+            else             if (e instanceof NoSuchObjectException) {
+                        result.o2 = (NoSuchObjectException) e;
+                        result.setO2IsSet(true);
+                        msg = result;
+            }
+             else 
+            {
+              msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
+              msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
+            }
+            try {
+              fcall.sendResponse(fb,msg,msgType,seqid);
+              return;
+            } catch (Exception ex) {
+              LOGGER.error("Exception writing to internal frame buffer", ex);
+            }
+            fb.close();
+          }
+        };
+      }
+
+      protected boolean isOneway() {
+        return false;
+      }
+
+      public void start(I iface, get_num_partitions_by_filter_args args, org.apache.thrift.async.AsyncMethodCallback<Integer> resultHandler) throws TException {
+        iface.get_num_partitions_by_filter(args.db_name, args.tbl_name, args.filter,resultHandler);
+      }
+    }
+
     public static class get_partitions_by_names<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, get_partitions_by_names_args, List<Partition>> {
       public get_partitions_by_names() {
         super("get_partitions_by_names");
@@ -20900,7 +21065,7 @@ public class ThriftHiveMetastore {
 
       public AsyncMethodCallback<CacheFileMetadataResult> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
         final org.apache.thrift.AsyncProcessFunction fcall = this;
-        return new AsyncMethodCallback<CacheFileMetadataResult>() {
+        return new AsyncMethodCallback<CacheFileMetadataResult>() { 
           public void onComplete(CacheFileMetadataResult o) {
             cache_file_metadata_result result = new cache_file_metadata_result();
             result.success = o;
@@ -87843,28 +88008,28 @@ public class ThriftHiveMetastore {
 
   }
 
-  public static class get_partitions_by_names_args implements org.apache.thrift.TBase<get_partitions_by_names_args, get_partitions_by_names_args._Fields>, java.io.Serializable, Cloneable, Comparable<get_partitions_by_names_args>   {
-    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("get_partitions_by_names_args");
+  public static class get_num_partitions_by_filter_args implements org.apache.thrift.TBase<get_num_partitions_by_filter_args, get_num_partitions_by_filter_args._Fields>, java.io.Serializable, Cloneable, Comparable<get_num_partitions_by_filter_args>   {
+    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("get_num_partitions_by_filter_args");
 
     private static final org.apache.thrift.protocol.TField DB_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("db_name", org.apache.thrift.protocol.TType.STRING, (short)1);
     private static final org.apache.thrift.protocol.TField TBL_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("tbl_name", org.apache.thrift.protocol.TType.STRING, (short)2);
-    private static final org.apache.thrift.protocol.TField NAMES_FIELD_DESC = new org.apache.thrift.protocol.TField("names", org.apache.thrift.protocol.TType.LIST, (short)3);
+    private static final org.apache.thrift.protocol.TField FILTER_FIELD_DESC = new org.apache.thrift.protocol.TField("filter", org.apache.thrift.protocol.TType.STRING, (short)3);
 
     private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
     static {
-      schemes.put(StandardScheme.class, new get_partitions_by_names_argsStandardSchemeFactory());
-      schemes.put(TupleScheme.class, new get_partitions_by_names_argsTupleSchemeFactory());
+      schemes.put(StandardScheme.class, new get_num_partitions_by_filter_argsStandardSchemeFactory());
+      schemes.put(TupleScheme.class, new get_num_partitions_by_filter_argsTupleSchemeFactory());
     }
 
     private String db_name; // required
     private String tbl_name; // required
-    private List<String> names; // required
+    private String filter; // required
 
     /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
     public enum _Fields implements org.apache.thrift.TFieldIdEnum {
       DB_NAME((short)1, "db_name"),
       TBL_NAME((short)2, "tbl_name"),
-      NAMES((short)3, "names");
+      FILTER((short)3, "filter");
 
       private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
 
@@ -87883,8 +88048,8 @@ public class ThriftHiveMetastore {
             return DB_NAME;
           case 2: // TBL_NAME
             return TBL_NAME;
-          case 3: // NAMES
-            return NAMES;
+          case 3: // FILTER
+            return FILTER;
           default:
             return null;
         }
@@ -87932,52 +88097,50 @@ public class ThriftHiveMetastore {
           new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
       tmpMap.put(_Fields.TBL_NAME, new org.apache.thrift.meta_data.FieldMetaData("tbl_name", org.apache.thrift.TFieldRequirementType.DEFAULT, 
           new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
-      tmpMap.put(_Fields.NAMES, new org.apache.thrift.meta_data.FieldMetaData("names", org.apache.thrift.TFieldRequirementType.DEFAULT, 
-          new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
-              new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
+      tmpMap.put(_Fields.FILTER, new org.apache.thrift.meta_data.FieldMetaData("filter", org.apache.thrift.TFieldRequirementType.DEFAULT, 
+          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
       metaDataMap = Collections.unmodifiableMap(tmpMap);
-      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(get_partitions_by_names_args.class, metaDataMap);
+      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(get_num_partitions_by_filter_args.class, metaDataMap);
     }
 
-    public get_partitions_by_names_args() {
+    public get_num_partitions_by_filter_args() {
     }
 
-    public get_partitions_by_names_args(
+    public get_num_partitions_by_filter_args(
       String db_name,
       String tbl_name,
-      List<String> names)
+      String filter)
     {
       this();
       this.db_name = db_name;
       this.tbl_name = tbl_name;
-      this.names = names;
+      this.filter = filter;
     }
 
     /**
      * Performs a deep copy on <i>other</i>.
      */
-    public get_partitions_by_names_args(get_partitions_by_names_args other) {
+    public get_num_partitions_by_filter_args(get_num_partitions_by_filter_args other) {
       if (other.isSetDb_name()) {
         this.db_name = other.db_name;
       }
       if (other.isSetTbl_name()) {
         this.tbl_name = other.tbl_name;
       }
-      if (other.isSetNames()) {
-        List<String> __this__names = new ArrayList<String>(other.names);
-        this.names = __this__names;
+      if (other.isSetFilter()) {
+        this.filter = other.filter;
       }
     }
 
-    public get_partitions_by_names_args deepCopy() {
-      return new get_partitions_by_names_args(this);
+    public get_num_partitions_by_filter_args deepCopy() {
+      return new get_num_partitions_by_filter_args(this);
     }
 
     @Override
     public void clear() {
       this.db_name = null;
       this.tbl_name = null;
-      this.names = null;
+      this.filter = null;
     }
 
     public String getDb_name() {
@@ -88026,41 +88189,26 @@ public class ThriftHiveMetastore {
       }
     }
 
-    public int getNamesSize() {
-      return (this.names == null) ? 0 : this.names.size();
-    }
-
-    public java.util.Iterator<String> getNamesIterator() {
-      return (this.names == null) ? null : this.names.iterator();
-    }
-
-    public void addToNames(String elem) {
-      if (this.names == null) {
-        this.names = new ArrayList<String>();
-      }
-      this.names.add(elem);
-    }
-
-    public List<String> getNames() {
-      return this.names;
+    public String getFilter() {
+      return this.filter;
     }
 
-    public void setNames(List<String> names) {
-      this.names = names;
+    public void setFilter(String filter) {
+      this.filter = filter;
     }
 
-    public void unsetNames() {
-      this.names = null;
+    public void unsetFilter() {
+      this.filter = null;
     }
 
-    /** Returns true if field names is set (has been assigned a value) and false otherwise */
-    public boolean isSetNames() {
-      return this.names != null;
+    /** Returns true if field filter is set (has been assigned a value) and false otherwise */
+    public boolean isSetFilter() {
+      return this.filter != null;
     }
 
-    public void setNamesIsSet(boolean value) {
+    public void setFilterIsSet(boolean value) {
       if (!value) {
-        this.names = null;
+        this.filter = null;
       }
     }
 
@@ -88082,11 +88230,11 @@ public class ThriftHiveMetastore {
         }
         break;
 
-      case NAMES:
+      case FILTER:
         if (value == null) {
-          unsetNames();
+          unsetFilter();
         } else {
-          setNames((List<String>)value);
+          setFilter((String)value);
         }
         break;
 
@@ -88101,8 +88249,8 @@ public class ThriftHiveMetastore {
       case TBL_NAME:
         return getTbl_name();
 
-      case NAMES:
-        return getNames();
+      case FILTER:
+        return getFilter();
 
       }
       throw new IllegalStateException();
@@ -88119,8 +88267,8 @@ public class ThriftHiveMetastore {
         return isSetDb_name();
       case TBL_NAME:
         return isSetTbl_name();
-      case NAMES:
-        return isSetNames();
+      case FILTER:
+        return isSetFilter();
       }
       throw new IllegalStateException();
     }
@@ -88129,12 +88277,12 @@ public class ThriftHiveMetastore {
     public boolean equals(Object that) {
       if (that == null)
         return false;
-      if (that instanceof get_partitions_by_names_args)
-        return this.equals((get_partitions_by_names_args)that);
+      if (that instanceof get_num_partitions_by_filter_args)
+        return this.equals((get_num_partitions_by_filter_args)that);
       return false;
     }
 
-    public boolean equals(get_partitions_by_names_args that) {
+    public boolean equals(get_num_partitions_by_filter_args that) {
       if (that == null)
         return false;
 
@@ -88156,12 +88304,12 @@ public class ThriftHiveMetastore {
           return false;
       }
 
-      boolean this_present_names = true && this.isSetNames();
-      boolean that_present_names = true && that.isSetNames();
-      if (this_present_names || that_present_names) {
-        if (!(this_present_names && that_present_names))
+      boolean this_present_filter = true && this.isSetFilter();
+      boolean that_present_filter = true && that.isSetFilter();
+      if (this_present_filter || that_present_filter) {
+        if (!(this_present_filter && that_present_filter))
           return false;
-        if (!this.names.equals(that.names))
+        if (!this.filter.equals(that.filter))
           return false;
       }
 
@@ -88182,16 +88330,16 @@ public class ThriftHiveMetastore {
       if (present_tbl_name)
         list.add(tbl_name);
 
-      boolean present_names = true && (isSetNames());
-      list.add(present_names);
-      if (present_names)
-        list.add(names);
+      boolean present_filter = true && (isSetFilter());
+      list.add(present_filter);
+      if (present_filter)
+        list.add(filter);
 
       return list.hashCode();
     }
 
     @Override
-    public int compareTo(get_partitions_by_names_args other) {
+    public int compareTo(get_num_partitions_by_filter_args other) {
       if (!getClass().equals(other.getClass())) {
         return getClass().getName().compareTo(other.getClass().getName());
       }
@@ -88218,12 +88366,12 @@ public class ThriftHiveMetastore {
           return lastComparison;
         }
       }
-      lastComparison = Boolean.valueOf(isSetNames()).compareTo(other.isSetNames());
+      lastComparison = Boolean.valueOf(isSetFilter()).compareTo(other.isSetFilter());
       if (lastComparison != 0) {
         return lastComparison;
       }
-      if (isSetNames()) {
-        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.names, other.names);
+      if (isSetFilter()) {
+        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.filter, other.filter);
         if (lastComparison != 0) {
           return lastComparison;
         }
@@ -88245,7 +88393,7 @@ public class ThriftHiveMetastore {
 
     @Override
     public String toString() {
-      StringBuilder sb = new StringBuilder("get_partitions_by_names_args(");
+      StringBuilder sb = new StringBuilder("get_num_partitions_by_filter_args(");
       boolean first = true;
 
       sb.append("db_name:");
@@ -88264,11 +88412,11 @@ public class ThriftHiveMetastore {
       }
       first = false;
       if (!first) sb.append(", ");
-      sb.append("names:");
-      if (this.names == null) {
+      sb.append("filter:");
+      if (this.filter == null) {
         sb.append("null");
       } else {
-        sb.append(this.names);
+        sb.append(this.filter);
       }
       first = false;
       sb.append(")");
@@ -88296,15 +88444,15 @@ public class ThriftHiveMetastore {
       }
     }
 
-    private static class get_partitions_by_names_argsStandardSchemeFactory implements SchemeFactory {
-      public get_partitions_by_names_argsStandardScheme getScheme() {
-        return new get_partitions_by_names_argsStandardScheme();
+    private static class get_num_partitions_by_filter_argsStandardSchemeFactory implements SchemeFactory {
+      public get_num_partitions_by_filter_argsStandardScheme getScheme() {
+        return new get_num_partitions_by_filter_argsStandardScheme();
       }
     }
 
-    private static class get_partitions_by_names_argsStandardScheme extends StandardScheme<get_partitions_by_names_args> {
+    private static class get_num_partitions_by_filter_argsStandardScheme extends StandardScheme<get_num_partitions_by_filter_args> {
 
-      public void read(org.apache.thrift.protocol.TProtocol iprot, get_partitions_by_names_args struct) throws org.apache.thrift.TException {
+      public void read(org.apache.thrift.protocol.TProtocol iprot, get_num_partitions_by_filter_args struct) throws org.apache.thrift.TException {
         org.apache.thrift.protocol.TField schemeField;
         iprot.readStructBegin();
         while (true)
@@ -88330,20 +88478,10 @@ public class ThriftHiveMetastore {
                 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
               }
               break;
-            case 3: // NAMES
-              if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
-                {
-                  org.apache.thrift.protocol.TList _list918 = iprot.readListBegin();
-                  struct.names = new ArrayList<String>(_list918.size);
-                  String _elem919;
-                  for (int _i920 = 0; _i920 < _list918.size; ++_i920)
-                  {
-                    _elem919 = iprot.readString();
-                    struct.names.add(_elem919);
-                  }
-                  iprot.readListEnd();
-                }
-                struct.setNamesIsSet(true);
+            case 3: // FILTER
+              if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+                struct.filter = iprot.readString();
+                struct.setFilterIsSet(true);
               } else { 
                 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
               }
@@ -88357,7 +88495,7 @@ public class ThriftHiveMetastore {
         struct.validate();
       }
 
-      public void write(org.apache.thrift.protocol.TProtocol oprot, get_partitions_by_names_args struct) throws org.apache.thrift.TException {
+      public void write(org.apache.thrift.protocol.TProtocol oprot, get_num_partitions_by_filter_args struct) throws org.apache.thrift.TException {
         struct.validate();
 
         oprot.writeStructBegin(STRUCT_DESC);
@@ -88371,16 +88509,9 @@ public class ThriftHiveMetastore {
           oprot.writeString(struct.tbl_name);
           oprot.writeFieldEnd();
         }
-        if (struct.names != null) {
-          oprot.writeFieldBegin(NAMES_FIELD_DESC);
-          {
-            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.names.size()));
-            for (String _iter921 : struct.names)
-            {
-              oprot.writeString(_iter921);
-            }
-            oprot.writeListEnd();
-          }
+        if (struct.filter != null) {
+          oprot.writeFieldBegin(FILTER_FIELD_DESC);
+          oprot.writeString(struct.filter);
           oprot.writeFieldEnd();
         }
         oprot.writeFieldStop();
@@ -88389,16 +88520,16 @@ public class ThriftHiveMetastore {
 
     }
 
-    private static class get_partitions_by_names_argsTupleSchemeFactory implements SchemeFactory {
-      public get_partitions_by_names_argsTupleScheme getScheme() {
-        return new get_partitions_by_names_argsTupleScheme();
+    private static class get_num_partitions_by_filter_argsTupleSchemeFactory implements SchemeFactory {
+      public get_num_partitions_by_filter_argsTupleScheme getScheme() {
+        return new get_num_partitions_by_filter_argsTupleScheme();
       }
     }
 
-    private static class get_partitions_by_names_argsTupleScheme extends TupleScheme<get_partitions_by_names_args> {
+    private static class get_num_partitions_by_filter_argsTupleScheme extends TupleScheme<get_num_partitions_by_filter_args> {
 
       @Override
-      public void write(org.apache.thrift.protocol.TProtocol prot, get_partitions_by_names_args struct) throws org.apache.thrift.TException {
+      public void write(org.apache.thrift.protocol.TProtocol prot, get_num_partitions_by_filter_args struct) throws org.apache.thrift.TException {
         TTupleProtocol oprot = (TTupleProtocol) prot;
         BitSet optionals = new BitSet();
         if (struct.isSetDb_name()) {
@@ -88407,7 +88538,7 @@ public class ThriftHiveMetastore {
         if (struct.isSetTbl_name()) {
           optionals.set(1);
         }
-        if (struct.isSetNames()) {
+        if (struct.isSetFilter()) {
           optionals.set(2);
         }
         oprot.writeBitSet(optionals, 3);
@@ -88417,19 +88548,13 @@ public class ThriftHiveMetastore {
         if (struct.isSetTbl_name()) {
           oprot.writeString(struct.tbl_name);
         }
-        if (struct.isSetNames()) {
-          {
-            oprot.writeI32(struct.names.size());
-            for (String _iter922 : struct.names)
-            {
-              oprot.writeString(_iter922);
-            }
-          }
+        if (struct.isSetFilter()) {
+          oprot.writeString(struct.filter);
         }
       }
 
       @Override
-      public void read(org.apache.thrift.protocol.TProtocol prot, get_partitions_by_names_args struct) throws org.apache.thrift.TException {
+      public void read(org.apache.thrift.protocol.TProtocol prot, get_num_partitions_by_filter_args struct) throws org.apache.thrift.TException {
         TTupleProtocol iprot = (TTupleProtocol) prot;
         BitSet incoming = iprot.readBitSet(3);
         if (incoming.get(0)) {
@@ -88441,37 +88566,28 @@ public class ThriftHiveMetastore {
           struct.setTbl_nameIsSet(true);
         }
         if (incoming.get(2)) {
-          {
-            org.apache.thrift.protocol.TList _list923 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
-            struct.names = new ArrayList<String>(_list923.size);
-            String _elem924;
-            for (int _i925 = 0; _i925 < _list923.size; ++_i925)
-            {
-              _elem924 = iprot.readString();
-              struct.names.add(_elem924);
-            }
-          }
-          struct.setNamesIsSet(true);
+          struct.filter = iprot.readString();
+          struct.setFilterIsSet(true);
         }
       }
     }
 
   }
 
-  public static class get_partitions_by_names_result implements org.apache.thrift.TBase<get_partitions_by_names_result, get_partitions_by_names_result._Fields>, java.io.Serializable, Cloneable, Comparable<get_partitions_by_names_result>   {
-    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("get_partitions_by_names_result");
+  public static class get_num_partitions_by_filter_result implements org.apache.thrift.TBase<get_num_partitions_by_filter_result, get_num_partitions_by_filter_result._Fields>, java.io.Serializable, Cloneable, Comparable<get_num_partitions_by_filter_result>   {
+    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("get_num_partitions_by_filter_result");
 
-    private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.LIST, (short)0);
+    private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.I32, (short)0);
     private static final org.apache.thrift.protocol.TField O1_FIELD_DESC = new org.apache.thrift.protocol.TField("o1", org.apache.thrift.protocol.TType.STRUCT, (short)1);
     private static final org.apache.thrift.protocol.TField O2_FIELD_DESC = new org.apache.thrift.protocol.TField("o2", org.apache.thrift.protocol.TType.STRUCT, (short)2);
 
     private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
     static {
-      schemes.put(StandardScheme.class, new get_partitions_by_names_resultStandardSchemeFactory());
-      schemes.put(TupleScheme.class, new get_partitions_by_names_resultTupleSchemeFactory());
+      schemes.put(StandardScheme.class, new get_num_partitions_by_filter_resultStandardSchemeFactory());
+      schemes.put(TupleScheme.class, new get_num_partitions_by_filter_resultTupleSchemeFactory());
     }
 
-    private List<Partition> success; // required
+    private int success; // required
     private MetaException o1; // required
     private NoSuchObjectException o2; // required
 
@@ -88540,30 +88656,32 @@ public class ThriftHiveMetastore {
     }
 
     // isset id assignments
+    private static final int __SUCCESS_ISSET_ID = 0;
+    private byte __isset_bitfield = 0;
     public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
     static {
       Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
       tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, 
-          new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
-              new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Partition.class))));
+          new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
       tmpMap.put(_Fields.O1, new org.apache.thrift.meta_data.FieldMetaData("o1", org.apache.thrift.TFieldRequirementType.DEFAULT, 
           new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT)));
       tmpMap.put(_Fields.O2, new org.apache.thrift.meta_data.FieldMetaData("o2", org.apache.thrift.TFieldRequirementType.DEFAULT, 
           new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT)));
       metaDataMap = Collections.unmodifiableMap(tmpMap);
-      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(get_partitions_by_names_result.class, metaDataMap);
+      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(get_num_partitions_by_filter_result.class, metaDataMap);
     }
 
-    public get_partitions_by_names_result() {
+    public get_num_partitions_by_filter_result() {
     }
 
-    public get_partitions_by_names_result(
-      List<Partition> success,
+    public get_num_partitions_by_filter_result(
+      int success,
       MetaException o1,
       NoSuchObjectException o2)
     {
       this();
       this.success = success;
+      setSuccessIsSet(true);
       this.o1 = o1;
       this.o2 = o2;
     }
@@ -88571,14 +88689,9 @@ public class ThriftHiveMetastore {
     /**
      * Performs a deep copy on <i>other</i>.
      */
-    public get_partitions_by_names_result(get_partitions_by_names_result other) {
-      if (other.isSetSuccess()) {
-        List<Partition> __this__success = new ArrayList<Partition>(other.success.size());
-        for (Partition other_element : other.success) {
-          __this__success.add(new Partition(other_element));
-        }
-        this.success = __this__success;
-      }
+    public get_num_partitions_by_filter_result(get_num_partitions_by_filter_result other) {
+      __isset_bitfield = other.__isset_bitfield;
+      this.success = other.success;
       if (other.isSetO1()) {
         this.o1 = new MetaException(other.o1);
       }
@@ -88587,53 +88700,38 @@ public class ThriftHiveMetastore {
       }
     }
 
-    public get_partitions_by_names_result deepCopy() {
-      return new get_partitions_by_names_result(this);
+    public get_num_partitions_by_filter_result deepCopy() {
+      return new get_num_partitions_by_filter_result(this);
     }
 
     @Override
     public void clear() {
-      this.success = null;
+      setSuccessIsSet(false);
+      this.success = 0;
       this.o1 = null;
       this.o2 = null;
     }
 
-    public int getSuccessSize() {
-      return (this.success == null) ? 0 : this.success.size();
-    }
-
-    public java.util.Iterator<Partition> getSuccessIterator() {
-      return (this.success == null) ? null : this.success.iterator();
-    }
-
-    public void addToSuccess(Partition elem) {
-      if (this.success == null) {
-        this.success = new ArrayList<Partition>();
-      }
-      this.success.add(elem);
-    }
-
-    public List<Partition> getSuccess() {
+    public int getSuccess() {
       return this.success;
     }
 
-    public void setSuccess(List<Partition> success) {
+    public void setSuccess(int success) {
       this.success = success;
+      setSuccessIsSet(true);
     }
 
     public void unsetSuccess() {
-      this.success = null;
+      __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __SUCCESS_ISSET_ID);
     }
 
     /** Returns true if field success is set (has been assigned a value) and false otherwise */
     public boolean isSetSuccess() {
-      return this.success != null;
+      return EncodingUtils.testBit(__isset_bitfield, __SUCCESS_ISSET_ID);
     }
 
     public void setSuccessIsSet(boolean value) {
-      if (!value) {
-        this.success = null;
-      }
+      __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __SUCCESS_ISSET_ID, value);
     }
 
     public MetaException getO1() {
@@ -88688,7 +88786,7 @@ public class ThriftHiveMetastore {
         if (value == null) {
           unsetSuccess();
         } else {
-          setSuccess((List<Partition>)value);
+          setSuccess((Integer)value);
         }
         break;
 
@@ -88747,21 +88845,21 @@ public class ThriftHiveMetastore {
     public boolean equals(Object that) {
       if (that == null)
         return false;
-      if (that instanceof get_partitions_by_names_result)
-        return this.equals((get_partitions_by_names_result)that);
+      if (that instanceof get_num_partitions_by_filter_result)
+        return this.equals((get_num_partitions_by_filter_result)that);
       return false;
     }
 
-    public boolean equals(get_partitions_by_names_result that) {
+    public boolean equals(get_num_partitions_by_filter_result that) {
       if (that == null)
         return false;
 
-      boolean this_present_success = true && this.isSetSuccess();
-      boolean that_present_success = true && that.isSetSuccess();
+      boolean this_present_success = true;
+      boolean that_present_success = true;
       if (this_present_success || that_present_success) {
         if (!(this_present_success && that_present_success))
           return false;
-        if (!this.success.equals(that.success))
+        if (this.success != that.success)
           return false;
       }
 
@@ -88790,7 +88888,7 @@ public class ThriftHiveMetastore {
     public int hashCode() {
       List<Object> list = new ArrayList<Object>();
 
-      boolean present_success = true && (isSetSuccess());
+      boolean present_success = true;
       list.add(present_success);
       if (present_success)
         list.add(success);
@@ -88809,7 +88907,7 @@ public class ThriftHiveMetastore {
     }
 
     @Override
-    public int compareTo(get_partitions_by_names_result other) {
+    public int compareTo(get_num_partitions_by_filter_result other) {
       if (!getClass().equals(other.getClass())) {
         return getClass().getName().compareTo(other.getClass().getName());
       }
@@ -88863,15 +88961,11 @@ public class ThriftHiveMetastore {
 
     @Override
     public String toString() {
-      StringBuilder sb = new StringBuilder("get_partitions_by_names_result(");
+      StringBuilder sb = new StringBuilder("get_num_partitions_by_filter_result(");
       boolean first = true;
 
       sb.append("success:");
-      if (this.success == null) {
-        sb.append("null");
-      } else {
-        sb.append(this.success);
-      }
+      sb.append(this.success);
       first = false;
       if (!first) sb.append(", ");
       sb.append("o1:");
@@ -88908,21 +89002,23 @@ public class ThriftHiveMetastore {
 
     private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
       try {
+        // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
+        __isset_bitfield = 0;
         read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
       } catch (org.apache.thrift.TException te) {
         throw new java.io.IOException(te);
       }
     }
 
-    private static class get_partitions_by_names_resultStandardSchemeFactory implements SchemeFactory {
-      public get_partitions_by_names_resultStandardScheme getScheme() {
-        return new get_partitions_by_names_resultStandardScheme();
+    private static class get_num_partitions_by_filter_resultStandardSchemeFactory implements SchemeFactory {
+      public get_num_partitions_by_filter_resultStandardScheme getScheme() {
+        return new get_num_partitions_by_filter_resultStandardScheme();
       }
     }
 
-    private static class get_partitions_by_names_resultStandardScheme extends StandardScheme<get_partitions_by_names_result> {
+    private static class get_num_partitions_by_filter_resultStandardScheme extends StandardScheme<get_num_partitions_by_filter_result> {
 
-      public void read(org.apache.thrift.protocol.TProtocol iprot, get_partitions_by_names_result struct) throws org.apache.thrift.TException {
+      public void read(org.apache.thrift.protocol.TProtocol iprot, get_num_partitions_by_filter_result struct) throws org.apache.thrift.TException {
         org.apache.thrift.protocol.TField schemeField;
         iprot.readStructBegin();
         while (true)
@@ -88933,19 +89029,8 @@ public class ThriftHiveMetastore {
           }
           switch (schemeField.id) {
             case 0: // SUCCESS
-              if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
-                {
-                  org.apache.thrift.protocol.TList _list926 = iprot.readListBegin();
-                  struct.success = new ArrayList<Partition>(_list926.size);
-                  Partition _elem927;
-                  for (int _i928 = 0; _i928 < _list926.size; ++_i928)
-                  {
-                    _elem927 = new Partition();
-                    _elem927.read(iprot);
-                    struct.success.add(_elem927);
-                  }
-                  iprot.readListEnd();
-                }
+              if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
+                struct.success = iprot.readI32();
                 struct.setSuccessIsSet(true);
               } else { 
                 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
@@ -88978,20 +89063,13 @@ public class ThriftHiveMetastore {
         struct.validate();
       }
 
-      public void write(org.apache.thrift.protocol.TProtocol oprot, get_partitions_by_names_result struct) throws org.apache.thrift.TException {
+      public void write(org.apache.thrift.protocol.TProtocol oprot, get_num_partitions_by_filter_result struct) throws org.apache.thrift.TException {
         struct.validate();
 
         oprot.writeStructBegin(STRUCT_DESC);
-        if (struct.success != null) {
+        if (struct.isSetSuccess()) {
           oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
-          {
-            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.success.size()));
-            for (Partition _iter929 : struct.success)
-            {
-              _iter929.write(oprot);
-            }
-            oprot.writeListEnd();
-          }
+          oprot.writeI32(struct.success);
           oprot.writeFieldEnd();
         }
         if (struct.o1 != null) {
@@ -89010,16 +89088,16 @@ public class ThriftHiveMetastore {
 
     }
 
-    private static class get_partitions_by_names_resultTupleSchemeFactory implements SchemeFactory {
-      public get_partitions_by_names_resultTupleScheme getScheme() {
-        return new get_partitions_by_names_resultTupleScheme();
+    private static class get_num_partitions_by_filter_resultTupleSchemeFactory implements SchemeFactory {
+      public get_num_partitions_by_filter_resultTupleScheme getScheme() {
+        return new get_num_partitions_by_filter_resultTupleScheme();
       }
     }
 
-    private static class get_partitions_by_names_resultTupleScheme extends TupleScheme<get_partitions_by_names_result> {
+    private static class get_num_partitions_by_filter_resultTupleScheme extends TupleScheme<get_num_partitions_by_filter_result> {
 
       @Override
-      public void write(org.apache.thrift.protocol.TProtocol prot, get_partitions_by_names_result struct) throws org.apache.thrift.TException {
+      public void write(org.apache.thrift.protocol.TProtocol prot, get_num_partitions_by_filter_result struct) throws org.apache.thrift.TException {
         TTupleProtocol oprot = (TTupleProtocol) prot;
         BitSet optionals = new BitSet();
         if (struct.isSetSuccess()) {
@@ -89033,13 +89111,7 @@ public class ThriftHiveMetastore {
         }
         oprot.writeBitSet(optionals, 3);
         if (struct.isSetSuccess()) {
-          {
-            oprot.writeI32(struct.success.size());
-            for (Partition _iter930 : struct.success)
-            {
-              _iter930.write(oprot);
-            }
-          }
+          oprot.writeI32(struct.success);
         }
         if (struct.isSetO1()) {
           struct.o1.write(oprot);
@@ -89050,21 +89122,11 @@ public class ThriftHiveMetastore {
       }
 
       @Override
-      public void read(org.apache.thrift.protocol.TProtocol prot, get_partitions_by_names_result struct) throws org.apache.thrift.TException {
+      public void read(org.apache.thrift.protocol.TProtocol prot, get_num_partitions_by_filter_result struct) throws org.apache.thrift.TException {
         TTupleProtocol iprot = (TTupleProtocol) prot;
         BitSet incoming = iprot.readBitSet(3);
         if (incoming.get(0)) {
-          {
-            org.apache.thrift.protocol.TList _list931 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
-            struct.success = new ArrayList<Partition>(_list931.size);
-            Partition _elem932;
-            for (int _i933 = 0; _i933 < _list931.size; ++_i933)
-            {
-              _elem932 = new Partition();
-              _elem932.read(iprot);
-              struct.success.add(_elem932);
-            }
-          }
+          struct.success = iprot.readI32();
           struct.setSuccessIsSet(true);
         }
         if (incoming.get(1)) {
@@ -89082,28 +89144,28 @@ public class ThriftHiveMetastore {
 
   }
 
-  public static class alter_partition_args implements org.apache.thrift.TBase<alter_partition_args, alter_partition_args._Fields>, java.io.Serializable, Cloneable, Comparable<alter_partition_args>   {
-    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("alter_partition_args");
+  public static class get_partitions_by_names_args implements org.apache.thrift.TBase<get_partitions_by_names_args, get_partitions_by_names_args._Fields>, java.io.Serializable, Cloneable, Comparable<get_partitions_by_names_args>   {
+    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("get_partitions_by_names_args");
 
     private static final org.apache.thrift.protocol.TField DB_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("db_name", org.apache.thrift.protocol.TType.STRING, (short)1);
     private static final org.apache.thrift.protocol.TField TBL_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("tbl_name", org.apache.thrift.protocol.TType.STRING, (short)2);
-    private static final org.apache.thrift.protocol.TField NEW_PART_FIELD_DESC = new org.apache.thrift.protocol.TField("new_part", org.apache.thrift.protocol.TType.STRUCT, (short)3);
+    private static final org.apache.thrift.protocol.TField NAMES_FIELD_DESC = new org.apache.thrift.protocol.TField("names", org.apache.thrift.protocol.TType.LIST, (short)3);
 
     private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
     static {
-      schemes.put(StandardScheme.class, new alter_partition_argsStandardSchemeFactory());
-      schemes.put(TupleScheme.class, new alter_partition_argsTupleSchemeFactory());
+      schemes.put(StandardScheme.class, new get_partitions_by_names_argsStandardSchemeFactory());
+      schemes.put(TupleScheme.class, new get_partitions_by_names_argsTupleSchemeFactory());
     }
 
     private String db_name; // required
     private String tbl_name; // required
-    private Partition new_part; // required
+    private List<String> names; // required
 
     /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
     public enum _Fields implements org.apache.thrift.TFieldIdEnum {
       DB_NAME((short)1, "db_name"),
       TBL_NAME((short)2, "tbl_name"),
-      NEW_PART((short)3, "new_part");
+      NAMES((short)3, "names");
 
       private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
 
@@ -89122,8 +89184,8 @@ public class ThriftHiveMetastore {
             return DB_NAME;
           case 2: // TBL_NAME
             return TBL_NAME;
-          case 3: // NEW_PART
-            return NEW_PART;
+          case 3: // NAMES
+            return NAMES;
           default:
             return null;
         }
@@ -89171,50 +89233,52 @@ public class ThriftHiveMetastore {
           new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
       tmpMap.put(_Fields.TBL_NAME, new org.apache.thrift.meta_data.FieldMetaData("tbl_name", org.apache.thrift.TFieldRequirementType.DEFAULT, 
           new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
-      tmpMap.put(_Fields.NEW_PART, new org.apache.thrift.meta_data.FieldMetaData("new_part", org.apache.thrift.TFieldRequirementType.DEFAULT, 
-          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Partition.class)));
+      tmpMap.put(_Fields.NAMES, new org.apache.thrift.meta_data.FieldMetaData("names", org.apache.thrift.TFieldRequirementType.DEFAULT, 
+          new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
+              new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
       metaDataMap = Collections.unmodifiableMap(tmpMap);
-      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(alter_partition_args.class, metaDataMap);
+      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(get_partitions_by_names_args.class, metaDataMap);
     }
 
-    public alter_partition_args() {
+    public get_partitions_by_names_args() {
     }
 
-    public alter_partition_args(
+    public get_partitions_by_names_args(
       String db_name,
       String tbl_name,
-      Partition new_part)
+      List<String> names)
     {
       this();
       this.db_name = db_name;
       this.tbl_name = tbl_name;
-      this.new_part = new_part;
+      this.names = names;
     }
 
     /**
      * Performs a deep copy on <i>other</i>.
      */
-    public alter_partition_args(alter_partition_args other) {
+    public get_partitions_by_names_args(get_partitions_by_names_args other) {
       if (other.isSetDb_name()) {
         this.db_name = other.db_name;
       }
       if (other.isSetTbl_name()) {
         this.tbl_name = other.tbl_name;
       }
-      if (other.isSetNew_part()) {
-        this.new_part = new Partition(other.new_part);
+      if (other.isSetNames()) {
+        List<String> __this__names = new ArrayList<String>(other.names);
+        this.names = __this__names;
       }
     }
 
-    public alter_partition_args deepCopy() {
-      return new alter_partition_args(this);
+    public get_partitions_by_names_args deepCopy() {
+      return new get_partitions_by_names_args(this);
     }
 
     @Override
     public void clear() {
       this.db_name = null;
       this.tbl_name = null;
-      this.new_part = null;
+      this.names = null;
     }
 
     public String getDb_name() {
@@ -89263,26 +89327,41 @@ public class ThriftHiveMetastore {
       }
     }
 
-    public Partition getNew_part() {
-      return this.new_part;
+    public int getNamesSize() {
+      return (this.names == null) ? 0 : this.names.size();
     }
 
-    public void setNew_part(Partition new_part) {
-      this.new_part = new_part;
+    public java.util.Iterator<String> getNamesIterator() {
+      return (this.names == null) ? null : this.names.iterator();
     }
 
-    public void unsetNew_part() {
-      this.new_part = null;
+    public void addToNames(String elem) {
+      if (this.names == null) {
+        this.names = new ArrayList<String>();
+      }
+      this.names.add(elem);
     }
 
-    /** Returns true if field new_part is set (has been assigned a value) and false otherwise */
-    public boolean isSetNew_part() {
-      return this.new_part != null;
+    public List<String> getNames() {
+      return this.names;
     }
 
-    public void setNew_partIsSet(boolean value) {
+    public void setNames(List<String> names) {
+      this.names = names;
+    }
+
+    public void unsetNames() {
+      this.names = null;
+    }
+
+    /** Returns true if field names is set (has been assigned a value) and false otherwise */
+    public boolean isSetNames() {
+      return this.names != null;
+    }
+
+    public void setNamesIsSet(boolean value) {
       if (!value) {
-        this.new_part = null;
+        this.names = null;
       }
     }
 
@@ -89304,11 +89383,11 @@ public class ThriftHiveMetastore {
         }
         break;
 
-      case NEW_PART:
+      case NAMES:
         if (value == null) {
-          unsetNew_part();
+          unsetNames();
         } else {
-          setNew_part((Partition)value);
+          setNames((List<String>)value);
         }
         break;
 
@@ -89323,8 +89402,8 @@ public class ThriftHiveMetastore {
       case TBL_NAME:
         return getTbl_name();
 
-      case NEW_PART:
-        return getNew_part();
+      case NAMES:
+        return getNames();
 
       }
       throw new IllegalStateException();
@@ -89341,8 +89420,8 @@ public class ThriftHiveMetastore {
         return isSetDb_name();
       case TBL_NAME:
         return isSetTbl_name();
-      case NEW_PART:
-        return isSetNew_part();
+      case NAMES:
+        return isSetNames();
       }
       throw new IllegalStateException();
     }
@@ -89351,12 +89430,12 @@ public class ThriftHiveMetastore {
     public boolean equals(Object that) {
       if (that == null)
         return false;
-      if (that instanceof alter_partition_args)
-        return this.equals((alter_partition_args)that);
+      if (that instanceof get_partitions_by_names_args)
+        return this.equals((get_partitions_by_names_args)that);
       return false;
     }
 
-    public boolean equals(alter_partition_args that) {
+    public boolean equals(get_partitions_by_names_args that) {
       if (that == null)
         return false;
 
@@ -89378,12 +89457,12 @@ public class ThriftHiveMetastore {
           return false;
       }
 
-      boolean this_present_new_part = true && this.isSetNew_part();
-      boolean that_present_new_part = true && that.isSetNew_part();
-      if (this_present_new_part || that_present_new_part) {
-        if (!(this_present_new_part && that_present_new_part))
+      boolean this_present_names = true && this.isSetNames();
+      boolean that_present_names = true && that.isSetNames();
+      if (this_present_names || that_present_names) {
+        if (!(this_present_names && that_present_names))
           return false;
-        if (!this.new_part.equals(that.new_part))
+        if (!this.names.equals(that.names))
           return false;
       }
 
@@ -89404,16 +89483,16 @@ public class ThriftHiveMetastore {
       if (present_tbl_name)
         list.add(tbl_name);
 
-      boolean present_new_part = true && (isSetNew_part());
-      list.add(present_new_part);
-      if (present_new_part)
-        list.add(new_part);
+      boolean present_names = true && (isSetNames());
+      list.add(present_names);
+      if (present_names)
+        list.add(names);
 
       return list.hashCode();
     }
 
     @Override
-    public int compareTo(alter_partition_args other) {
+    public int compareTo(get_partitions_by_names_args other) {
       if (!getClass().equals(other.getClass())) {
         return getClass().getName().compareTo(other.getClass().getName());
       }
@@ -89440,12 +89519,12 @@ public class ThriftHiveMetastore {
           return lastComparison;
         }
       }
-      lastComparison = Boolean.valueOf(isSetNew_part()).compareTo(other.isSetNew_part());
+      lastComparison = Boolean.valueOf(isSetNames()).compareTo(other.isSetNames());
       if (lastComparison != 0) {
         return lastComparison;
       }
-      if (isSetNew_part()) {
-        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.new_part, other.new_part);
+      if (isSetNames()) {
+        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.names, other.names);
         if (lastComparison != 0) {
           return lastComparison;
         }
@@ -89467,7 +89546,7 @@ public class ThriftHiveMetastore {
 
     @Override
     public String toString() {
-      StringBuilder sb = new StringBuilder("alter_partition_args(");
+      StringBuilder sb = new StringBuilder("get_partitions_by_names_args(");
       boolean first = true;
 
       sb.append("db_name:");
@@ -89486,11 +89565,11 @@ public class ThriftHiveMetastore {
       }
       first = false;
       if (!first) sb.append(", ");
-      sb.append("new_part:");
-      if (this.new_part == null) {
+      sb.append("names:");
+      if (this.names == null) {
         sb.append("null");
       } else {
-        sb.append(this.new_part);
+        sb.append(this.names);
       }
       first = false;
       sb.append(")");
@@ -89500,9 +89579,6 @@ public class ThriftHiveMetastore {
     public void validate() throws org.apache.thrift.TException {
       // check for required fields
       // check for sub-struct validity
-      if (new_part != null) {
-        new_part.validate();
-      }
     }
 
     private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
@@ -89521,15 +89597,15 @@ public class ThriftHiveMetastore {
       }
     }
 
-    private static class alter_partition_argsStandardSchemeFactory implements SchemeFactory {
-      public alter_partition_argsStandardScheme getScheme() {
-        return new alter_partition_argsStandardScheme();
+    private static class get_partitions_by_names_argsStandardSchemeFactory implements SchemeFactory {
+      public get_partitions_by_names_argsStandardScheme getScheme() {
+        return new get_partitions_by_names_argsStandardScheme();
       }
     }
 
-    private static class alter_partition_argsStandardScheme extends StandardScheme<alter_partition_args> {
+    private static class get_partitions_by_names_argsStandardScheme extends StandardScheme<get_partitions_by_names_args> {
 
-      public void read(org.apache.thrift.protocol.TProtocol iprot, alter_partition_args struct) throws org.apache.thrift.TException {
+      public void read(org.apache.thrift.protocol.TProtocol iprot, get_partitions_by_names_args struct) throws org.apache.thrift.TException {
         org.apache.thrift.protocol.TField schemeField;
         iprot.readStructBegin();
         while (true)
@@ -89555,11 +89631,20 @@ public class ThriftHiveMetastore {
                 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
               }
               break;
-            case 3: // NEW_PART
-              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
-                struct.new_part = new Partition();
-                struct.new_part.read(iprot);
-                struct.setNew_partIsSet(true);
+            case 3: // NAMES
+              if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
+                {
+                  org.apache.thrift.protocol.TList _list918 = iprot.readListBegin();
+                  struct.names = new ArrayList<String>(_list918.size);
+                  String _elem919;
+                  for (int _i920 = 0; _i920 < _list918.size; ++_i920)
+                  {
+                    _elem919 = iprot.readString();
+                    struct.names.add(_elem919);
+                  }
+                  iprot.readListEnd();
+                }
+                struct.setNamesIsSet(true);
               } else { 
                 org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
               }
@@ -89573,7 +89658,7 @@ public class ThriftHiveMetastore {
         struct.validate();
       }
 
-      public void write(org.apache.thrift.protocol.TProtocol oprot, alter_partition_args struct) throws org.apache.thrift.TException {
+      public void write(org.apache.thrift.protocol.TProtocol oprot, get_partitions_by_names_args struct) throws org.apache.thrift.TException {
         struct.validate();
 
         oprot.writeStructBegin(STRUCT_DESC);
@@ -89587,9 +89672,16 @@ public class ThriftHiveMetastore {
           oprot.writeString(struct.tbl_name);
           oprot.writeFieldEnd();
         }
-        if (struct.new_part != null) {
-          oprot.writeFieldBegin(NEW_PART_FIELD_DESC);
-          struct.new_part.write(oprot);
+        if (struct.names != null) {
+          oprot.writeFieldBegin(NAMES_FIELD_DESC);
+          {
+            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.names.size()));
+            for (String _iter921 : struct.names)
+            {
+              oprot.writeString(_iter921);
+            }
+            oprot.writeListEnd();
+          }
           oprot.writeFieldEnd();
         }
         oprot.writeFieldStop();
@@ -89598,16 +89690,16 @@ public class ThriftHiveMetastore {
 
     }
 
-    private static class alter_partition_argsTupleSchemeFactory implements SchemeFactory {
-      public alter_partition_argsTupleScheme getScheme() {
-        return new alter_partition_argsTupleScheme();
+    private static class get_partitions_by_names_argsTupleSchemeFactory implements SchemeFactory {
+      public get_partitions_by_names_argsTupleScheme getScheme() {
+        return new get_partitions_by_names_argsTupleScheme();
       }
     }
 
-    private static class alter_partition_argsTupleScheme extends TupleScheme<alter_partition_args> {
+    private static class get_partitions_by_names_argsTupleScheme extends TupleScheme<get_partitions_by_names_args> {
 
       @Override
-      public void write(org.apache.thrift.protocol.TProtocol prot, alter_partition_args struct) throws org.apache.thrift.TException {
+      public void write(org.apache.thrift.protocol.TProtocol prot, get_partitions_by_names_args struct) throws org.apache.thrift.TException {
         TTupleProtocol oprot = (TTupleProtocol) prot;
         BitSet optionals = new BitSet();
         if (struct.isSetDb_name()) {
@@ -89616,7 +89708,7 @@ public class ThriftHiveMetastore {
         if (struct.isSetTbl_name()) {
           optionals.set(1);
         }
-        if (struct.isSetNew_part()) {
+        if (struct.isSetNames()) {
           optionals.set(2);
         }
         oprot.writeBitSet(optionals, 3);
@@ -89626,13 +89718,19 @@ public class ThriftHiveMetastore {
         if (struct.isSetTbl_name()) {
           oprot.writeString(struct.tbl_name);
         }
-        if (struct.isSetNew_part()) {
-          struct.new_part.write(oprot);
+        if (struct.isSetNames()) {
+          {
+            oprot.writeI32(struct.names.size());
+            for (String _iter922 : struct.names)
+            {
+              oprot.writeString(_iter922);
+            }
+          }
         }
       }
 
       @Override
-      public void read(org.apache.thrift.protocol.TProtocol prot, alter_partition_args struct) throws org.apache.thrift.TException {
+      public void read(org.apache.thrift.protocol.TProtocol prot, get_partitions_by_names_args struct) throws org.apache.thrift.TException {
         TTupleProtocol iprot = (TTupleProtocol) prot;
         BitSet incoming = iprot.readBitSet(3);
         if (incoming.get(0)) {
@@ -89644,32 +89742,43 @@ public class ThriftHiveMetastore {
           struct.setTbl_nameIsSet(true);
         }
         if (incoming.get(2)) {
-          struct.new_part = new Partition();
-          struct.new_part.read(iprot);
-          struct.setNew_partIsSet(true);
+          {
+            org.apache.thrift.protocol.TList _list923 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
+            struct.names = new ArrayList<String>(_list923.size);
+            String _elem924;
+            for (int _i925 = 0; _i925 < _list923.size; ++_i925)
+            {
+              _elem924 = iprot.readString();
+              struct.names.add(_elem924);
+            }
+          }
+          struct.setNamesIsSet(true);
         }
       }
     }
 
   }
 
-  public static class alter_partition_result implements org.apache.thrift.TBase<alter_partition_result, alter_partition_result._Fields>, java.io.Serializable, Cloneable, Comparable<alter_partition_result>   {
-    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("alter_partition_result");
+  public static class get_partitions_by_names_result implements org.apache.thrift.TBase<get_partitions_by_names_result, get_partitions_by_names_result._Fields>, java.io.Serializable, Cloneable, Comparable<get_partitions_by_names_result>   {
+    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("get_partitions_by_names_result");
 
+    private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.LIST, (short)0);
     private static final org.apache.thrift.protocol.TField O1_FIELD_DESC = new org.apache.thrift.protocol.TField("o1", org.apache.thrift.protocol.TType.STRUCT, (short)1);
     private static final org.apache.thrift.protocol.TField O2_FIELD_DESC = new org.apache.thrift.protocol.TField("o2", org.apache.thrift.protocol.TType.STRUCT, (short)2);
 
     private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
     static {
-      schemes.put(StandardScheme.class, new alter_partition_resultStandardSchemeFactory());
-      schemes.put(TupleScheme.class, new alter_partition_resultTupleSchemeFactory());
+      schemes.put(StandardScheme.class, new get_partitions_by_names_resultStandardSchemeFactory());
+      schemes.put(TupleScheme.class, new get_partitions_by_names_resultTupleSchemeFactory());
     }
 
-    private InvalidOperationException o1; // required
-    private MetaException o2; // required
+    private List<Partition> success; // required
+    private MetaException o1; // required
+    private NoSuchObjectException o2; // required
 
     /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
     public enum _Fields implements org.apache.thrift.TFieldIdEnum {
+      SUCCESS((short)0, "success"),
       O1((short)1, "o1"),
       O2((short)2, "o2");
 
@@ -89686,6 +89795,8 @@ public class ThriftHiveMetastore {
        */
       public static _Fields findByThriftId(int fieldId) {
         switch(fieldId) {
+          case 0: // SUCCESS
+            return SUCCESS;
           case 1: // O1
             return O1;
           case 2: // O2
@@ -89733,22 +89844,27 @@ public class ThriftHiveMetastore {
     public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
     static {
       Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+      tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, 
+          new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
+              new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Partition.class))));
       tmpMap.put(_Fields.O1, new org.apache.thrift.meta_data.FieldMetaData("o1", org.apache.thrift.TFieldRequirementType.DEFAULT, 
           new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT)));
       tmpMap.put(_Fields.O2, new org.apache.thrift.meta_data.FieldMetaData("o2", org.apache.thrift.TFieldRequirementType.DEFAULT, 
           new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT)));
       metaDataMap = Collections.unmodifiableMap(tmpMap);
-      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(alter_partition_result.class, metaDataMap);
+      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(get_partitions_by_names_result.class, metaDataMap);
     }
 
-    public alter_partition_result() {
+    public get_partitions_by_names_result() {
     }
 
-    public alter_partition_result(
-      InvalidOperationException o1,
-      MetaException o2)
+    public get_partitions_by_names_result(
+      List<Partition> success,
+      MetaException o1,
+      NoSuchObjectException o2)
     {
       this();
+      this.success = success;
       this.o1 = o1;
       this.o2 = o2;
     }
@@ -89756,30 +89872,76 @@ public class ThriftHiveMetastore {
     /**
      * Performs a deep copy on <i>other</i>.
      */
-    public alter_partition_result(alter_partition_result other) {
+    public get_partitions_by_names_result(get_partitions_by_names_result other) {
+      if (other.isSetSuccess()) {
+        List<Partition> __this__success = new ArrayList<Partition>(other.success.size());
+        for (Partition other_element : other.success) {
+          __this__success.add(new Partition(other_element));
+        }
+        this.success = __this__success;
+      }
       if (other.isSetO1()) {
-        this.o1 = new InvalidOperationException(other.o1);
+        this.o1 = new MetaException(other.o1);
       }
       if (other.isSetO2()) {
-        this.o2 = new MetaException(other.o2);
+        this.o2 = new NoSuchObjectException(other.o2);
       }
     }
 
-    public alter_partition_result deepCopy() {
-      return new alter_partition_result(this);
+    public get_partitions_by_names_result deepCopy() {
+      return new get_partitions_by_names_result(this);
     }
 
     @Override
     public void clear() {
+      this.success = null;
       this.o1 = null;
       this.o2 = null;
     }
 
-    public InvalidOperationException getO1() {
+    public int getSuccessSize() {
+      return (this.success == null) ? 0 : this.success.size();
+    }
+
+    public java.util.Iterator<Partition> getSuccessIterator() {
+      return (this.success == null) ? null : this.success.iterator();
+    }
+
+    public void addToSuccess(Partition elem) {
+      if (this.success == null) {
+        this.success = new ArrayList<Partition>();
+      }
+      this.success.add(elem);
+    }
+
+    public List<Partition> getSuccess() {
+      return this.success;
+    }
+
+    public void setSuccess(List<Partition> success) {
+      this.success = success;
+    }
+
+    public void unsetSuccess() {
+      this.success = null;
+    }
+
+    /** Returns true if field success is set (has been assigned a value) and false otherwise */
+    public boolean isSetSuccess() {
+      return this.success != null;
+    }
+
+    public void setSuccessIsSet(boolean value) {
+      if (!value) {
+        this.success = null;
+      }
+    }
+
+    public MetaException getO1() {
       return this.o1;
     }
 
-    public void setO1(InvalidOperationException o1) {
+    public void setO1(MetaException o1) {
       this.o1 = o1;
     }
 
@@ -89798,11 +89960,11 @@ public class ThriftHiveMetastore {
       }
     }
 
-    public MetaException getO2() {
+    public NoSuchObjectException getO2() {
       return this.o2;
     }
 
-    public void setO2(MetaException o2) {
+    public void setO2(NoSuchObjectException o2) {
       this.o2 = o2;
     }
 
@@ -89823,11 +89985,19 @@ public class ThriftHiveMetastore {
 
     public void setFieldValue(_Fields field, Object value) {
       switch (field) {
+      case SUCCESS:
+        if (value == null) {
+          unsetSuccess();
+        } else {
+          setSuccess((List<Partition>)value);
+        }
+        break;
+
       case O1:
         if (value == null) {
           unsetO1();
         } else {
-          setO1((InvalidOperationException)value);
+          setO1((MetaException)value);
         }
         break;
 
@@ -89835,7 +90005,7 @@ public class ThriftHiveMetastore {
         if (value == null) {
           unsetO2();
         } else {
-          setO2((MetaException)value);
+          setO2((NoSuchObjectException)value);
         }
         break;
 
@@ -89844,6 +90014,9 @@ public class ThriftHiveMetastore {
 
     public Object getFieldValue(_Fields field) {
       switch (field) {
+      case SUCCESS:
+        return getSuccess();
+
       case O1:
         return getO1();
 
@@ -89861,6 +90034,8 @@ public class ThriftHiveMetastore {
       }
 
       switch (field) {
+      case SUCCESS:
+        return isSetSuccess();
       case O1:
         return isSetO1();
       case O2:
@@ -89873,15 +90048,24 @@ public class ThriftHiveMetastore {
     public boolean equals(Object that) {
       if (that == null)
         return false;
-      if (that instanceof alter_partition_result)
-        return this.equals((alter_partition_result)that);
+      if (that instanceof get_partitions_by_names_result)
+        return this.equals((get_partitions_by_names_result)that);
       return false;
     }
 
-    public boolean equals(alter_partition_result that) {
+    public boolean equals(get_partitions_by_names_result that) {
       if (that == null)
         return false;
 
+      boolean this_present_success = true && this.isSetSuccess();
+      boolean that_present_success = true && that.isSetSuccess();
+      if (this_present_success || that_present_success) {
+        if (!(this_present_success && that_present_success))
+          return false;
+        if (!this.success.equals(that.success))
+          return false;
+      }
+
       boolean this_present_o1 = true && this.isSetO1();
       boolean that_present_o1 = true && that.isSetO1();
       if (this_present_o1 || that_present_o1) {
@@ -89907,6 +90091,11 @@ public class ThriftHiveMetastore {
     public int hashCode() {
       List<Object> list = new ArrayList<Object>();
 
+      boolean present_success = true && (isSetSuccess());
+      list.add(present_success);
+      if (present_success)
+        list.add(success);
+
       boolean present_o1 = true && (isSetO1());
       list.add(present_o1);
       if (present_o1)
@@ -89921,13 +90110,23 @@ public class ThriftHiveMetastore {
     }
 
     @Override
-    public int compareTo(alter_partition_result other) {
+    public int compareTo(get_partitions_by_names_result other) {
       if (!getClass().equals(other.getClass())) {
         return getClass().getName().compareTo(other.getClass().getName());
       }
 
       int lastComparison = 0;
 
+      lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess());
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+      if (isSetSuccess()) {
+        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success);
+        if (lastComparison != 0) {
+          return lastComparison;
+        }
+      }
       lastComparison = Boolean.valueOf(isSetO1()).compareTo(other.isSetO1());
       if (lastComparison != 0) {
         return lastComparison;
@@ -89965,9 +90164,17 @@ public class ThriftHiveMetastore {
 
     @Override
     public String toString() {
-      StringBuilder sb = new StringBuilder("alter_partition_result(");
+      StringBuilder sb = new StringBuilder("get_partitions_by_names_result(");
       boolean first = true;
 
+      sb.append("success:");
+      if (this.success == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.success);
+      }
+      first = false;
+      if (!first) sb.append(", ");
       sb.append("o1:");
       if (this.o1 == null) {
         sb.append("null");
@@ -90008,15 +90215,15 @@ public class ThriftHiveMetastore {
       }
     }
 
-    private static class alter_partition_resultStandardSchemeFactory implements SchemeFactory {
-      public alter_partition_resultStandardScheme getScheme() {
-        return new alter_partition_resultStandardScheme();
+    private static class get_partitions_by_names_resultStandardSchemeFactory implements SchemeFactory {
+      public get_partitions_by_names_resultStandardScheme getScheme() {
+        return new get_partitions_by_names_resultStandardScheme();
       }
     }
 
-    private static class alter_partition_resultStandardScheme extends StandardScheme<alter_partition_result> {
+    private static class get_partitions_by_names_resultStandardScheme extends StandardScheme<get_partitions_by_names_result> {
 
-      public void read(org.apache.thrift.protocol.TProtocol iprot, alter_partition_result struct) throws org.apache.thrift.TException {
+      public void read(org.apache.thrift.protocol.TProtocol iprot, get_partitions_by_names_result struct) throws org.apache.thrift.TException {
         org.apache.thrift.protocol.TField schemeField;
         iprot.readStructBegin();
         while (true)
@@ -90026,9 +90233,28 @@ public class ThriftHiveMetastore {
             break;
           }
           switch (schemeField.id) {
+            case 0: // SUCCESS
+              if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
+                {
+                  org.apache.thrift.protocol.TList _list926 = iprot.readListBegin();
+                  struct.success = new ArrayList<Partition>(_list926.size);
+                  Partition _elem927;
+                  for (int _i928 = 0; _i928 < _list926.size; ++_i928)
+                  {
+                    _elem927 = new Partition();
+                    _elem927.read(iprot);
+                    struct.success.add(_elem927);
+                  }
+                  iprot.readListEnd();
+                }
+                struct.setSuccessIsSet(true);
+              } else { 
+                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+              }
+              break;
             case 1: // O1
               if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
-                struct.o1 = new InvalidOperationException();
+                struct.o1 = new MetaException();
                 struct.o1.read(iprot);
                 struct.setO1IsSet(true);
               } else { 
@@ -90037,7 +90263,7 @@ public class ThriftHiveMetastore {
               break;
             case 2: // O2
               if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
-                struct.o2 = new MetaException();
+                struct.o2 = new NoSuchObjectException();
                 struct.o2.read(iprot);
                 struct.setO2IsSet(true);
               } else { 
@@ -90053,10 +90279,22 @@ public class ThriftHiveMetastore {
         struct.validate();
       }
 
-      public void write(org.apache.thrift.protocol.TProtocol oprot, alter_partition_result struct) throws org.apache.thrift.TException {
+      public void write(org.apache.thrift.protocol.TProtocol oprot, get_partitions_by_names_result struct) throws org.apache.thrift.TException {
         struct.validate();
 
         oprot.writeStructBegin(STRUCT_DESC);
+        if (struct.success != null) {
+          oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
+          {
+            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.success.size()));
+            for (Partition _iter929 : struct.success)
+            {
+              _iter929.write(oprot);
+            }
+            oprot.writeListEnd();
+          }
+          oprot.writeFieldEnd();
+        }
         if (struct.o1 != null) {
           oprot.writeFieldBegin(O1_FIELD_DESC);
           struct.o1.write(oprot);
@@ -90073,25 +90311,37 @@ public class ThriftHiveMetastore {
 
     }
 
-    private static class alter_partition_resultTupleSchemeFactory implements SchemeFactory {
-      public alter_partition_resultTupleScheme getScheme() {
-        return new alter_partition_resultTupleScheme();
+    private static class get_partitions_by_names_resultTupleSchemeFactory implements SchemeFactory {
+      public get_partitions_by_names_resultTupleScheme getScheme() {
+        return new get_partitions_by_names_resultTupleScheme();
       }
     }
 
-    private static class alter_partition_resultTupleScheme extends TupleScheme<alter_partition_result> {
+    private static class get_partitions_by_names_resultTupleScheme extends TupleScheme<get_partitions_by_names_result> {
 
       @Override
-      public void write(org.apache.thrift.protocol.TProtocol prot, alter_partition_result struct) throws org.apache.thrift.TException {
+      public void write(org.apache.thrift.protocol.TProtocol prot, get_partitions_by_names_result struct) throws org.apache.thrift.TException {
         TTupleProtocol oprot = (TTupleProtocol) prot;
         BitSet optionals = new BitSet();
-        if (struct.isSetO1()) {
+        if (struct.isSetSuccess()) {
           optionals.set(0);
         }
-        if (struct.isSetO2()) {
+        if (struct.isSetO1()) {
           optionals.set(1);
         }
-        oprot.writeBitSet(optionals, 2);
+        if (struct.isSetO2()) {
+          optionals.set(2);
+        }
+        oprot.writeBitSet(optionals, 3);
+        if (struct.isSetSuccess()) {
+          {
+            oprot.writeI32(struct.success.size());
+            for (Partition _iter930 : struct.success)
+            {
+              _iter930.write(oprot);
+            }
+          }
+        }
         if (struct.isSetO1()) {
           struct.o1.write(oprot);
         }
@@ -90101,16 +90351,30 @@ public class ThriftHiveMetastore {
       }
 
       @Override
-      public void read(org.apache.thrift.protocol.TProtocol prot, alter_partition_result struct) throws org.apache.thrift.TException {
+      public void read(org.apache.thrift.protocol.TProtocol prot, get_partitions_by_names_result struct) throws org.apache.thrift.TException {
         TTupleProtocol iprot = (TTupleProtocol) prot;
-        BitSet incoming = iprot.readBitSet(2);
+        BitSet incoming = iprot.readBitSet(3);
         if (incoming.get(0)) {
-          struct.o1 = new InvalidOperationException();
+          {
+            org.apache.thrift.protocol.TList _list931 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
+            struct.success = new ArrayList<Partition>(_list931.size);
+            Partition _elem932;
+            for (int _i933 = 0; _i933 < _list931.size; ++_i933)
+            {
+              _elem932 = new Partition();
+              _elem932.read(iprot);
+              struct.success.add(_elem932);
+            }
+          }
+          struct.setSuccessIsSet(true);
+        }
+        if (incoming.get(1)) {
+          struct.o1 = new MetaException();
           struct.o1.read(iprot);
           struct.setO1IsSet(true);
         }
-        if (incoming.get(1)) {
-          struct.o2 = new MetaException();
+        if (incoming.get(2)) {
+          struct.o2 = new NoSuchObjectException();
           struct.o2.read(iprot);
           struct.setO2IsSet(true);
         }
@@ -90119,28 +90383,28 @@ public class ThriftHiveMetastore {
 
   }
 
-  public static class alter_partitions_args implements org.apache.thrift.TBase<alter_partitions_args, alter_partitions_args._Fields>, java.io.Serializable, Cloneable, Comparable<alter_partitions_args>   {
-    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("alter_partitions_args");
+  public static class alter_partition_args implements org.apache.thrift.TBase<alter_partition_args, alter_partition_args._Fields>, java.io.Serializable, Cloneable, Comparable<alter_partition_args>   {
+    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("alter_partition_args");
 
     private static final org.apache.thrift.protocol.TField DB_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("db_name", org.apache.thrift.protocol.TType.STRING, (short)1);
     private static final org.apache.thrift.protocol.TField TBL_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("tbl_name", org.apache.thrift.protocol.TType.STRING, (short)2);
-    private static final org.apache.thrift.protocol.TField NEW_PARTS_FIELD_DESC = new org.apache.thrift.protocol.TField("new_parts", org.apache.thrift.protocol.TType.LIST, (short)3);
+    private static final org.apache.thrift.protocol.TField NEW_PART_FIELD_DESC = new org.apache.thrift.protocol.TField("new_part", org.apache.thrift.protocol.TType.STRUCT, (short)3);
 
     private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
     static {
-      schemes.put(StandardScheme.class, new alter_partitions_argsStandardSchemeFactory());
-      schemes.put(TupleScheme.class, new alter_partitions_argsTupleSchemeFactory());
+      schemes.put(StandardScheme.class, new alter_partition_argsStandardSchemeFactory());
+      schemes.put(TupleScheme.class, new alter_partition_argsTupleSchemeFactory());
     }
 
     private String db_name; // required
     private String tbl_name; // required
-    private List<Partition> new_parts; // required
+    private Partition new_part; // required
 
     /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
     public enum _Fields implements org.apache.thrift.TFieldIdEnum {
       DB_NAME((short)1, "db_name"),
       TBL_NAME((short)2, "tbl_name"),
-      NEW_PARTS((short)3, "new_parts");
+      NEW_PART((short)3, "new_part");
 
       private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
 
@@ -90159,8 +90423,8 @@ public class ThriftHiveMetastore {
             return DB_NAME;
           case 2: // TBL_NAME
             return TBL_NAME;
-          case 3: // NEW_PARTS
-            return NEW_PARTS;
+          case 3: // NEW_PART
+            return NEW_PART;
           default:
             return null;
         }
@@ -90208,55 +90472,50 @@ public class ThriftHiveMetastore {
           new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
       tmpMap.put(_Fields.TBL_NAME, new org.apache.thrift.meta_data.FieldMetaData("tbl_name", org.apache.thrift.TFieldRequirementType.DEFAULT, 
           new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
-      tmpMap.put

<TRUNCATED>

[3/3] hive git commit: HIVE-11487 : Adds getNumPartitionsByFilter api in metastore api

Posted by am...@apache.org.
HIVE-11487 : Adds getNumPartitionsByFilter api in metastore api


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/cdcc35e6
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/cdcc35e6
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/cdcc35e6

Branch: refs/heads/master
Commit: cdcc35e61f42a9a63a6b6c5d717043ae83fc44a4
Parents: a60fec2
Author: Akshay Goyal <ak...@gmail.com>
Authored: Tue Dec 22 10:05:22 2015 +0530
Committer: Amareshwari Sriramadasu <am...@apache.org>
Committed: Tue Dec 22 10:05:22 2015 +0530

----------------------------------------------------------------------
 metastore/if/hive_metastore.thrift              |    4 +
 .../gen/thrift/gen-cpp/ThriftHiveMetastore.cpp  |  479 +++
 .../gen/thrift/gen-cpp/ThriftHiveMetastore.h    |  156 +
 .../ThriftHiveMetastore_server.skeleton.cpp     |    5 +
 .../metastore/api/CacheFileMetadataRequest.java |   19 +-
 .../metastore/api/CacheFileMetadataResult.java  |    7 +-
 .../metastore/api/FileMetadataExprType.java     |    4 +
 .../metastore/api/PutFileMetadataRequest.java   |   10 +-
 .../hive/metastore/api/ThriftHiveMetastore.java | 3379 ++++++++++++------
 .../gen-php/metastore/ThriftHiveMetastore.php   |  315 ++
 .../hive_metastore/ThriftHiveMetastore-remote   |    7 +
 .../hive_metastore/ThriftHiveMetastore.py       |  257 ++
 .../gen/thrift/gen-rb/thrift_hive_metastore.rb  |   70 +
 .../hadoop/hive/metastore/HiveMetaStore.java    |   19 +
 .../hive/metastore/HiveMetaStoreClient.java     |   19 +-
 .../hadoop/hive/metastore/IMetaStoreClient.java |   16 +
 .../hive/metastore/MetaStoreDirectSql.java      |   47 +
 .../hadoop/hive/metastore/ObjectStore.java      |   37 +
 .../apache/hadoop/hive/metastore/RawStore.java  |    3 +
 .../hadoop/hive/metastore/hbase/HBaseStore.java |   15 +
 .../DummyRawStoreControlledCommit.java          |    6 +
 .../DummyRawStoreForJdoConnection.java          |    6 +
 .../hadoop/hive/metastore/TestObjectStore.java  |   11 +-
 .../apache/hadoop/hive/ql/metadata/Hive.java    |   24 +
 .../gen-py/hive_service/ThriftHive-remote       |    7 +
 25 files changed, 3863 insertions(+), 1059 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/cdcc35e6/metastore/if/hive_metastore.thrift
----------------------------------------------------------------------
diff --git a/metastore/if/hive_metastore.thrift b/metastore/if/hive_metastore.thrift
index e6403ed..56ec9aa 100755
--- a/metastore/if/hive_metastore.thrift
+++ b/metastore/if/hive_metastore.thrift
@@ -1067,6 +1067,10 @@ service ThriftHiveMetastore extends fb303.FacebookService
   PartitionsByExprResult get_partitions_by_expr(1:PartitionsByExprRequest req)
                        throws(1:MetaException o1, 2:NoSuchObjectException o2)
 
+  // get the partitions matching the given partition filter
+  i32 get_num_partitions_by_filter(1:string db_name 2:string tbl_name 3:string filter)
+                       throws(1:MetaException o1, 2:NoSuchObjectException o2)
+
   // get partitions give a list of partition names
   list<Partition> get_partitions_by_names(1:string db_name 2:string tbl_name 3:list<string> names)
                        throws(1:MetaException o1, 2:NoSuchObjectException o2)

http://git-wip-us.apache.org/repos/asf/hive/blob/cdcc35e6/metastore/src/gen/thrift/gen-cpp/ThriftHiveMetastore.cpp
----------------------------------------------------------------------
diff --git a/metastore/src/gen/thrift/gen-cpp/ThriftHiveMetastore.cpp b/metastore/src/gen/thrift/gen-cpp/ThriftHiveMetastore.cpp
index 22bea87..7c530b2 100644
--- a/metastore/src/gen/thrift/gen-cpp/ThriftHiveMetastore.cpp
+++ b/metastore/src/gen/thrift/gen-cpp/ThriftHiveMetastore.cpp
@@ -16083,6 +16083,265 @@ uint32_t ThriftHiveMetastore_get_partitions_by_expr_presult::read(::apache::thri
 }
 
 
+ThriftHiveMetastore_get_num_partitions_by_filter_args::~ThriftHiveMetastore_get_num_partitions_by_filter_args() throw() {
+}
+
+
+uint32_t ThriftHiveMetastore_get_num_partitions_by_filter_args::read(::apache::thrift::protocol::TProtocol* iprot) {
+
+  apache::thrift::protocol::TInputRecursionTracker tracker(*iprot);
+  uint32_t xfer = 0;
+  std::string fname;
+  ::apache::thrift::protocol::TType ftype;
+  int16_t fid;
+
+  xfer += iprot->readStructBegin(fname);
+
+  using ::apache::thrift::protocol::TProtocolException;
+
+
+  while (true)
+  {
+    xfer += iprot->readFieldBegin(fname, ftype, fid);
+    if (ftype == ::apache::thrift::protocol::T_STOP) {
+      break;
+    }
+    switch (fid)
+    {
+      case 1:
+        if (ftype == ::apache::thrift::protocol::T_STRING) {
+          xfer += iprot->readString(this->db_name);
+          this->__isset.db_name = true;
+        } else {
+          xfer += iprot->skip(ftype);
+        }
+        break;
+      case 2:
+        if (ftype == ::apache::thrift::protocol::T_STRING) {
+          xfer += iprot->readString(this->tbl_name);
+          this->__isset.tbl_name = true;
+        } else {
+          xfer += iprot->skip(ftype);
+        }
+        break;
+      case 3:
+        if (ftype == ::apache::thrift::protocol::T_STRING) {
+          xfer += iprot->readString(this->filter);
+          this->__isset.filter = true;
+        } else {
+          xfer += iprot->skip(ftype);
+        }
+        break;
+      default:
+        xfer += iprot->skip(ftype);
+        break;
+    }
+    xfer += iprot->readFieldEnd();
+  }
+
+  xfer += iprot->readStructEnd();
+
+  return xfer;
+}
+
+uint32_t ThriftHiveMetastore_get_num_partitions_by_filter_args::write(::apache::thrift::protocol::TProtocol* oprot) const {
+  uint32_t xfer = 0;
+  apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot);
+  xfer += oprot->writeStructBegin("ThriftHiveMetastore_get_num_partitions_by_filter_args");
+
+  xfer += oprot->writeFieldBegin("db_name", ::apache::thrift::protocol::T_STRING, 1);
+  xfer += oprot->writeString(this->db_name);
+  xfer += oprot->writeFieldEnd();
+
+  xfer += oprot->writeFieldBegin("tbl_name", ::apache::thrift::protocol::T_STRING, 2);
+  xfer += oprot->writeString(this->tbl_name);
+  xfer += oprot->writeFieldEnd();
+
+  xfer += oprot->writeFieldBegin("filter", ::apache::thrift::protocol::T_STRING, 3);
+  xfer += oprot->writeString(this->filter);
+  xfer += oprot->writeFieldEnd();
+
+  xfer += oprot->writeFieldStop();
+  xfer += oprot->writeStructEnd();
+  return xfer;
+}
+
+
+ThriftHiveMetastore_get_num_partitions_by_filter_pargs::~ThriftHiveMetastore_get_num_partitions_by_filter_pargs() throw() {
+}
+
+
+uint32_t ThriftHiveMetastore_get_num_partitions_by_filter_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const {
+  uint32_t xfer = 0;
+  apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot);
+  xfer += oprot->writeStructBegin("ThriftHiveMetastore_get_num_partitions_by_filter_pargs");
+
+  xfer += oprot->writeFieldBegin("db_name", ::apache::thrift::protocol::T_STRING, 1);
+  xfer += oprot->writeString((*(this->db_name)));
+  xfer += oprot->writeFieldEnd();
+
+  xfer += oprot->writeFieldBegin("tbl_name", ::apache::thrift::protocol::T_STRING, 2);
+  xfer += oprot->writeString((*(this->tbl_name)));
+  xfer += oprot->writeFieldEnd();
+
+  xfer += oprot->writeFieldBegin("filter", ::apache::thrift::protocol::T_STRING, 3);
+  xfer += oprot->writeString((*(this->filter)));
+  xfer += oprot->writeFieldEnd();
+
+  xfer += oprot->writeFieldStop();
+  xfer += oprot->writeStructEnd();
+  return xfer;
+}
+
+
+ThriftHiveMetastore_get_num_partitions_by_filter_result::~ThriftHiveMetastore_get_num_partitions_by_filter_result() throw() {
+}
+
+
+uint32_t ThriftHiveMetastore_get_num_partitions_by_filter_result::read(::apache::thrift::protocol::TProtocol* iprot) {
+
+  apache::thrift::protocol::TInputRecursionTracker tracker(*iprot);
+  uint32_t xfer = 0;
+  std::string fname;
+  ::apache::thrift::protocol::TType ftype;
+  int16_t fid;
+
+  xfer += iprot->readStructBegin(fname);
+
+  using ::apache::thrift::protocol::TProtocolException;
+
+
+  while (true)
+  {
+    xfer += iprot->readFieldBegin(fname, ftype, fid);
+    if (ftype == ::apache::thrift::protocol::T_STOP) {
+      break;
+    }
+    switch (fid)
+    {
+      case 0:
+        if (ftype == ::apache::thrift::protocol::T_I32) {
+          xfer += iprot->readI32(this->success);
+          this->__isset.success = true;
+        } else {
+          xfer += iprot->skip(ftype);
+        }
+        break;
+      case 1:
+        if (ftype == ::apache::thrift::protocol::T_STRUCT) {
+          xfer += this->o1.read(iprot);
+          this->__isset.o1 = true;
+        } else {
+          xfer += iprot->skip(ftype);
+        }
+        break;
+      case 2:
+        if (ftype == ::apache::thrift::protocol::T_STRUCT) {
+          xfer += this->o2.read(iprot);
+          this->__isset.o2 = true;
+        } else {
+          xfer += iprot->skip(ftype);
+        }
+        break;
+      default:
+        xfer += iprot->skip(ftype);
+        break;
+    }
+    xfer += iprot->readFieldEnd();
+  }
+
+  xfer += iprot->readStructEnd();
+
+  return xfer;
+}
+
+uint32_t ThriftHiveMetastore_get_num_partitions_by_filter_result::write(::apache::thrift::protocol::TProtocol* oprot) const {
+
+  uint32_t xfer = 0;
+
+  xfer += oprot->writeStructBegin("ThriftHiveMetastore_get_num_partitions_by_filter_result");
+
+  if (this->__isset.success) {
+    xfer += oprot->writeFieldBegin("success", ::apache::thrift::protocol::T_I32, 0);
+    xfer += oprot->writeI32(this->success);
+    xfer += oprot->writeFieldEnd();
+  } else if (this->__isset.o1) {
+    xfer += oprot->writeFieldBegin("o1", ::apache::thrift::protocol::T_STRUCT, 1);
+    xfer += this->o1.write(oprot);
+    xfer += oprot->writeFieldEnd();
+  } else if (this->__isset.o2) {
+    xfer += oprot->writeFieldBegin("o2", ::apache::thrift::protocol::T_STRUCT, 2);
+    xfer += this->o2.write(oprot);
+    xfer += oprot->writeFieldEnd();
+  }
+  xfer += oprot->writeFieldStop();
+  xfer += oprot->writeStructEnd();
+  return xfer;
+}
+
+
+ThriftHiveMetastore_get_num_partitions_by_filter_presult::~ThriftHiveMetastore_get_num_partitions_by_filter_presult() throw() {
+}
+
+
+uint32_t ThriftHiveMetastore_get_num_partitions_by_filter_presult::read(::apache::thrift::protocol::TProtocol* iprot) {
+
+  apache::thrift::protocol::TInputRecursionTracker tracker(*iprot);
+  uint32_t xfer = 0;
+  std::string fname;
+  ::apache::thrift::protocol::TType ftype;
+  int16_t fid;
+
+  xfer += iprot->readStructBegin(fname);
+
+  using ::apache::thrift::protocol::TProtocolException;
+
+
+  while (true)
+  {
+    xfer += iprot->readFieldBegin(fname, ftype, fid);
+    if (ftype == ::apache::thrift::protocol::T_STOP) {
+      break;
+    }
+    switch (fid)
+    {
+      case 0:
+        if (ftype == ::apache::thrift::protocol::T_I32) {
+          xfer += iprot->readI32((*(this->success)));
+          this->__isset.success = true;
+        } else {
+          xfer += iprot->skip(ftype);
+        }
+        break;
+      case 1:
+        if (ftype == ::apache::thrift::protocol::T_STRUCT) {
+          xfer += this->o1.read(iprot);
+          this->__isset.o1 = true;
+        } else {
+          xfer += iprot->skip(ftype);
+        }
+        break;
+      case 2:
+        if (ftype == ::apache::thrift::protocol::T_STRUCT) {
+          xfer += this->o2.read(iprot);
+          this->__isset.o2 = true;
+        } else {
+          xfer += iprot->skip(ftype);
+        }
+        break;
+      default:
+        xfer += iprot->skip(ftype);
+        break;
+    }
+    xfer += iprot->readFieldEnd();
+  }
+
+  xfer += iprot->readStructEnd();
+
+  return xfer;
+}
+
+
 ThriftHiveMetastore_get_partitions_by_names_args::~ThriftHiveMetastore_get_partitions_by_names_args() throw() {
 }
 
@@ -37145,6 +37404,72 @@ void ThriftHiveMetastoreClient::recv_get_partitions_by_expr(PartitionsByExprResu
   throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "get_partitions_by_expr failed: unknown result");
 }
 
+int32_t ThriftHiveMetastoreClient::get_num_partitions_by_filter(const std::string& db_name, const std::string& tbl_name, const std::string& filter)
+{
+  send_get_num_partitions_by_filter(db_name, tbl_name, filter);
+  return recv_get_num_partitions_by_filter();
+}
+
+void ThriftHiveMetastoreClient::send_get_num_partitions_by_filter(const std::string& db_name, const std::string& tbl_name, const std::string& filter)
+{
+  int32_t cseqid = 0;
+  oprot_->writeMessageBegin("get_num_partitions_by_filter", ::apache::thrift::protocol::T_CALL, cseqid);
+
+  ThriftHiveMetastore_get_num_partitions_by_filter_pargs args;
+  args.db_name = &db_name;
+  args.tbl_name = &tbl_name;
+  args.filter = &filter;
+  args.write(oprot_);
+
+  oprot_->writeMessageEnd();
+  oprot_->getTransport()->writeEnd();
+  oprot_->getTransport()->flush();
+}
+
+int32_t ThriftHiveMetastoreClient::recv_get_num_partitions_by_filter()
+{
+
+  int32_t rseqid = 0;
+  std::string fname;
+  ::apache::thrift::protocol::TMessageType mtype;
+
+  iprot_->readMessageBegin(fname, mtype, rseqid);
+  if (mtype == ::apache::thrift::protocol::T_EXCEPTION) {
+    ::apache::thrift::TApplicationException x;
+    x.read(iprot_);
+    iprot_->readMessageEnd();
+    iprot_->getTransport()->readEnd();
+    throw x;
+  }
+  if (mtype != ::apache::thrift::protocol::T_REPLY) {
+    iprot_->skip(::apache::thrift::protocol::T_STRUCT);
+    iprot_->readMessageEnd();
+    iprot_->getTransport()->readEnd();
+  }
+  if (fname.compare("get_num_partitions_by_filter") != 0) {
+    iprot_->skip(::apache::thrift::protocol::T_STRUCT);
+    iprot_->readMessageEnd();
+    iprot_->getTransport()->readEnd();
+  }
+  int32_t _return;
+  ThriftHiveMetastore_get_num_partitions_by_filter_presult result;
+  result.success = &_return;
+  result.read(iprot_);
+  iprot_->readMessageEnd();
+  iprot_->getTransport()->readEnd();
+
+  if (result.__isset.success) {
+    return _return;
+  }
+  if (result.__isset.o1) {
+    throw result.o1;
+  }
+  if (result.__isset.o2) {
+    throw result.o2;
+  }
+  throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "get_num_partitions_by_filter failed: unknown result");
+}
+
 void ThriftHiveMetastoreClient::get_partitions_by_names(std::vector<Partition> & _return, const std::string& db_name, const std::string& tbl_name, const std::vector<std::string> & names)
 {
   send_get_partitions_by_names(db_name, tbl_name, names);
@@ -45289,6 +45614,66 @@ void ThriftHiveMetastoreProcessor::process_get_partitions_by_expr(int32_t seqid,
   }
 }
 
+void ThriftHiveMetastoreProcessor::process_get_num_partitions_by_filter(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext)
+{
+  void* ctx = NULL;
+  if (this->eventHandler_.get() != NULL) {
+    ctx = this->eventHandler_->getContext("ThriftHiveMetastore.get_num_partitions_by_filter", callContext);
+  }
+  ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "ThriftHiveMetastore.get_num_partitions_by_filter");
+
+  if (this->eventHandler_.get() != NULL) {
+    this->eventHandler_->preRead(ctx, "ThriftHiveMetastore.get_num_partitions_by_filter");
+  }
+
+  ThriftHiveMetastore_get_num_partitions_by_filter_args args;
+  args.read(iprot);
+  iprot->readMessageEnd();
+  uint32_t bytes = iprot->getTransport()->readEnd();
+
+  if (this->eventHandler_.get() != NULL) {
+    this->eventHandler_->postRead(ctx, "ThriftHiveMetastore.get_num_partitions_by_filter", bytes);
+  }
+
+  ThriftHiveMetastore_get_num_partitions_by_filter_result result;
+  try {
+    result.success = iface_->get_num_partitions_by_filter(args.db_name, args.tbl_name, args.filter);
+    result.__isset.success = true;
+  } catch (MetaException &o1) {
+    result.o1 = o1;
+    result.__isset.o1 = true;
+  } catch (NoSuchObjectException &o2) {
+    result.o2 = o2;
+    result.__isset.o2 = true;
+  } catch (const std::exception& e) {
+    if (this->eventHandler_.get() != NULL) {
+      this->eventHandler_->handlerError(ctx, "ThriftHiveMetastore.get_num_partitions_by_filter");
+    }
+
+    ::apache::thrift::TApplicationException x(e.what());
+    oprot->writeMessageBegin("get_num_partitions_by_filter", ::apache::thrift::protocol::T_EXCEPTION, seqid);
+    x.write(oprot);
+    oprot->writeMessageEnd();
+    oprot->getTransport()->writeEnd();
+    oprot->getTransport()->flush();
+    return;
+  }
+
+  if (this->eventHandler_.get() != NULL) {
+    this->eventHandler_->preWrite(ctx, "ThriftHiveMetastore.get_num_partitions_by_filter");
+  }
+
+  oprot->writeMessageBegin("get_num_partitions_by_filter", ::apache::thrift::protocol::T_REPLY, seqid);
+  result.write(oprot);
+  oprot->writeMessageEnd();
+  bytes = oprot->getTransport()->writeEnd();
+  oprot->getTransport()->flush();
+
+  if (this->eventHandler_.get() != NULL) {
+    this->eventHandler_->postWrite(ctx, "ThriftHiveMetastore.get_num_partitions_by_filter", bytes);
+  }
+}
+
 void ThriftHiveMetastoreProcessor::process_get_partitions_by_names(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext)
 {
   void* ctx = NULL;
@@ -55062,6 +55447,100 @@ void ThriftHiveMetastoreConcurrentClient::recv_get_partitions_by_expr(Partitions
   } // end while(true)
 }
 
+int32_t ThriftHiveMetastoreConcurrentClient::get_num_partitions_by_filter(const std::string& db_name, const std::string& tbl_name, const std::string& filter)
+{
+  int32_t seqid = send_get_num_partitions_by_filter(db_name, tbl_name, filter);
+  return recv_get_num_partitions_by_filter(seqid);
+}
+
+int32_t ThriftHiveMetastoreConcurrentClient::send_get_num_partitions_by_filter(const std::string& db_name, const std::string& tbl_name, const std::string& filter)
+{
+  int32_t cseqid = this->sync_.generateSeqId();
+  ::apache::thrift::async::TConcurrentSendSentry sentry(&this->sync_);
+  oprot_->writeMessageBegin("get_num_partitions_by_filter", ::apache::thrift::protocol::T_CALL, cseqid);
+
+  ThriftHiveMetastore_get_num_partitions_by_filter_pargs args;
+  args.db_name = &db_name;
+  args.tbl_name = &tbl_name;
+  args.filter = &filter;
+  args.write(oprot_);
+
+  oprot_->writeMessageEnd();
+  oprot_->getTransport()->writeEnd();
+  oprot_->getTransport()->flush();
+
+  sentry.commit();
+  return cseqid;
+}
+
+int32_t ThriftHiveMetastoreConcurrentClient::recv_get_num_partitions_by_filter(const int32_t seqid)
+{
+
+  int32_t rseqid = 0;
+  std::string fname;
+  ::apache::thrift::protocol::TMessageType mtype;
+
+  // the read mutex gets dropped and reacquired as part of waitForWork()
+  // The destructor of this sentry wakes up other clients
+  ::apache::thrift::async::TConcurrentRecvSentry sentry(&this->sync_, seqid);
+
+  while(true) {
+    if(!this->sync_.getPending(fname, mtype, rseqid)) {
+      iprot_->readMessageBegin(fname, mtype, rseqid);
+    }
+    if(seqid == rseqid) {
+      if (mtype == ::apache::thrift::protocol::T_EXCEPTION) {
+        ::apache::thrift::TApplicationException x;
+        x.read(iprot_);
+        iprot_->readMessageEnd();
+        iprot_->getTransport()->readEnd();
+        sentry.commit();
+        throw x;
+      }
+      if (mtype != ::apache::thrift::protocol::T_REPLY) {
+        iprot_->skip(::apache::thrift::protocol::T_STRUCT);
+        iprot_->readMessageEnd();
+        iprot_->getTransport()->readEnd();
+      }
+      if (fname.compare("get_num_partitions_by_filter") != 0) {
+        iprot_->skip(::apache::thrift::protocol::T_STRUCT);
+        iprot_->readMessageEnd();
+        iprot_->getTransport()->readEnd();
+
+        // in a bad state, don't commit
+        using ::apache::thrift::protocol::TProtocolException;
+        throw TProtocolException(TProtocolException::INVALID_DATA);
+      }
+      int32_t _return;
+      ThriftHiveMetastore_get_num_partitions_by_filter_presult result;
+      result.success = &_return;
+      result.read(iprot_);
+      iprot_->readMessageEnd();
+      iprot_->getTransport()->readEnd();
+
+      if (result.__isset.success) {
+        sentry.commit();
+        return _return;
+      }
+      if (result.__isset.o1) {
+        sentry.commit();
+        throw result.o1;
+      }
+      if (result.__isset.o2) {
+        sentry.commit();
+        throw result.o2;
+      }
+      // in a bad state, don't commit
+      throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "get_num_partitions_by_filter failed: unknown result");
+    }
+    // seqid != rseqid
+    this->sync_.updatePending(fname, mtype, rseqid);
+
+    // this will temporarily unlock the readMutex, and let other clients get work done
+    this->sync_.waitForWork(seqid);
+  } // end while(true)
+}
+
 void ThriftHiveMetastoreConcurrentClient::get_partitions_by_names(std::vector<Partition> & _return, const std::string& db_name, const std::string& tbl_name, const std::vector<std::string> & names)
 {
   int32_t seqid = send_get_partitions_by_names(db_name, tbl_name, names);

http://git-wip-us.apache.org/repos/asf/hive/blob/cdcc35e6/metastore/src/gen/thrift/gen-cpp/ThriftHiveMetastore.h
----------------------------------------------------------------------
diff --git a/metastore/src/gen/thrift/gen-cpp/ThriftHiveMetastore.h b/metastore/src/gen/thrift/gen-cpp/ThriftHiveMetastore.h
index 62a2007..01b332e 100644
--- a/metastore/src/gen/thrift/gen-cpp/ThriftHiveMetastore.h
+++ b/metastore/src/gen/thrift/gen-cpp/ThriftHiveMetastore.h
@@ -80,6 +80,7 @@ class ThriftHiveMetastoreIf : virtual public  ::facebook::fb303::FacebookService
   virtual void get_partitions_by_filter(std::vector<Partition> & _return, const std::string& db_name, const std::string& tbl_name, const std::string& filter, const int16_t max_parts) = 0;
   virtual void get_part_specs_by_filter(std::vector<PartitionSpec> & _return, const std::string& db_name, const std::string& tbl_name, const std::string& filter, const int32_t max_parts) = 0;
   virtual void get_partitions_by_expr(PartitionsByExprResult& _return, const PartitionsByExprRequest& req) = 0;
+  virtual int32_t get_num_partitions_by_filter(const std::string& db_name, const std::string& tbl_name, const std::string& filter) = 0;
   virtual void get_partitions_by_names(std::vector<Partition> & _return, const std::string& db_name, const std::string& tbl_name, const std::vector<std::string> & names) = 0;
   virtual void alter_partition(const std::string& db_name, const std::string& tbl_name, const Partition& new_part) = 0;
   virtual void alter_partitions(const std::string& db_name, const std::string& tbl_name, const std::vector<Partition> & new_parts) = 0;
@@ -365,6 +366,10 @@ class ThriftHiveMetastoreNull : virtual public ThriftHiveMetastoreIf , virtual p
   void get_partitions_by_expr(PartitionsByExprResult& /* _return */, const PartitionsByExprRequest& /* req */) {
     return;
   }
+  int32_t get_num_partitions_by_filter(const std::string& /* db_name */, const std::string& /* tbl_name */, const std::string& /* filter */) {
+    int32_t _return = 0;
+    return _return;
+  }
   void get_partitions_by_names(std::vector<Partition> & /* _return */, const std::string& /* db_name */, const std::string& /* tbl_name */, const std::vector<std::string> & /* names */) {
     return;
   }
@@ -8293,6 +8298,140 @@ class ThriftHiveMetastore_get_partitions_by_expr_presult {
 
 };
 
+typedef struct _ThriftHiveMetastore_get_num_partitions_by_filter_args__isset {
+  _ThriftHiveMetastore_get_num_partitions_by_filter_args__isset() : db_name(false), tbl_name(false), filter(false) {}
+  bool db_name :1;
+  bool tbl_name :1;
+  bool filter :1;
+} _ThriftHiveMetastore_get_num_partitions_by_filter_args__isset;
+
+class ThriftHiveMetastore_get_num_partitions_by_filter_args {
+ public:
+
+  ThriftHiveMetastore_get_num_partitions_by_filter_args(const ThriftHiveMetastore_get_num_partitions_by_filter_args&);
+  ThriftHiveMetastore_get_num_partitions_by_filter_args& operator=(const ThriftHiveMetastore_get_num_partitions_by_filter_args&);
+  ThriftHiveMetastore_get_num_partitions_by_filter_args() : db_name(), tbl_name(), filter() {
+  }
+
+  virtual ~ThriftHiveMetastore_get_num_partitions_by_filter_args() throw();
+  std::string db_name;
+  std::string tbl_name;
+  std::string filter;
+
+  _ThriftHiveMetastore_get_num_partitions_by_filter_args__isset __isset;
+
+  void __set_db_name(const std::string& val);
+
+  void __set_tbl_name(const std::string& val);
+
+  void __set_filter(const std::string& val);
+
+  bool operator == (const ThriftHiveMetastore_get_num_partitions_by_filter_args & rhs) const
+  {
+    if (!(db_name == rhs.db_name))
+      return false;
+    if (!(tbl_name == rhs.tbl_name))
+      return false;
+    if (!(filter == rhs.filter))
+      return false;
+    return true;
+  }
+  bool operator != (const ThriftHiveMetastore_get_num_partitions_by_filter_args &rhs) const {
+    return !(*this == rhs);
+  }
+
+  bool operator < (const ThriftHiveMetastore_get_num_partitions_by_filter_args & ) const;
+
+  uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
+  uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
+
+};
+
+
+class ThriftHiveMetastore_get_num_partitions_by_filter_pargs {
+ public:
+
+
+  virtual ~ThriftHiveMetastore_get_num_partitions_by_filter_pargs() throw();
+  const std::string* db_name;
+  const std::string* tbl_name;
+  const std::string* filter;
+
+  uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
+
+};
+
+typedef struct _ThriftHiveMetastore_get_num_partitions_by_filter_result__isset {
+  _ThriftHiveMetastore_get_num_partitions_by_filter_result__isset() : success(false), o1(false), o2(false) {}
+  bool success :1;
+  bool o1 :1;
+  bool o2 :1;
+} _ThriftHiveMetastore_get_num_partitions_by_filter_result__isset;
+
+class ThriftHiveMetastore_get_num_partitions_by_filter_result {
+ public:
+
+  ThriftHiveMetastore_get_num_partitions_by_filter_result(const ThriftHiveMetastore_get_num_partitions_by_filter_result&);
+  ThriftHiveMetastore_get_num_partitions_by_filter_result& operator=(const ThriftHiveMetastore_get_num_partitions_by_filter_result&);
+  ThriftHiveMetastore_get_num_partitions_by_filter_result() : success(0) {
+  }
+
+  virtual ~ThriftHiveMetastore_get_num_partitions_by_filter_result() throw();
+  int32_t success;
+  MetaException o1;
+  NoSuchObjectException o2;
+
+  _ThriftHiveMetastore_get_num_partitions_by_filter_result__isset __isset;
+
+  void __set_success(const int32_t val);
+
+  void __set_o1(const MetaException& val);
+
+  void __set_o2(const NoSuchObjectException& val);
+
+  bool operator == (const ThriftHiveMetastore_get_num_partitions_by_filter_result & rhs) const
+  {
+    if (!(success == rhs.success))
+      return false;
+    if (!(o1 == rhs.o1))
+      return false;
+    if (!(o2 == rhs.o2))
+      return false;
+    return true;
+  }
+  bool operator != (const ThriftHiveMetastore_get_num_partitions_by_filter_result &rhs) const {
+    return !(*this == rhs);
+  }
+
+  bool operator < (const ThriftHiveMetastore_get_num_partitions_by_filter_result & ) const;
+
+  uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
+  uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
+
+};
+
+typedef struct _ThriftHiveMetastore_get_num_partitions_by_filter_presult__isset {
+  _ThriftHiveMetastore_get_num_partitions_by_filter_presult__isset() : success(false), o1(false), o2(false) {}
+  bool success :1;
+  bool o1 :1;
+  bool o2 :1;
+} _ThriftHiveMetastore_get_num_partitions_by_filter_presult__isset;
+
+class ThriftHiveMetastore_get_num_partitions_by_filter_presult {
+ public:
+
+
+  virtual ~ThriftHiveMetastore_get_num_partitions_by_filter_presult() throw();
+  int32_t* success;
+  MetaException o1;
+  NoSuchObjectException o2;
+
+  _ThriftHiveMetastore_get_num_partitions_by_filter_presult__isset __isset;
+
+  uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
+
+};
+
 typedef struct _ThriftHiveMetastore_get_partitions_by_names_args__isset {
   _ThriftHiveMetastore_get_partitions_by_names_args__isset() : db_name(false), tbl_name(false), names(false) {}
   bool db_name :1;
@@ -17316,6 +17455,9 @@ class ThriftHiveMetastoreClient : virtual public ThriftHiveMetastoreIf, public
   void get_partitions_by_expr(PartitionsByExprResult& _return, const PartitionsByExprRequest& req);
   void send_get_partitions_by_expr(const PartitionsByExprRequest& req);
   void recv_get_partitions_by_expr(PartitionsByExprResult& _return);
+  int32_t get_num_partitions_by_filter(const std::string& db_name, const std::string& tbl_name, const std::string& filter);
+  void send_get_num_partitions_by_filter(const std::string& db_name, const std::string& tbl_name, const std::string& filter);
+  int32_t recv_get_num_partitions_by_filter();
   void get_partitions_by_names(std::vector<Partition> & _return, const std::string& db_name, const std::string& tbl_name, const std::vector<std::string> & names);
   void send_get_partitions_by_names(const std::string& db_name, const std::string& tbl_name, const std::vector<std::string> & names);
   void recv_get_partitions_by_names(std::vector<Partition> & _return);
@@ -17606,6 +17748,7 @@ class ThriftHiveMetastoreProcessor : public  ::facebook::fb303::FacebookServiceP
   void process_get_partitions_by_filter(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext);
   void process_get_part_specs_by_filter(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext);
   void process_get_partitions_by_expr(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext);
+  void process_get_num_partitions_by_filter(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext);
   void process_get_partitions_by_names(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext);
   void process_alter_partition(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext);
   void process_alter_partitions(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext);
@@ -17742,6 +17885,7 @@ class ThriftHiveMetastoreProcessor : public  ::facebook::fb303::FacebookServiceP
     processMap_["get_partitions_by_filter"] = &ThriftHiveMetastoreProcessor::process_get_partitions_by_filter;
     processMap_["get_part_specs_by_filter"] = &ThriftHiveMetastoreProcessor::process_get_part_specs_by_filter;
     processMap_["get_partitions_by_expr"] = &ThriftHiveMetastoreProcessor::process_get_partitions_by_expr;
+    processMap_["get_num_partitions_by_filter"] = &ThriftHiveMetastoreProcessor::process_get_num_partitions_by_filter;
     processMap_["get_partitions_by_names"] = &ThriftHiveMetastoreProcessor::process_get_partitions_by_names;
     processMap_["alter_partition"] = &ThriftHiveMetastoreProcessor::process_alter_partition;
     processMap_["alter_partitions"] = &ThriftHiveMetastoreProcessor::process_alter_partitions;
@@ -18410,6 +18554,15 @@ class ThriftHiveMetastoreMultiface : virtual public ThriftHiveMetastoreIf, publi
     return;
   }
 
+  int32_t get_num_partitions_by_filter(const std::string& db_name, const std::string& tbl_name, const std::string& filter) {
+    size_t sz = ifaces_.size();
+    size_t i = 0;
+    for (; i < (sz - 1); ++i) {
+      ifaces_[i]->get_num_partitions_by_filter(db_name, tbl_name, filter);
+    }
+    return ifaces_[i]->get_num_partitions_by_filter(db_name, tbl_name, filter);
+  }
+
   void get_partitions_by_names(std::vector<Partition> & _return, const std::string& db_name, const std::string& tbl_name, const std::vector<std::string> & names) {
     size_t sz = ifaces_.size();
     size_t i = 0;
@@ -19308,6 +19461,9 @@ class ThriftHiveMetastoreConcurrentClient : virtual public ThriftHiveMetastoreIf
   void get_partitions_by_expr(PartitionsByExprResult& _return, const PartitionsByExprRequest& req);
   int32_t send_get_partitions_by_expr(const PartitionsByExprRequest& req);
   void recv_get_partitions_by_expr(PartitionsByExprResult& _return, const int32_t seqid);
+  int32_t get_num_partitions_by_filter(const std::string& db_name, const std::string& tbl_name, const std::string& filter);
+  int32_t send_get_num_partitions_by_filter(const std::string& db_name, const std::string& tbl_name, const std::string& filter);
+  int32_t recv_get_num_partitions_by_filter(const int32_t seqid);
   void get_partitions_by_names(std::vector<Partition> & _return, const std::string& db_name, const std::string& tbl_name, const std::vector<std::string> & names);
   int32_t send_get_partitions_by_names(const std::string& db_name, const std::string& tbl_name, const std::vector<std::string> & names);
   void recv_get_partitions_by_names(std::vector<Partition> & _return, const int32_t seqid);

http://git-wip-us.apache.org/repos/asf/hive/blob/cdcc35e6/metastore/src/gen/thrift/gen-cpp/ThriftHiveMetastore_server.skeleton.cpp
----------------------------------------------------------------------
diff --git a/metastore/src/gen/thrift/gen-cpp/ThriftHiveMetastore_server.skeleton.cpp b/metastore/src/gen/thrift/gen-cpp/ThriftHiveMetastore_server.skeleton.cpp
index 383a0d2..0fee77b 100644
--- a/metastore/src/gen/thrift/gen-cpp/ThriftHiveMetastore_server.skeleton.cpp
+++ b/metastore/src/gen/thrift/gen-cpp/ThriftHiveMetastore_server.skeleton.cpp
@@ -312,6 +312,11 @@ class ThriftHiveMetastoreHandler : virtual public ThriftHiveMetastoreIf {
     printf("get_partitions_by_expr\n");
   }
 
+  int32_t get_num_partitions_by_filter(const std::string& db_name, const std::string& tbl_name, const std::string& filter) {
+    // Your implementation goes here
+    printf("get_num_partitions_by_filter\n");
+  }
+
   void get_partitions_by_names(std::vector<Partition> & _return, const std::string& db_name, const std::string& tbl_name, const std::vector<std::string> & names) {
     // Your implementation goes here
     printf("get_partitions_by_names\n");

http://git-wip-us.apache.org/repos/asf/hive/blob/cdcc35e6/metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/CacheFileMetadataRequest.java
----------------------------------------------------------------------
diff --git a/metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/CacheFileMetadataRequest.java b/metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/CacheFileMetadataRequest.java
index 6b8ab11..a008acc 100644
--- a/metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/CacheFileMetadataRequest.java
+++ b/metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/CacheFileMetadataRequest.java
@@ -128,13 +128,13 @@ public class CacheFileMetadataRequest implements org.apache.thrift.TBase<CacheFi
   public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
   static {
     Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
-    tmpMap.put(_Fields.DB_NAME, new org.apache.thrift.meta_data.FieldMetaData("dbName", org.apache.thrift.TFieldRequirementType.REQUIRED,
+    tmpMap.put(_Fields.DB_NAME, new org.apache.thrift.meta_data.FieldMetaData("dbName", org.apache.thrift.TFieldRequirementType.REQUIRED, 
         new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
-    tmpMap.put(_Fields.TBL_NAME, new org.apache.thrift.meta_data.FieldMetaData("tblName", org.apache.thrift.TFieldRequirementType.REQUIRED,
+    tmpMap.put(_Fields.TBL_NAME, new org.apache.thrift.meta_data.FieldMetaData("tblName", org.apache.thrift.TFieldRequirementType.REQUIRED, 
         new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
-    tmpMap.put(_Fields.PART_NAME, new org.apache.thrift.meta_data.FieldMetaData("partName", org.apache.thrift.TFieldRequirementType.OPTIONAL,
+    tmpMap.put(_Fields.PART_NAME, new org.apache.thrift.meta_data.FieldMetaData("partName", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
         new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
-    tmpMap.put(_Fields.IS_ALL_PARTS, new org.apache.thrift.meta_data.FieldMetaData("isAllParts", org.apache.thrift.TFieldRequirementType.OPTIONAL,
+    tmpMap.put(_Fields.IS_ALL_PARTS, new org.apache.thrift.meta_data.FieldMetaData("isAllParts", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
         new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
     metaDataMap = Collections.unmodifiableMap(tmpMap);
     org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(CacheFileMetadataRequest.class, metaDataMap);
@@ -574,7 +574,7 @@ public class CacheFileMetadataRequest implements org.apache.thrift.TBase<CacheFi
       while (true)
       {
         schemeField = iprot.readFieldBegin();
-        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
+        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
           break;
         }
         switch (schemeField.id) {
@@ -582,7 +582,7 @@ public class CacheFileMetadataRequest implements org.apache.thrift.TBase<CacheFi
             if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
               struct.dbName = iprot.readString();
               struct.setDbNameIsSet(true);
-            } else {
+            } else { 
               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
             }
             break;
@@ -590,7 +590,7 @@ public class CacheFileMetadataRequest implements org.apache.thrift.TBase<CacheFi
             if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
               struct.tblName = iprot.readString();
               struct.setTblNameIsSet(true);
-            } else {
+            } else { 
               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
             }
             break;
@@ -598,7 +598,7 @@ public class CacheFileMetadataRequest implements org.apache.thrift.TBase<CacheFi
             if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
               struct.partName = iprot.readString();
               struct.setPartNameIsSet(true);
-            } else {
+            } else { 
               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
             }
             break;
@@ -606,7 +606,7 @@ public class CacheFileMetadataRequest implements org.apache.thrift.TBase<CacheFi
             if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
               struct.isAllParts = iprot.readBool();
               struct.setIsAllPartsIsSet(true);
-            } else {
+            } else { 
               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
             }
             break;
@@ -700,3 +700,4 @@ public class CacheFileMetadataRequest implements org.apache.thrift.TBase<CacheFi
   }
 
 }
+

http://git-wip-us.apache.org/repos/asf/hive/blob/cdcc35e6/metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/CacheFileMetadataResult.java
----------------------------------------------------------------------
diff --git a/metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/CacheFileMetadataResult.java b/metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/CacheFileMetadataResult.java
index 4336f96..a1466ae 100644
--- a/metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/CacheFileMetadataResult.java
+++ b/metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/CacheFileMetadataResult.java
@@ -112,7 +112,7 @@ public class CacheFileMetadataResult implements org.apache.thrift.TBase<CacheFil
   public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
   static {
     Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
-    tmpMap.put(_Fields.IS_SUPPORTED, new org.apache.thrift.meta_data.FieldMetaData("isSupported", org.apache.thrift.TFieldRequirementType.REQUIRED,
+    tmpMap.put(_Fields.IS_SUPPORTED, new org.apache.thrift.meta_data.FieldMetaData("isSupported", org.apache.thrift.TFieldRequirementType.REQUIRED, 
         new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
     metaDataMap = Collections.unmodifiableMap(tmpMap);
     org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(CacheFileMetadataResult.class, metaDataMap);
@@ -327,7 +327,7 @@ public class CacheFileMetadataResult implements org.apache.thrift.TBase<CacheFil
       while (true)
       {
         schemeField = iprot.readFieldBegin();
-        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
+        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
           break;
         }
         switch (schemeField.id) {
@@ -335,7 +335,7 @@ public class CacheFileMetadataResult implements org.apache.thrift.TBase<CacheFil
             if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
               struct.isSupported = iprot.readBool();
               struct.setIsSupportedIsSet(true);
-            } else {
+            } else { 
               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
             }
             break;
@@ -384,3 +384,4 @@ public class CacheFileMetadataResult implements org.apache.thrift.TBase<CacheFil
   }
 
 }
+

http://git-wip-us.apache.org/repos/asf/hive/blob/cdcc35e6/metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/FileMetadataExprType.java
----------------------------------------------------------------------
diff --git a/metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/FileMetadataExprType.java b/metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/FileMetadataExprType.java
index 8ffaa89..4e393e2 100644
--- a/metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/FileMetadataExprType.java
+++ b/metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/FileMetadataExprType.java
@@ -7,6 +7,10 @@
 package org.apache.hadoop.hive.metastore.api;
 
 
+import java.util.Map;
+import java.util.HashMap;
+import org.apache.thrift.TEnum;
+
 public enum FileMetadataExprType implements org.apache.thrift.TEnum {
   ORC_SARG(1);
 

http://git-wip-us.apache.org/repos/asf/hive/blob/cdcc35e6/metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/PutFileMetadataRequest.java
----------------------------------------------------------------------
diff --git a/metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/PutFileMetadataRequest.java b/metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/PutFileMetadataRequest.java
index 1b7bbf0..ab151b1 100644
--- a/metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/PutFileMetadataRequest.java
+++ b/metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/PutFileMetadataRequest.java
@@ -57,7 +57,7 @@ public class PutFileMetadataRequest implements org.apache.thrift.TBase<PutFileMe
     FILE_IDS((short)1, "fileIds"),
     METADATA((short)2, "metadata"),
     /**
-     *
+     * 
      * @see FileMetadataExprType
      */
     TYPE((short)3, "type");
@@ -131,7 +131,7 @@ public class PutFileMetadataRequest implements org.apache.thrift.TBase<PutFileMe
     tmpMap.put(_Fields.METADATA, new org.apache.thrift.meta_data.FieldMetaData("metadata", org.apache.thrift.TFieldRequirementType.REQUIRED, 
         new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
             new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING            , true))));
-    tmpMap.put(_Fields.TYPE, new org.apache.thrift.meta_data.FieldMetaData("type", org.apache.thrift.TFieldRequirementType.OPTIONAL,
+    tmpMap.put(_Fields.TYPE, new org.apache.thrift.meta_data.FieldMetaData("type", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
         new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, FileMetadataExprType.class)));
     metaDataMap = Collections.unmodifiableMap(tmpMap);
     org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(PutFileMetadataRequest.class, metaDataMap);
@@ -254,7 +254,7 @@ public class PutFileMetadataRequest implements org.apache.thrift.TBase<PutFileMe
   }
 
   /**
-   *
+   * 
    * @see FileMetadataExprType
    */
   public FileMetadataExprType getType() {
@@ -262,7 +262,7 @@ public class PutFileMetadataRequest implements org.apache.thrift.TBase<PutFileMe
   }
 
   /**
-   *
+   * 
    * @see FileMetadataExprType
    */
   public void setType(FileMetadataExprType type) {
@@ -584,7 +584,7 @@ public class PutFileMetadataRequest implements org.apache.thrift.TBase<PutFileMe
             if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
               struct.type = org.apache.hadoop.hive.metastore.api.FileMetadataExprType.findByValue(iprot.readI32());
               struct.setTypeIsSet(true);
-            } else {
+            } else { 
               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
             }
             break;