Return-Path: X-Original-To: apmail-hive-commits-archive@www.apache.org Delivered-To: apmail-hive-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4DCEF1868C for ; Tue, 23 Feb 2016 19:17:17 +0000 (UTC) Received: (qmail 58732 invoked by uid 500); 23 Feb 2016 19:17:02 -0000 Delivered-To: apmail-hive-commits-archive@hive.apache.org Received: (qmail 58616 invoked by uid 500); 23 Feb 2016 19:17:02 -0000 Mailing-List: contact commits-help@hive.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: hive-dev@hive.apache.org Delivered-To: mailing list commits@hive.apache.org Received: (qmail 56094 invoked by uid 99); 23 Feb 2016 19:17:01 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 23 Feb 2016 19:17:01 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 3AD50E8E93; Tue, 23 Feb 2016 19:17:01 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: jdere@apache.org To: commits@hive.apache.org Date: Tue, 23 Feb 2016 19:17:26 -0000 Message-Id: <8da74862fe6d46c5ad4d8d67a82f592d@git.apache.org> In-Reply-To: <1edfbbfc6c80490bb7edc2899aa4f4c6@git.apache.org> References: <1edfbbfc6c80490bb7edc2899aa4f4c6@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [27/50] [abbrv] hive git commit: HIVE-12730: MetadataUpdater: provide a mechanism to edit the basic statistics of a table (or a partition) (Pengcheng Xiong, reviewed by Ashutosh Chauhan) http://git-wip-us.apache.org/repos/asf/hive/blob/78a85f82/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 7f3c3ea..a546247 100644 --- a/metastore/src/gen/thrift/gen-php/metastore/ThriftHiveMetastore.php +++ b/metastore/src/gen/thrift/gen-php/metastore/ThriftHiveMetastore.php @@ -567,6 +567,15 @@ interface ThriftHiveMetastoreIf extends \FacebookServiceIf { /** * @param string $db_name * @param string $tbl_name + * @param \metastore\Partition[] $new_parts + * @param \metastore\EnvironmentContext $environment_context + * @throws \metastore\InvalidOperationException + * @throws \metastore\MetaException + */ + public function alter_partitions_with_environment_context($db_name, $tbl_name, array $new_parts, \metastore\EnvironmentContext $environment_context); + /** + * @param string $db_name + * @param string $tbl_name * @param \metastore\Partition $new_part * @param \metastore\EnvironmentContext $environment_context * @throws \metastore\InvalidOperationException @@ -4729,6 +4738,63 @@ class ThriftHiveMetastoreClient extends \FacebookServiceClient implements \metas return; } + public function alter_partitions_with_environment_context($db_name, $tbl_name, array $new_parts, \metastore\EnvironmentContext $environment_context) + { + $this->send_alter_partitions_with_environment_context($db_name, $tbl_name, $new_parts, $environment_context); + $this->recv_alter_partitions_with_environment_context(); + } + + public function send_alter_partitions_with_environment_context($db_name, $tbl_name, array $new_parts, \metastore\EnvironmentContext $environment_context) + { + $args = new \metastore\ThriftHiveMetastore_alter_partitions_with_environment_context_args(); + $args->db_name = $db_name; + $args->tbl_name = $tbl_name; + $args->new_parts = $new_parts; + $args->environment_context = $environment_context; + $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary'); + if ($bin_accel) + { + thrift_protocol_write_binary($this->output_, 'alter_partitions_with_environment_context', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite()); + } + else + { + $this->output_->writeMessageBegin('alter_partitions_with_environment_context', TMessageType::CALL, $this->seqid_); + $args->write($this->output_); + $this->output_->writeMessageEnd(); + $this->output_->getTransport()->flush(); + } + } + + public function recv_alter_partitions_with_environment_context() + { + $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary'); + if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\metastore\ThriftHiveMetastore_alter_partitions_with_environment_context_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_alter_partitions_with_environment_context_result(); + $result->read($this->input_); + $this->input_->readMessageEnd(); + } + if ($result->o1 !== null) { + throw $result->o1; + } + if ($result->o2 !== null) { + throw $result->o2; + } + return; + } + public function alter_partition_with_environment_context($db_name, $tbl_name, \metastore\Partition $new_part, \metastore\EnvironmentContext $environment_context) { $this->send_alter_partition_with_environment_context($db_name, $tbl_name, $new_part, $environment_context); @@ -25085,6 +25151,285 @@ class ThriftHiveMetastore_alter_partitions_result { } +class ThriftHiveMetastore_alter_partitions_with_environment_context_args { + static $_TSPEC; + + /** + * @var string + */ + public $db_name = null; + /** + * @var string + */ + public $tbl_name = null; + /** + * @var \metastore\Partition[] + */ + public $new_parts = null; + /** + * @var \metastore\EnvironmentContext + */ + public $environment_context = 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' => 'new_parts', + 'type' => TType::LST, + 'etype' => TType::STRUCT, + 'elem' => array( + 'type' => TType::STRUCT, + 'class' => '\metastore\Partition', + ), + ), + 4 => array( + 'var' => 'environment_context', + 'type' => TType::STRUCT, + 'class' => '\metastore\EnvironmentContext', + ), + ); + } + 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['new_parts'])) { + $this->new_parts = $vals['new_parts']; + } + if (isset($vals['environment_context'])) { + $this->environment_context = $vals['environment_context']; + } + } + } + + public function getName() { + return 'ThriftHiveMetastore_alter_partitions_with_environment_context_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::LST) { + $this->new_parts = array(); + $_size832 = 0; + $_etype835 = 0; + $xfer += $input->readListBegin($_etype835, $_size832); + for ($_i836 = 0; $_i836 < $_size832; ++$_i836) + { + $elem837 = null; + $elem837 = new \metastore\Partition(); + $xfer += $elem837->read($input); + $this->new_parts []= $elem837; + } + $xfer += $input->readListEnd(); + } else { + $xfer += $input->skip($ftype); + } + break; + case 4: + if ($ftype == TType::STRUCT) { + $this->environment_context = new \metastore\EnvironmentContext(); + $xfer += $this->environment_context->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_alter_partitions_with_environment_context_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->new_parts !== null) { + if (!is_array($this->new_parts)) { + throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA); + } + $xfer += $output->writeFieldBegin('new_parts', TType::LST, 3); + { + $output->writeListBegin(TType::STRUCT, count($this->new_parts)); + { + foreach ($this->new_parts as $iter838) + { + $xfer += $iter838->write($output); + } + } + $output->writeListEnd(); + } + $xfer += $output->writeFieldEnd(); + } + if ($this->environment_context !== null) { + if (!is_object($this->environment_context)) { + throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA); + } + $xfer += $output->writeFieldBegin('environment_context', TType::STRUCT, 4); + $xfer += $this->environment_context->write($output); + $xfer += $output->writeFieldEnd(); + } + $xfer += $output->writeFieldStop(); + $xfer += $output->writeStructEnd(); + return $xfer; + } + +} + +class ThriftHiveMetastore_alter_partitions_with_environment_context_result { + static $_TSPEC; + + /** + * @var \metastore\InvalidOperationException + */ + public $o1 = null; + /** + * @var \metastore\MetaException + */ + public $o2 = null; + + public function __construct($vals=null) { + if (!isset(self::$_TSPEC)) { + self::$_TSPEC = array( + 1 => array( + 'var' => 'o1', + 'type' => TType::STRUCT, + 'class' => '\metastore\InvalidOperationException', + ), + 2 => array( + 'var' => 'o2', + 'type' => TType::STRUCT, + 'class' => '\metastore\MetaException', + ), + ); + } + if (is_array($vals)) { + if (isset($vals['o1'])) { + $this->o1 = $vals['o1']; + } + if (isset($vals['o2'])) { + $this->o2 = $vals['o2']; + } + } + } + + public function getName() { + return 'ThriftHiveMetastore_alter_partitions_with_environment_context_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 1: + if ($ftype == TType::STRUCT) { + $this->o1 = new \metastore\InvalidOperationException(); + $xfer += $this->o1->read($input); + } else { + $xfer += $input->skip($ftype); + } + break; + case 2: + if ($ftype == TType::STRUCT) { + $this->o2 = new \metastore\MetaException(); + $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_alter_partitions_with_environment_context_result'); + 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_alter_partition_with_environment_context_args { static $_TSPEC; @@ -25439,14 +25784,14 @@ class ThriftHiveMetastore_rename_partition_args { case 3: if ($ftype == TType::LST) { $this->part_vals = array(); - $_size832 = 0; - $_etype835 = 0; - $xfer += $input->readListBegin($_etype835, $_size832); - for ($_i836 = 0; $_i836 < $_size832; ++$_i836) + $_size839 = 0; + $_etype842 = 0; + $xfer += $input->readListBegin($_etype842, $_size839); + for ($_i843 = 0; $_i843 < $_size839; ++$_i843) { - $elem837 = null; - $xfer += $input->readString($elem837); - $this->part_vals []= $elem837; + $elem844 = null; + $xfer += $input->readString($elem844); + $this->part_vals []= $elem844; } $xfer += $input->readListEnd(); } else { @@ -25492,9 +25837,9 @@ class ThriftHiveMetastore_rename_partition_args { { $output->writeListBegin(TType::STRING, count($this->part_vals)); { - foreach ($this->part_vals as $iter838) + foreach ($this->part_vals as $iter845) { - $xfer += $output->writeString($iter838); + $xfer += $output->writeString($iter845); } } $output->writeListEnd(); @@ -25679,14 +26024,14 @@ class ThriftHiveMetastore_partition_name_has_valid_characters_args { case 1: if ($ftype == TType::LST) { $this->part_vals = array(); - $_size839 = 0; - $_etype842 = 0; - $xfer += $input->readListBegin($_etype842, $_size839); - for ($_i843 = 0; $_i843 < $_size839; ++$_i843) + $_size846 = 0; + $_etype849 = 0; + $xfer += $input->readListBegin($_etype849, $_size846); + for ($_i850 = 0; $_i850 < $_size846; ++$_i850) { - $elem844 = null; - $xfer += $input->readString($elem844); - $this->part_vals []= $elem844; + $elem851 = null; + $xfer += $input->readString($elem851); + $this->part_vals []= $elem851; } $xfer += $input->readListEnd(); } else { @@ -25721,9 +26066,9 @@ class ThriftHiveMetastore_partition_name_has_valid_characters_args { { $output->writeListBegin(TType::STRING, count($this->part_vals)); { - foreach ($this->part_vals as $iter845) + foreach ($this->part_vals as $iter852) { - $xfer += $output->writeString($iter845); + $xfer += $output->writeString($iter852); } } $output->writeListEnd(); @@ -26177,14 +26522,14 @@ class ThriftHiveMetastore_partition_name_to_vals_result { case 0: if ($ftype == TType::LST) { $this->success = array(); - $_size846 = 0; - $_etype849 = 0; - $xfer += $input->readListBegin($_etype849, $_size846); - for ($_i850 = 0; $_i850 < $_size846; ++$_i850) + $_size853 = 0; + $_etype856 = 0; + $xfer += $input->readListBegin($_etype856, $_size853); + for ($_i857 = 0; $_i857 < $_size853; ++$_i857) { - $elem851 = null; - $xfer += $input->readString($elem851); - $this->success []= $elem851; + $elem858 = null; + $xfer += $input->readString($elem858); + $this->success []= $elem858; } $xfer += $input->readListEnd(); } else { @@ -26220,9 +26565,9 @@ class ThriftHiveMetastore_partition_name_to_vals_result { { $output->writeListBegin(TType::STRING, count($this->success)); { - foreach ($this->success as $iter852) + foreach ($this->success as $iter859) { - $xfer += $output->writeString($iter852); + $xfer += $output->writeString($iter859); } } $output->writeListEnd(); @@ -26382,17 +26727,17 @@ class ThriftHiveMetastore_partition_name_to_spec_result { case 0: if ($ftype == TType::MAP) { $this->success = array(); - $_size853 = 0; - $_ktype854 = 0; - $_vtype855 = 0; - $xfer += $input->readMapBegin($_ktype854, $_vtype855, $_size853); - for ($_i857 = 0; $_i857 < $_size853; ++$_i857) + $_size860 = 0; + $_ktype861 = 0; + $_vtype862 = 0; + $xfer += $input->readMapBegin($_ktype861, $_vtype862, $_size860); + for ($_i864 = 0; $_i864 < $_size860; ++$_i864) { - $key858 = ''; - $val859 = ''; - $xfer += $input->readString($key858); - $xfer += $input->readString($val859); - $this->success[$key858] = $val859; + $key865 = ''; + $val866 = ''; + $xfer += $input->readString($key865); + $xfer += $input->readString($val866); + $this->success[$key865] = $val866; } $xfer += $input->readMapEnd(); } else { @@ -26428,10 +26773,10 @@ class ThriftHiveMetastore_partition_name_to_spec_result { { $output->writeMapBegin(TType::STRING, TType::STRING, count($this->success)); { - foreach ($this->success as $kiter860 => $viter861) + foreach ($this->success as $kiter867 => $viter868) { - $xfer += $output->writeString($kiter860); - $xfer += $output->writeString($viter861); + $xfer += $output->writeString($kiter867); + $xfer += $output->writeString($viter868); } } $output->writeMapEnd(); @@ -26551,17 +26896,17 @@ class ThriftHiveMetastore_markPartitionForEvent_args { case 3: if ($ftype == TType::MAP) { $this->part_vals = array(); - $_size862 = 0; - $_ktype863 = 0; - $_vtype864 = 0; - $xfer += $input->readMapBegin($_ktype863, $_vtype864, $_size862); - for ($_i866 = 0; $_i866 < $_size862; ++$_i866) + $_size869 = 0; + $_ktype870 = 0; + $_vtype871 = 0; + $xfer += $input->readMapBegin($_ktype870, $_vtype871, $_size869); + for ($_i873 = 0; $_i873 < $_size869; ++$_i873) { - $key867 = ''; - $val868 = ''; - $xfer += $input->readString($key867); - $xfer += $input->readString($val868); - $this->part_vals[$key867] = $val868; + $key874 = ''; + $val875 = ''; + $xfer += $input->readString($key874); + $xfer += $input->readString($val875); + $this->part_vals[$key874] = $val875; } $xfer += $input->readMapEnd(); } else { @@ -26606,10 +26951,10 @@ class ThriftHiveMetastore_markPartitionForEvent_args { { $output->writeMapBegin(TType::STRING, TType::STRING, count($this->part_vals)); { - foreach ($this->part_vals as $kiter869 => $viter870) + foreach ($this->part_vals as $kiter876 => $viter877) { - $xfer += $output->writeString($kiter869); - $xfer += $output->writeString($viter870); + $xfer += $output->writeString($kiter876); + $xfer += $output->writeString($viter877); } } $output->writeMapEnd(); @@ -26931,17 +27276,17 @@ class ThriftHiveMetastore_isPartitionMarkedForEvent_args { case 3: if ($ftype == TType::MAP) { $this->part_vals = array(); - $_size871 = 0; - $_ktype872 = 0; - $_vtype873 = 0; - $xfer += $input->readMapBegin($_ktype872, $_vtype873, $_size871); - for ($_i875 = 0; $_i875 < $_size871; ++$_i875) + $_size878 = 0; + $_ktype879 = 0; + $_vtype880 = 0; + $xfer += $input->readMapBegin($_ktype879, $_vtype880, $_size878); + for ($_i882 = 0; $_i882 < $_size878; ++$_i882) { - $key876 = ''; - $val877 = ''; - $xfer += $input->readString($key876); - $xfer += $input->readString($val877); - $this->part_vals[$key876] = $val877; + $key883 = ''; + $val884 = ''; + $xfer += $input->readString($key883); + $xfer += $input->readString($val884); + $this->part_vals[$key883] = $val884; } $xfer += $input->readMapEnd(); } else { @@ -26986,10 +27331,10 @@ class ThriftHiveMetastore_isPartitionMarkedForEvent_args { { $output->writeMapBegin(TType::STRING, TType::STRING, count($this->part_vals)); { - foreach ($this->part_vals as $kiter878 => $viter879) + foreach ($this->part_vals as $kiter885 => $viter886) { - $xfer += $output->writeString($kiter878); - $xfer += $output->writeString($viter879); + $xfer += $output->writeString($kiter885); + $xfer += $output->writeString($viter886); } } $output->writeMapEnd(); @@ -28463,15 +28808,15 @@ class ThriftHiveMetastore_get_indexes_result { case 0: if ($ftype == TType::LST) { $this->success = array(); - $_size880 = 0; - $_etype883 = 0; - $xfer += $input->readListBegin($_etype883, $_size880); - for ($_i884 = 0; $_i884 < $_size880; ++$_i884) + $_size887 = 0; + $_etype890 = 0; + $xfer += $input->readListBegin($_etype890, $_size887); + for ($_i891 = 0; $_i891 < $_size887; ++$_i891) { - $elem885 = null; - $elem885 = new \metastore\Index(); - $xfer += $elem885->read($input); - $this->success []= $elem885; + $elem892 = null; + $elem892 = new \metastore\Index(); + $xfer += $elem892->read($input); + $this->success []= $elem892; } $xfer += $input->readListEnd(); } else { @@ -28515,9 +28860,9 @@ class ThriftHiveMetastore_get_indexes_result { { $output->writeListBegin(TType::STRUCT, count($this->success)); { - foreach ($this->success as $iter886) + foreach ($this->success as $iter893) { - $xfer += $iter886->write($output); + $xfer += $iter893->write($output); } } $output->writeListEnd(); @@ -28724,14 +29069,14 @@ class ThriftHiveMetastore_get_index_names_result { case 0: if ($ftype == TType::LST) { $this->success = array(); - $_size887 = 0; - $_etype890 = 0; - $xfer += $input->readListBegin($_etype890, $_size887); - for ($_i891 = 0; $_i891 < $_size887; ++$_i891) + $_size894 = 0; + $_etype897 = 0; + $xfer += $input->readListBegin($_etype897, $_size894); + for ($_i898 = 0; $_i898 < $_size894; ++$_i898) { - $elem892 = null; - $xfer += $input->readString($elem892); - $this->success []= $elem892; + $elem899 = null; + $xfer += $input->readString($elem899); + $this->success []= $elem899; } $xfer += $input->readListEnd(); } else { @@ -28767,9 +29112,9 @@ class ThriftHiveMetastore_get_index_names_result { { $output->writeListBegin(TType::STRING, count($this->success)); { - foreach ($this->success as $iter893) + foreach ($this->success as $iter900) { - $xfer += $output->writeString($iter893); + $xfer += $output->writeString($iter900); } } $output->writeListEnd(); @@ -32243,14 +32588,14 @@ class ThriftHiveMetastore_get_functions_result { case 0: if ($ftype == TType::LST) { $this->success = array(); - $_size894 = 0; - $_etype897 = 0; - $xfer += $input->readListBegin($_etype897, $_size894); - for ($_i898 = 0; $_i898 < $_size894; ++$_i898) + $_size901 = 0; + $_etype904 = 0; + $xfer += $input->readListBegin($_etype904, $_size901); + for ($_i905 = 0; $_i905 < $_size901; ++$_i905) { - $elem899 = null; - $xfer += $input->readString($elem899); - $this->success []= $elem899; + $elem906 = null; + $xfer += $input->readString($elem906); + $this->success []= $elem906; } $xfer += $input->readListEnd(); } else { @@ -32286,9 +32631,9 @@ class ThriftHiveMetastore_get_functions_result { { $output->writeListBegin(TType::STRING, count($this->success)); { - foreach ($this->success as $iter900) + foreach ($this->success as $iter907) { - $xfer += $output->writeString($iter900); + $xfer += $output->writeString($iter907); } } $output->writeListEnd(); @@ -33157,14 +33502,14 @@ class ThriftHiveMetastore_get_role_names_result { case 0: if ($ftype == TType::LST) { $this->success = array(); - $_size901 = 0; - $_etype904 = 0; - $xfer += $input->readListBegin($_etype904, $_size901); - for ($_i905 = 0; $_i905 < $_size901; ++$_i905) + $_size908 = 0; + $_etype911 = 0; + $xfer += $input->readListBegin($_etype911, $_size908); + for ($_i912 = 0; $_i912 < $_size908; ++$_i912) { - $elem906 = null; - $xfer += $input->readString($elem906); - $this->success []= $elem906; + $elem913 = null; + $xfer += $input->readString($elem913); + $this->success []= $elem913; } $xfer += $input->readListEnd(); } else { @@ -33200,9 +33545,9 @@ class ThriftHiveMetastore_get_role_names_result { { $output->writeListBegin(TType::STRING, count($this->success)); { - foreach ($this->success as $iter907) + foreach ($this->success as $iter914) { - $xfer += $output->writeString($iter907); + $xfer += $output->writeString($iter914); } } $output->writeListEnd(); @@ -33893,15 +34238,15 @@ class ThriftHiveMetastore_list_roles_result { case 0: if ($ftype == TType::LST) { $this->success = array(); - $_size908 = 0; - $_etype911 = 0; - $xfer += $input->readListBegin($_etype911, $_size908); - for ($_i912 = 0; $_i912 < $_size908; ++$_i912) + $_size915 = 0; + $_etype918 = 0; + $xfer += $input->readListBegin($_etype918, $_size915); + for ($_i919 = 0; $_i919 < $_size915; ++$_i919) { - $elem913 = null; - $elem913 = new \metastore\Role(); - $xfer += $elem913->read($input); - $this->success []= $elem913; + $elem920 = null; + $elem920 = new \metastore\Role(); + $xfer += $elem920->read($input); + $this->success []= $elem920; } $xfer += $input->readListEnd(); } else { @@ -33937,9 +34282,9 @@ class ThriftHiveMetastore_list_roles_result { { $output->writeListBegin(TType::STRUCT, count($this->success)); { - foreach ($this->success as $iter914) + foreach ($this->success as $iter921) { - $xfer += $iter914->write($output); + $xfer += $iter921->write($output); } } $output->writeListEnd(); @@ -34601,14 +34946,14 @@ class ThriftHiveMetastore_get_privilege_set_args { case 3: if ($ftype == TType::LST) { $this->group_names = array(); - $_size915 = 0; - $_etype918 = 0; - $xfer += $input->readListBegin($_etype918, $_size915); - for ($_i919 = 0; $_i919 < $_size915; ++$_i919) + $_size922 = 0; + $_etype925 = 0; + $xfer += $input->readListBegin($_etype925, $_size922); + for ($_i926 = 0; $_i926 < $_size922; ++$_i926) { - $elem920 = null; - $xfer += $input->readString($elem920); - $this->group_names []= $elem920; + $elem927 = null; + $xfer += $input->readString($elem927); + $this->group_names []= $elem927; } $xfer += $input->readListEnd(); } else { @@ -34649,9 +34994,9 @@ class ThriftHiveMetastore_get_privilege_set_args { { $output->writeListBegin(TType::STRING, count($this->group_names)); { - foreach ($this->group_names as $iter921) + foreach ($this->group_names as $iter928) { - $xfer += $output->writeString($iter921); + $xfer += $output->writeString($iter928); } } $output->writeListEnd(); @@ -34959,15 +35304,15 @@ class ThriftHiveMetastore_list_privileges_result { case 0: if ($ftype == TType::LST) { $this->success = array(); - $_size922 = 0; - $_etype925 = 0; - $xfer += $input->readListBegin($_etype925, $_size922); - for ($_i926 = 0; $_i926 < $_size922; ++$_i926) + $_size929 = 0; + $_etype932 = 0; + $xfer += $input->readListBegin($_etype932, $_size929); + for ($_i933 = 0; $_i933 < $_size929; ++$_i933) { - $elem927 = null; - $elem927 = new \metastore\HiveObjectPrivilege(); - $xfer += $elem927->read($input); - $this->success []= $elem927; + $elem934 = null; + $elem934 = new \metastore\HiveObjectPrivilege(); + $xfer += $elem934->read($input); + $this->success []= $elem934; } $xfer += $input->readListEnd(); } else { @@ -35003,9 +35348,9 @@ class ThriftHiveMetastore_list_privileges_result { { $output->writeListBegin(TType::STRUCT, count($this->success)); { - foreach ($this->success as $iter928) + foreach ($this->success as $iter935) { - $xfer += $iter928->write($output); + $xfer += $iter935->write($output); } } $output->writeListEnd(); @@ -35637,14 +35982,14 @@ class ThriftHiveMetastore_set_ugi_args { case 2: if ($ftype == TType::LST) { $this->group_names = array(); - $_size929 = 0; - $_etype932 = 0; - $xfer += $input->readListBegin($_etype932, $_size929); - for ($_i933 = 0; $_i933 < $_size929; ++$_i933) + $_size936 = 0; + $_etype939 = 0; + $xfer += $input->readListBegin($_etype939, $_size936); + for ($_i940 = 0; $_i940 < $_size936; ++$_i940) { - $elem934 = null; - $xfer += $input->readString($elem934); - $this->group_names []= $elem934; + $elem941 = null; + $xfer += $input->readString($elem941); + $this->group_names []= $elem941; } $xfer += $input->readListEnd(); } else { @@ -35677,9 +36022,9 @@ class ThriftHiveMetastore_set_ugi_args { { $output->writeListBegin(TType::STRING, count($this->group_names)); { - foreach ($this->group_names as $iter935) + foreach ($this->group_names as $iter942) { - $xfer += $output->writeString($iter935); + $xfer += $output->writeString($iter942); } } $output->writeListEnd(); @@ -35755,14 +36100,14 @@ class ThriftHiveMetastore_set_ugi_result { case 0: if ($ftype == TType::LST) { $this->success = array(); - $_size936 = 0; - $_etype939 = 0; - $xfer += $input->readListBegin($_etype939, $_size936); - for ($_i940 = 0; $_i940 < $_size936; ++$_i940) + $_size943 = 0; + $_etype946 = 0; + $xfer += $input->readListBegin($_etype946, $_size943); + for ($_i947 = 0; $_i947 < $_size943; ++$_i947) { - $elem941 = null; - $xfer += $input->readString($elem941); - $this->success []= $elem941; + $elem948 = null; + $xfer += $input->readString($elem948); + $this->success []= $elem948; } $xfer += $input->readListEnd(); } else { @@ -35798,9 +36143,9 @@ class ThriftHiveMetastore_set_ugi_result { { $output->writeListBegin(TType::STRING, count($this->success)); { - foreach ($this->success as $iter942) + foreach ($this->success as $iter949) { - $xfer += $output->writeString($iter942); + $xfer += $output->writeString($iter949); } } $output->writeListEnd(); @@ -40239,3 +40584,4 @@ class ThriftHiveMetastore_get_change_version_result { } + http://git-wip-us.apache.org/repos/asf/hive/blob/78a85f82/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 da25a6e..9a53d56 100755 --- a/metastore/src/gen/thrift/gen-py/hive_metastore/ThriftHiveMetastore-remote +++ b/metastore/src/gen/thrift/gen-py/hive_metastore/ThriftHiveMetastore-remote @@ -86,6 +86,7 @@ if len(sys.argv) <= 1 or sys.argv[1] == '--help': 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)') + print(' void alter_partitions_with_environment_context(string db_name, string tbl_name, new_parts, EnvironmentContext environment_context)') print(' void alter_partition_with_environment_context(string db_name, string tbl_name, Partition new_part, EnvironmentContext environment_context)') print(' void rename_partition(string db_name, string tbl_name, part_vals, Partition new_part)') print(' bool partition_name_has_valid_characters( part_vals, bool throw_exception)') @@ -599,6 +600,12 @@ elif cmd == 'alter_partitions': sys.exit(1) pp.pprint(client.alter_partitions(args[0],args[1],eval(args[2]),)) +elif cmd == 'alter_partitions_with_environment_context': + if len(args) != 4: + print('alter_partitions_with_environment_context requires 4 args') + sys.exit(1) + pp.pprint(client.alter_partitions_with_environment_context(args[0],args[1],eval(args[2]),eval(args[3]),)) + elif cmd == 'alter_partition_with_environment_context': if len(args) != 4: print('alter_partition_with_environment_context requires 4 args') http://git-wip-us.apache.org/repos/asf/hive/blob/78a85f82/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 60fb905..0da1acf 100644 --- a/metastore/src/gen/thrift/gen-py/hive_metastore/ThriftHiveMetastore.py +++ b/metastore/src/gen/thrift/gen-py/hive_metastore/ThriftHiveMetastore.py @@ -560,6 +560,16 @@ class Iface(fb303.FacebookService.Iface): """ pass + def alter_partitions_with_environment_context(self, db_name, tbl_name, new_parts, environment_context): + """ + Parameters: + - db_name + - tbl_name + - new_parts + - environment_context + """ + pass + def alter_partition_with_environment_context(self, db_name, tbl_name, new_part, environment_context): """ Parameters: @@ -3491,6 +3501,45 @@ class Client(fb303.FacebookService.Client, Iface): raise result.o2 return + def alter_partitions_with_environment_context(self, db_name, tbl_name, new_parts, environment_context): + """ + Parameters: + - db_name + - tbl_name + - new_parts + - environment_context + """ + self.send_alter_partitions_with_environment_context(db_name, tbl_name, new_parts, environment_context) + self.recv_alter_partitions_with_environment_context() + + def send_alter_partitions_with_environment_context(self, db_name, tbl_name, new_parts, environment_context): + self._oprot.writeMessageBegin('alter_partitions_with_environment_context', TMessageType.CALL, self._seqid) + args = alter_partitions_with_environment_context_args() + args.db_name = db_name + args.tbl_name = tbl_name + args.new_parts = new_parts + args.environment_context = environment_context + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_alter_partitions_with_environment_context(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = alter_partitions_with_environment_context_result() + result.read(iprot) + iprot.readMessageEnd() + if result.o1 is not None: + raise result.o1 + if result.o2 is not None: + raise result.o2 + return + def alter_partition_with_environment_context(self, db_name, tbl_name, new_part, environment_context): """ Parameters: @@ -6063,6 +6112,7 @@ class Processor(fb303.FacebookService.Processor, Iface, TProcessor): 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 + self._processMap["alter_partitions_with_environment_context"] = Processor.process_alter_partitions_with_environment_context self._processMap["alter_partition_with_environment_context"] = Processor.process_alter_partition_with_environment_context self._processMap["rename_partition"] = Processor.process_rename_partition self._processMap["partition_name_has_valid_characters"] = Processor.process_partition_name_has_valid_characters @@ -7752,6 +7802,31 @@ class Processor(fb303.FacebookService.Processor, Iface, TProcessor): oprot.writeMessageEnd() oprot.trans.flush() + def process_alter_partitions_with_environment_context(self, seqid, iprot, oprot): + args = alter_partitions_with_environment_context_args() + args.read(iprot) + iprot.readMessageEnd() + result = alter_partitions_with_environment_context_result() + try: + self._handler.alter_partitions_with_environment_context(args.db_name, args.tbl_name, args.new_parts, args.environment_context) + msg_type = TMessageType.REPLY + except (TTransport.TTransportException, KeyboardInterrupt, SystemExit): + raise + except InvalidOperationException as o1: + msg_type = TMessageType.REPLY + result.o1 = o1 + except MetaException 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("alter_partitions_with_environment_context", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + def process_alter_partition_with_environment_context(self, seqid, iprot, oprot): args = alter_partition_with_environment_context_args() args.read(iprot) @@ -21053,6 +21128,200 @@ class alter_partitions_result: def __ne__(self, other): return not (self == other) +class alter_partitions_with_environment_context_args: + """ + Attributes: + - db_name + - tbl_name + - new_parts + - environment_context + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRING, 'db_name', None, None, ), # 1 + (2, TType.STRING, 'tbl_name', None, None, ), # 2 + (3, TType.LIST, 'new_parts', (TType.STRUCT,(Partition, Partition.thrift_spec)), None, ), # 3 + (4, TType.STRUCT, 'environment_context', (EnvironmentContext, EnvironmentContext.thrift_spec), None, ), # 4 + ) + + def __init__(self, db_name=None, tbl_name=None, new_parts=None, environment_context=None,): + self.db_name = db_name + self.tbl_name = tbl_name + self.new_parts = new_parts + self.environment_context = environment_context + + 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.LIST: + self.new_parts = [] + (_etype832, _size829) = iprot.readListBegin() + for _i833 in xrange(_size829): + _elem834 = Partition() + _elem834.read(iprot) + self.new_parts.append(_elem834) + iprot.readListEnd() + else: + iprot.skip(ftype) + elif fid == 4: + if ftype == TType.STRUCT: + self.environment_context = EnvironmentContext() + self.environment_context.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('alter_partitions_with_environment_context_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.new_parts is not None: + oprot.writeFieldBegin('new_parts', TType.LIST, 3) + oprot.writeListBegin(TType.STRUCT, len(self.new_parts)) + for iter835 in self.new_parts: + iter835.write(oprot) + oprot.writeListEnd() + oprot.writeFieldEnd() + if self.environment_context is not None: + oprot.writeFieldBegin('environment_context', TType.STRUCT, 4) + self.environment_context.write(oprot) + 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.new_parts) + value = (value * 31) ^ hash(self.environment_context) + 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 alter_partitions_with_environment_context_result: + """ + Attributes: + - o1 + - o2 + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'o1', (InvalidOperationException, InvalidOperationException.thrift_spec), None, ), # 1 + (2, TType.STRUCT, 'o2', (MetaException, MetaException.thrift_spec), None, ), # 2 + ) + + def __init__(self, o1=None, o2=None,): + 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 == 1: + if ftype == TType.STRUCT: + self.o1 = InvalidOperationException() + self.o1.read(iprot) + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRUCT: + self.o2 = MetaException() + 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('alter_partitions_with_environment_context_result') + 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.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 alter_partition_with_environment_context_args: """ Attributes: @@ -21284,10 +21553,10 @@ class rename_partition_args: elif fid == 3: if ftype == TType.LIST: self.part_vals = [] - (_etype832, _size829) = iprot.readListBegin() - for _i833 in xrange(_size829): - _elem834 = iprot.readString() - self.part_vals.append(_elem834) + (_etype839, _size836) = iprot.readListBegin() + for _i840 in xrange(_size836): + _elem841 = iprot.readString() + self.part_vals.append(_elem841) iprot.readListEnd() else: iprot.skip(ftype) @@ -21318,8 +21587,8 @@ class rename_partition_args: if self.part_vals is not None: oprot.writeFieldBegin('part_vals', TType.LIST, 3) oprot.writeListBegin(TType.STRING, len(self.part_vals)) - for iter835 in self.part_vals: - oprot.writeString(iter835) + for iter842 in self.part_vals: + oprot.writeString(iter842) oprot.writeListEnd() oprot.writeFieldEnd() if self.new_part is not None: @@ -21461,10 +21730,10 @@ class partition_name_has_valid_characters_args: if fid == 1: if ftype == TType.LIST: self.part_vals = [] - (_etype839, _size836) = iprot.readListBegin() - for _i840 in xrange(_size836): - _elem841 = iprot.readString() - self.part_vals.append(_elem841) + (_etype846, _size843) = iprot.readListBegin() + for _i847 in xrange(_size843): + _elem848 = iprot.readString() + self.part_vals.append(_elem848) iprot.readListEnd() else: iprot.skip(ftype) @@ -21486,8 +21755,8 @@ class partition_name_has_valid_characters_args: if self.part_vals is not None: oprot.writeFieldBegin('part_vals', TType.LIST, 1) oprot.writeListBegin(TType.STRING, len(self.part_vals)) - for iter842 in self.part_vals: - oprot.writeString(iter842) + for iter849 in self.part_vals: + oprot.writeString(iter849) oprot.writeListEnd() oprot.writeFieldEnd() if self.throw_exception is not None: @@ -21845,10 +22114,10 @@ class partition_name_to_vals_result: if fid == 0: if ftype == TType.LIST: self.success = [] - (_etype846, _size843) = iprot.readListBegin() - for _i847 in xrange(_size843): - _elem848 = iprot.readString() - self.success.append(_elem848) + (_etype853, _size850) = iprot.readListBegin() + for _i854 in xrange(_size850): + _elem855 = iprot.readString() + self.success.append(_elem855) iprot.readListEnd() else: iprot.skip(ftype) @@ -21871,8 +22140,8 @@ class partition_name_to_vals_result: if self.success is not None: oprot.writeFieldBegin('success', TType.LIST, 0) oprot.writeListBegin(TType.STRING, len(self.success)) - for iter849 in self.success: - oprot.writeString(iter849) + for iter856 in self.success: + oprot.writeString(iter856) oprot.writeListEnd() oprot.writeFieldEnd() if self.o1 is not None: @@ -21996,11 +22265,11 @@ class partition_name_to_spec_result: if fid == 0: if ftype == TType.MAP: self.success = {} - (_ktype851, _vtype852, _size850 ) = iprot.readMapBegin() - for _i854 in xrange(_size850): - _key855 = iprot.readString() - _val856 = iprot.readString() - self.success[_key855] = _val856 + (_ktype858, _vtype859, _size857 ) = iprot.readMapBegin() + for _i861 in xrange(_size857): + _key862 = iprot.readString() + _val863 = iprot.readString() + self.success[_key862] = _val863 iprot.readMapEnd() else: iprot.skip(ftype) @@ -22023,9 +22292,9 @@ class partition_name_to_spec_result: if self.success is not None: oprot.writeFieldBegin('success', TType.MAP, 0) oprot.writeMapBegin(TType.STRING, TType.STRING, len(self.success)) - for kiter857,viter858 in self.success.items(): - oprot.writeString(kiter857) - oprot.writeString(viter858) + for kiter864,viter865 in self.success.items(): + oprot.writeString(kiter864) + oprot.writeString(viter865) oprot.writeMapEnd() oprot.writeFieldEnd() if self.o1 is not None: @@ -22101,11 +22370,11 @@ class markPartitionForEvent_args: elif fid == 3: if ftype == TType.MAP: self.part_vals = {} - (_ktype860, _vtype861, _size859 ) = iprot.readMapBegin() - for _i863 in xrange(_size859): - _key864 = iprot.readString() - _val865 = iprot.readString() - self.part_vals[_key864] = _val865 + (_ktype867, _vtype868, _size866 ) = iprot.readMapBegin() + for _i870 in xrange(_size866): + _key871 = iprot.readString() + _val872 = iprot.readString() + self.part_vals[_key871] = _val872 iprot.readMapEnd() else: iprot.skip(ftype) @@ -22135,9 +22404,9 @@ class markPartitionForEvent_args: if self.part_vals is not None: oprot.writeFieldBegin('part_vals', TType.MAP, 3) oprot.writeMapBegin(TType.STRING, TType.STRING, len(self.part_vals)) - for kiter866,viter867 in self.part_vals.items(): - oprot.writeString(kiter866) - oprot.writeString(viter867) + for kiter873,viter874 in self.part_vals.items(): + oprot.writeString(kiter873) + oprot.writeString(viter874) oprot.writeMapEnd() oprot.writeFieldEnd() if self.eventType is not None: @@ -22351,11 +22620,11 @@ class isPartitionMarkedForEvent_args: elif fid == 3: if ftype == TType.MAP: self.part_vals = {} - (_ktype869, _vtype870, _size868 ) = iprot.readMapBegin() - for _i872 in xrange(_size868): - _key873 = iprot.readString() - _val874 = iprot.readString() - self.part_vals[_key873] = _val874 + (_ktype876, _vtype877, _size875 ) = iprot.readMapBegin() + for _i879 in xrange(_size875): + _key880 = iprot.readString() + _val881 = iprot.readString() + self.part_vals[_key880] = _val881 iprot.readMapEnd() else: iprot.skip(ftype) @@ -22385,9 +22654,9 @@ class isPartitionMarkedForEvent_args: if self.part_vals is not None: oprot.writeFieldBegin('part_vals', TType.MAP, 3) oprot.writeMapBegin(TType.STRING, TType.STRING, len(self.part_vals)) - for kiter875,viter876 in self.part_vals.items(): - oprot.writeString(kiter875) - oprot.writeString(viter876) + for kiter882,viter883 in self.part_vals.items(): + oprot.writeString(kiter882) + oprot.writeString(viter883) oprot.writeMapEnd() oprot.writeFieldEnd() if self.eventType is not None: @@ -23442,11 +23711,11 @@ class get_indexes_result: if fid == 0: if ftype == TType.LIST: self.success = [] - (_etype880, _size877) = iprot.readListBegin() - for _i881 in xrange(_size877): - _elem882 = Index() - _elem882.read(iprot) - self.success.append(_elem882) + (_etype887, _size884) = iprot.readListBegin() + for _i888 in xrange(_size884): + _elem889 = Index() + _elem889.read(iprot) + self.success.append(_elem889) iprot.readListEnd() else: iprot.skip(ftype) @@ -23475,8 +23744,8 @@ class get_indexes_result: if self.success is not None: oprot.writeFieldBegin('success', TType.LIST, 0) oprot.writeListBegin(TType.STRUCT, len(self.success)) - for iter883 in self.success: - iter883.write(oprot) + for iter890 in self.success: + iter890.write(oprot) oprot.writeListEnd() oprot.writeFieldEnd() if self.o1 is not None: @@ -23631,10 +23900,10 @@ class get_index_names_result: if fid == 0: if ftype == TType.LIST: self.success = [] - (_etype887, _size884) = iprot.readListBegin() - for _i888 in xrange(_size884): - _elem889 = iprot.readString() - self.success.append(_elem889) + (_etype894, _size891) = iprot.readListBegin() + for _i895 in xrange(_size891): + _elem896 = iprot.readString() + self.success.append(_elem896) iprot.readListEnd() else: iprot.skip(ftype) @@ -23657,8 +23926,8 @@ class get_index_names_result: if self.success is not None: oprot.writeFieldBegin('success', TType.LIST, 0) oprot.writeListBegin(TType.STRING, len(self.success)) - for iter890 in self.success: - oprot.writeString(iter890) + for iter897 in self.success: + oprot.writeString(iter897) oprot.writeListEnd() oprot.writeFieldEnd() if self.o2 is not None: @@ -26206,10 +26475,10 @@ class get_functions_result: if fid == 0: if ftype == TType.LIST: self.success = [] - (_etype894, _size891) = iprot.readListBegin() - for _i895 in xrange(_size891): - _elem896 = iprot.readString() - self.success.append(_elem896) + (_etype901, _size898) = iprot.readListBegin() + for _i902 in xrange(_size898): + _elem903 = iprot.readString() + self.success.append(_elem903) iprot.readListEnd() else: iprot.skip(ftype) @@ -26232,8 +26501,8 @@ class get_functions_result: if self.success is not None: oprot.writeFieldBegin('success', TType.LIST, 0) oprot.writeListBegin(TType.STRING, len(self.success)) - for iter897 in self.success: - oprot.writeString(iter897) + for iter904 in self.success: + oprot.writeString(iter904) oprot.writeListEnd() oprot.writeFieldEnd() if self.o1 is not None: @@ -26921,10 +27190,10 @@ class get_role_names_result: if fid == 0: if ftype == TType.LIST: self.success = [] - (_etype901, _size898) = iprot.readListBegin() - for _i902 in xrange(_size898): - _elem903 = iprot.readString() - self.success.append(_elem903) + (_etype908, _size905) = iprot.readListBegin() + for _i909 in xrange(_size905): + _elem910 = iprot.readString() + self.success.append(_elem910) iprot.readListEnd() else: iprot.skip(ftype) @@ -26947,8 +27216,8 @@ class get_role_names_result: if self.success is not None: oprot.writeFieldBegin('success', TType.LIST, 0) oprot.writeListBegin(TType.STRING, len(self.success)) - for iter904 in self.success: - oprot.writeString(iter904) + for iter911 in self.success: + oprot.writeString(iter911) oprot.writeListEnd() oprot.writeFieldEnd() if self.o1 is not None: @@ -27462,11 +27731,11 @@ class list_roles_result: if fid == 0: if ftype == TType.LIST: self.success = [] - (_etype908, _size905) = iprot.readListBegin() - for _i909 in xrange(_size905): - _elem910 = Role() - _elem910.read(iprot) - self.success.append(_elem910) + (_etype915, _size912) = iprot.readListBegin() + for _i916 in xrange(_size912): + _elem917 = Role() + _elem917.read(iprot) + self.success.append(_elem917) iprot.readListEnd() else: iprot.skip(ftype) @@ -27489,8 +27758,8 @@ class list_roles_result: if self.success is not None: oprot.writeFieldBegin('success', TType.LIST, 0) oprot.writeListBegin(TType.STRUCT, len(self.success)) - for iter911 in self.success: - iter911.write(oprot) + for iter918 in self.success: + iter918.write(oprot) oprot.writeListEnd() oprot.writeFieldEnd() if self.o1 is not None: @@ -27999,10 +28268,10 @@ class get_privilege_set_args: elif fid == 3: if ftype == TType.LIST: self.group_names = [] - (_etype915, _size912) = iprot.readListBegin() - for _i916 in xrange(_size912): - _elem917 = iprot.readString() - self.group_names.append(_elem917) + (_etype922, _size919) = iprot.readListBegin() + for _i923 in xrange(_size919): + _elem924 = iprot.readString() + self.group_names.append(_elem924) iprot.readListEnd() else: iprot.skip(ftype) @@ -28027,8 +28296,8 @@ class get_privilege_set_args: if self.group_names is not None: oprot.writeFieldBegin('group_names', TType.LIST, 3) oprot.writeListBegin(TType.STRING, len(self.group_names)) - for iter918 in self.group_names: - oprot.writeString(iter918) + for iter925 in self.group_names: + oprot.writeString(iter925) oprot.writeListEnd() oprot.writeFieldEnd() oprot.writeFieldStop() @@ -28255,11 +28524,11 @@ class list_privileges_result: if fid == 0: if ftype == TType.LIST: self.success = [] - (_etype922, _size919) = iprot.readListBegin() - for _i923 in xrange(_size919): - _elem924 = HiveObjectPrivilege() - _elem924.read(iprot) - self.success.append(_elem924) + (_etype929, _size926) = iprot.readListBegin() + for _i930 in xrange(_size926): + _elem931 = HiveObjectPrivilege() + _elem931.read(iprot) + self.success.append(_elem931) iprot.readListEnd() else: iprot.skip(ftype) @@ -28282,8 +28551,8 @@ class list_privileges_result: if self.success is not None: oprot.writeFieldBegin('success', TType.LIST, 0) oprot.writeListBegin(TType.STRUCT, len(self.success)) - for iter925 in self.success: - iter925.write(oprot) + for iter932 in self.success: + iter932.write(oprot) oprot.writeListEnd() oprot.writeFieldEnd() if self.o1 is not None: @@ -28781,10 +29050,10 @@ class set_ugi_args: elif fid == 2: if ftype == TType.LIST: self.group_names = [] - (_etype929, _size926) = iprot.readListBegin() - for _i930 in xrange(_size926): - _elem931 = iprot.readString() - self.group_names.append(_elem931) + (_etype936, _size933) = iprot.readListBegin() + for _i937 in xrange(_size933): + _elem938 = iprot.readString() + self.group_names.append(_elem938) iprot.readListEnd() else: iprot.skip(ftype) @@ -28805,8 +29074,8 @@ class set_ugi_args: if self.group_names is not None: oprot.writeFieldBegin('group_names', TType.LIST, 2) oprot.writeListBegin(TType.STRING, len(self.group_names)) - for iter932 in self.group_names: - oprot.writeString(iter932) + for iter939 in self.group_names: + oprot.writeString(iter939) oprot.writeListEnd() oprot.writeFieldEnd() oprot.writeFieldStop() @@ -28861,10 +29130,10 @@ class set_ugi_result: if fid == 0: if ftype == TType.LIST: self.success = [] - (_etype936, _size933) = iprot.readListBegin() - for _i937 in xrange(_size933): - _elem938 = iprot.readString() - self.success.append(_elem938) + (_etype943, _size940) = iprot.readListBegin() + for _i944 in xrange(_size940): + _elem945 = iprot.readString() + self.success.append(_elem945) iprot.readListEnd() else: iprot.skip(ftype) @@ -28887,8 +29156,8 @@ class set_ugi_result: if self.success is not None: oprot.writeFieldBegin('success', TType.LIST, 0) oprot.writeListBegin(TType.STRING, len(self.success)) - for iter939 in self.success: - oprot.writeString(iter939) + for iter946 in self.success: + oprot.writeString(iter946) oprot.writeListEnd() oprot.writeFieldEnd() if self.o1 is not None: http://git-wip-us.apache.org/repos/asf/hive/blob/78a85f82/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 9e47f7e..de316ae 100644 --- a/metastore/src/gen/thrift/gen-rb/thrift_hive_metastore.rb +++ b/metastore/src/gen/thrift/gen-rb/thrift_hive_metastore.rb @@ -1070,6 +1070,22 @@ module ThriftHiveMetastore return end + def alter_partitions_with_environment_context(db_name, tbl_name, new_parts, environment_context) + send_alter_partitions_with_environment_context(db_name, tbl_name, new_parts, environment_context) + recv_alter_partitions_with_environment_context() + end + + def send_alter_partitions_with_environment_context(db_name, tbl_name, new_parts, environment_context) + send_message('alter_partitions_with_environment_context', Alter_partitions_with_environment_context_args, :db_name => db_name, :tbl_name => tbl_name, :new_parts => new_parts, :environment_context => environment_context) + end + + def recv_alter_partitions_with_environment_context() + result = receive_message(Alter_partitions_with_environment_context_result) + raise result.o1 unless result.o1.nil? + raise result.o2 unless result.o2.nil? + return + end + def alter_partition_with_environment_context(db_name, tbl_name, new_part, environment_context) send_alter_partition_with_environment_context(db_name, tbl_name, new_part, environment_context) recv_alter_partition_with_environment_context() @@ -3091,6 +3107,19 @@ module ThriftHiveMetastore write_result(result, oprot, 'alter_partitions', seqid) end + def process_alter_partitions_with_environment_context(seqid, iprot, oprot) + args = read_args(iprot, Alter_partitions_with_environment_context_args) + result = Alter_partitions_with_environment_context_result.new() + begin + @handler.alter_partitions_with_environment_context(args.db_name, args.tbl_name, args.new_parts, args.environment_context) + rescue ::InvalidOperationException => o1 + result.o1 = o1 + rescue ::MetaException => o2 + result.o2 = o2 + end + write_result(result, oprot, 'alter_partitions_with_environment_context', seqid) + end + def process_alter_partition_with_environment_context(seqid, iprot, oprot) args = read_args(iprot, Alter_partition_with_environment_context_args) result = Alter_partition_with_environment_context_result.new() @@ -6384,6 +6413,46 @@ module ThriftHiveMetastore ::Thrift::Struct.generate_accessors self end + class Alter_partitions_with_environment_context_args + include ::Thrift::Struct, ::Thrift::Struct_Union + DB_NAME = 1 + TBL_NAME = 2 + NEW_PARTS = 3 + ENVIRONMENT_CONTEXT = 4 + + FIELDS = { + DB_NAME => {:type => ::Thrift::Types::STRING, :name => 'db_name'}, + TBL_NAME => {:type => ::Thrift::Types::STRING, :name => 'tbl_name'}, + NEW_PARTS => {:type => ::Thrift::Types::LIST, :name => 'new_parts', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Partition}}, + ENVIRONMENT_CONTEXT => {:type => ::Thrift::Types::STRUCT, :name => 'environment_context', :class => ::EnvironmentContext} + } + + def struct_fields; FIELDS; end + + def validate + end + + ::Thrift::Struct.generate_accessors self + end + + class Alter_partitions_with_environment_context_result + include ::Thrift::Struct, ::Thrift::Struct_Union + O1 = 1 + O2 = 2 + + FIELDS = { + O1 => {:type => ::Thrift::Types::STRUCT, :name => 'o1', :class => ::InvalidOperationException}, + O2 => {:type => ::Thrift::Types::STRUCT, :name => 'o2', :class => ::MetaException} + } + + def struct_fields; FIELDS; end + + def validate + end + + ::Thrift::Struct.generate_accessors self + end + class Alter_partition_with_environment_context_args include ::Thrift::Struct, ::Thrift::Struct_Union DB_NAME = 1 http://git-wip-us.apache.org/repos/asf/hive/blob/78a85f82/metastore/src/java/org/apache/hadoop/hive/metastore/AlterHandler.java ---------------------------------------------------------------------- diff --git a/metastore/src/java/org/apache/hadoop/hive/metastore/AlterHandler.java b/metastore/src/java/org/apache/hadoop/hive/metastore/AlterHandler.java index b565304..dedd449 100644 --- a/metastore/src/java/org/apache/hadoop/hive/metastore/AlterHandler.java +++ b/metastore/src/java/org/apache/hadoop/hive/metastore/AlterHandler.java @@ -21,6 +21,7 @@ import java.util.List; import org.apache.hadoop.conf.Configurable; import org.apache.hadoop.hive.metastore.api.AlreadyExistsException; +import org.apache.hadoop.hive.metastore.api.EnvironmentContext; import org.apache.hadoop.hive.metastore.api.InvalidObjectException; import org.apache.hadoop.hive.metastore.api.InvalidOperationException; import org.apache.hadoop.hive.metastore.api.MetaException; @@ -33,29 +34,6 @@ import org.apache.hadoop.hive.metastore.api.Table; public interface AlterHandler extends Configurable { /** - * handles alter table - * - * @param msdb - * object to get metadata - * @param wh - * TODO - * @param dbname - * database of the table being altered - * @param name - * original name of the table being altered. same as - * newTable.tableName if alter op is not a rename. - * @param newTable - * new table object - * @throws InvalidOperationException - * thrown if the newTable object is invalid - * @throws MetaException - * thrown if there is any other error - */ - public abstract void alterTable(RawStore msdb, Warehouse wh, String dbname, - String name, Table newTable) throws InvalidOperationException, - MetaException; - - /** * handles alter table, the changes could be cascaded to partitions if applicable * * @param msdb @@ -77,7 +55,7 @@ public interface AlterHandler extends Configurable { * thrown if there is any other error */ public abstract void alterTable(RawStore msdb, Warehouse wh, String dbname, - String name, Table newTable, boolean cascade) throws InvalidOperationException, + String name, Table newTable, EnvironmentContext envContext) throws InvalidOperationException, MetaException; /** @@ -101,7 +79,7 @@ public interface AlterHandler extends Configurable { * @throws MetaException */ public abstract Partition alterPartition(final RawStore msdb, Warehouse wh, final String dbname, - final String name, final List part_vals, final Partition new_part) + final String name, final List part_vals, final Partition new_part, EnvironmentContext environmentContext) throws InvalidOperationException, InvalidObjectException, AlreadyExistsException, MetaException; @@ -124,7 +102,7 @@ public interface AlterHandler extends Configurable { * @throws MetaException */ public abstract List alterPartitions(final RawStore msdb, Warehouse wh, - final String dbname, final String name, final List new_part) + final String dbname, final String name, final List new_part, EnvironmentContext environmentContext) throws InvalidOperationException, InvalidObjectException, AlreadyExistsException, MetaException; } http://git-wip-us.apache.org/repos/asf/hive/blob/78a85f82/metastore/src/java/org/apache/hadoop/hive/metastore/HiveAlterHandler.java ---------------------------------------------------------------------- diff --git a/metastore/src/java/org/apache/hadoop/hive/metastore/HiveAlterHandler.java b/metastore/src/java/org/apache/hadoop/hive/metastore/HiveAlterHandler.java index 628c37d..016926b 100644 --- a/metastore/src/java/org/apache/hadoop/hive/metastore/HiveAlterHandler.java +++ b/metastore/src/java/org/apache/hadoop/hive/metastore/HiveAlterHandler.java @@ -18,6 +18,7 @@ package org.apache.hadoop.hive.metastore; import com.google.common.collect.Lists; + import org.apache.commons.lang.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -26,11 +27,13 @@ import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hive.common.FileUtils; import org.apache.hadoop.hive.common.ObjectPair; +import org.apache.hadoop.hive.common.StatsSetupConst; import org.apache.hadoop.hive.conf.HiveConf; import org.apache.hadoop.hive.metastore.api.AlreadyExistsException; import org.apache.hadoop.hive.metastore.api.ColumnStatistics; import org.apache.hadoop.hive.metastore.api.ColumnStatisticsObj; import org.apache.hadoop.hive.metastore.api.Database; +import org.apache.hadoop.hive.metastore.api.EnvironmentContext; import org.apache.hadoop.hive.metastore.api.FieldSchema; import org.apache.hadoop.hive.metastore.api.InvalidInputException; import org.apache.hadoop.hive.metastore.api.InvalidObjectException; @@ -71,13 +74,11 @@ public class HiveAlterHandler implements AlterHandler { @Override public void alterTable(RawStore msdb, Warehouse wh, String dbname, - String name, Table newt) throws InvalidOperationException, MetaException { - alterTable(msdb, wh, dbname, name, newt, false); - } - - @Override - public void alterTable(RawStore msdb, Warehouse wh, String dbname, - String name, Table newt, boolean cascade) throws InvalidOperationException, MetaException { + String name, Table newt, EnvironmentContext environmentContext) throws InvalidOperationException, MetaException { + final boolean cascade = environmentContext != null + && environmentContext.isSetProperties() + && StatsSetupConst.TRUE.equals(environmentContext.getProperties().get( + StatsSetupConst.CASCADE)); if (newt == null) { throw new InvalidOperationException("New table is invalid: " + newt); } @@ -229,12 +230,12 @@ public class HiveAlterHandler implements AlterHandler { msdb.alterPartition(dbname, name, part.getValues(), part); } } - } else if (MetaStoreUtils.requireCalStats(hiveConf, null, null, newt) && + } else if (MetaStoreUtils.requireCalStats(hiveConf, null, null, newt, environmentContext) && (newt.getPartitionKeysSize() == 0)) { Database db = msdb.getDatabase(newt.getDbName()); // Update table stats. For partitioned table, we update stats in // alterPartition() - MetaStoreUtils.updateTableStatsFast(db, newt, wh, false, true); + MetaStoreUtils.updateTableStatsFast(db, newt, wh, false, true, environmentContext); } updateTableColumnStatsForAlterTable(msdb, oldt, newt); // now finally call alter table @@ -318,7 +319,7 @@ public class HiveAlterHandler implements AlterHandler { } @Override public Partition alterPartition(final RawStore msdb, Warehouse wh, final String dbname, - final String name, final List part_vals, final Partition new_part) + final String name, final List part_vals, final Partition new_part, EnvironmentContext environmentContext) throws InvalidOperationException, InvalidObjectException, AlreadyExistsException, MetaException { boolean success = false; @@ -344,8 +345,8 @@ public class HiveAlterHandler implements AlterHandler { if (part_vals == null || part_vals.size() == 0) { try { oldPart = msdb.getPartition(dbname, name, new_part.getValues()); - if (MetaStoreUtils.requireCalStats(hiveConf, oldPart, new_part, tbl)) { - MetaStoreUtils.updatePartitionStatsFast(new_part, wh, false, true); + if (MetaStoreUtils.requireCalStats(hiveConf, oldPart, new_part, tbl, environmentContext)) { + MetaStoreUtils.updatePartitionStatsFast(new_part, wh, false, true, environmentContext); } updatePartColumnStats(msdb, dbname, name, new_part.getValues(), new_part); msdb.alterPartition(dbname, name, new_part.getValues(), new_part); @@ -436,8 +437,8 @@ public class HiveAlterHandler implements AlterHandler { + tbl.getTableName() + " " + new_part.getValues()); } new_part.getSd().setLocation(newPartLoc); - if (MetaStoreUtils.requireCalStats(hiveConf, oldPart, new_part, tbl)) { - MetaStoreUtils.updatePartitionStatsFast(new_part, wh, false, true); + if (MetaStoreUtils.requireCalStats(hiveConf, oldPart, new_part, tbl, environmentContext)) { + MetaStoreUtils.updatePartitionStatsFast(new_part, wh, false, true, environmentContext); } String oldPartName = Warehouse.makePartName(tbl.getPartitionKeys(), oldPart.getValues()); try { @@ -492,7 +493,7 @@ public class HiveAlterHandler implements AlterHandler { @Override public List alterPartitions(final RawStore msdb, Warehouse wh, final String dbname, - final String name, final List new_parts) + final String name, final List new_parts, EnvironmentContext environmentContext) throws InvalidOperationException, InvalidObjectException, AlreadyExistsException, MetaException { List oldParts = new ArrayList(); @@ -512,8 +513,8 @@ public class HiveAlterHandler implements AlterHandler { oldParts.add(oldTmpPart); partValsList.add(tmpPart.getValues()); - if (MetaStoreUtils.requireCalStats(hiveConf, oldTmpPart, tmpPart, tbl)) { - MetaStoreUtils.updatePartitionStatsFast(tmpPart, wh, false, true); + if (MetaStoreUtils.requireCalStats(hiveConf, oldTmpPart, tmpPart, tbl, environmentContext)) { + MetaStoreUtils.updatePartitionStatsFast(tmpPart, wh, false, true, environmentContext); } updatePartColumnStats(msdb, dbname, name, oldTmpPart.getValues(), tmpPart); } http://git-wip-us.apache.org/repos/asf/hive/blob/78a85f82/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 98fbf70..9eb15bd 100644 --- a/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java +++ b/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java @@ -33,6 +33,7 @@ import org.apache.hadoop.fs.Path; import org.apache.hadoop.hive.common.FileUtils; import org.apache.hadoop.hive.common.JvmPauseMonitor; import org.apache.hadoop.hive.common.LogUtils; +import org.apache.hadoop.hive.common.StatsSetupConst; import org.apache.hadoop.hive.common.LogUtils.LogInitializationException; import org.apache.hadoop.hive.common.classification.InterfaceAudience; import org.apache.hadoop.hive.common.classification.InterfaceStability; @@ -1374,7 +1375,7 @@ public class HiveMetaStore extends ThriftHiveMetastore { } if (HiveConf.getBoolVar(hiveConf, HiveConf.ConfVars.HIVESTATSAUTOGATHER) && !MetaStoreUtils.isView(tbl)) { - MetaStoreUtils.updateTableStatsFast(db, tbl, wh, madeDir); + MetaStoreUtils.updateTableStatsFast(db, tbl, wh, madeDir, envContext); } // set create time @@ -1981,7 +1982,7 @@ public class HiveMetaStore extends ThriftHiveMetastore { if (HiveConf.getBoolVar(hiveConf, HiveConf.ConfVars.HIVESTATSAUTOGATHER) && !MetaStoreUtils.isView(tbl)) { - MetaStoreUtils.updatePartitionStatsFast(part, wh, madeDir); + MetaStoreUtils.updatePartitionStatsFast(part, wh, madeDir, envContext); } success = ms.addPartition(part); @@ -2409,7 +2410,7 @@ public class HiveMetaStore extends ThriftHiveMetastore { final Table tbl, final PartitionSpecProxy.PartitionIterator part, boolean madeDir) throws MetaException { if (HiveConf.getBoolVar(hiveConf, HiveConf.ConfVars.HIVESTATSAUTOGATHER) && !MetaStoreUtils.isView(tbl)) { - MetaStoreUtils.updatePartitionStatsFast(part, wh, madeDir, false); + MetaStoreUtils.updatePartitionStatsFast(part, wh, madeDir, false, null); } // set create time @@ -3266,7 +3267,7 @@ public class HiveMetaStore extends ThriftHiveMetastore { partitionValidationPattern); } - oldPart = alterHandler.alterPartition(getMS(), wh, db_name, tbl_name, part_vals, new_part); + oldPart = alterHandler.alterPartition(getMS(), wh, db_name, tbl_name, part_vals, new_part, envContext); // Only fetch the table if we actually have a listener Table table = null; @@ -3304,7 +3305,14 @@ public class HiveMetaStore extends ThriftHiveMetastore { @Override public void alter_partitions(final String db_name, final String tbl_name, - final List new_parts) + final List new_parts) throws InvalidOperationException, MetaException, + TException { + alter_partitions_with_environment_context(db_name, tbl_name, new_parts, null); + } + + @Override + public void alter_partitions_with_environment_context(final String db_name, final String tbl_name, + final List new_parts, EnvironmentContext environmentContext) throws InvalidOperationException, MetaException, TException { @@ -3323,7 +3331,7 @@ public class HiveMetaStore extends ThriftHiveMetastore { for (Partition tmpPart : new_parts) { firePreEvent(new PreAlterPartitionEvent(db_name, tbl_name, null, tmpPart, this)); } - oldParts = alterHandler.alterPartitions(getMS(), wh, db_name, tbl_name, new_parts); + oldParts = alterHandler.alterPartitions(getMS(), wh, db_name, tbl_name, new_parts, environmentContext); Iterator olditr = oldParts.iterator(); // Only fetch the table if we have a listener that needs it. @@ -3420,15 +3428,19 @@ public class HiveMetaStore extends ThriftHiveMetastore { final Table newTable) throws InvalidOperationException, MetaException { // Do not set an environment context. - alter_table_core(dbname,name, newTable, null, false); + alter_table_core(dbname,name, newTable, null); } @Override public void alter_table_with_cascade(final String dbname, final String name, final Table newTable, final boolean cascade) throws InvalidOperationException, MetaException { - // Do not set an environment context. - alter_table_core(dbname,name, newTable, null, cascade); + EnvironmentContext envContext = null; + if (cascade) { + envContext = new EnvironmentContext(); + envContext.putToProperties(StatsSetupConst.CASCADE, StatsSetupConst.TRUE); + } + alter_table_core(dbname, name, newTable, envContext); } @Override @@ -3436,15 +3448,14 @@ public class HiveMetaStore extends ThriftHiveMetastore { final String name, final Table newTable, final EnvironmentContext envContext) throws InvalidOperationException, MetaException { - alter_table_core(dbname, name, newTable, envContext, false); + alter_table_core(dbname, name, newTable, envContext); } private void alter_table_core(final String dbname, final String name, final Table newTable, - final EnvironmentContext envContext, final boolean cascade) + final EnvironmentContext envContext) throws InvalidOperationException, MetaException { startFunction("alter_table", ": db=" + dbname + " tbl=" + name + " newtbl=" + newTable.getTableName()); - // Update the time if it hasn't been specified. if (newTable.getParameters() == null || newTable.getParameters().get(hive_metastoreConstants.DDL_TIME) == null) { @@ -3466,7 +3477,7 @@ public class HiveMetaStore extends ThriftHiveMetastore { try { Table oldt = get_table_core(dbname, name); firePreEvent(new PreAlterTableEvent(oldt, newTable, this)); - alterHandler.alterTable(getMS(), wh, dbname, name, newTable, cascade); + alterHandler.alterTable(getMS(), wh, dbname, name, newTable, envContext); success = true; for (MetaStoreEventListener listener : listeners) { http://git-wip-us.apache.org/repos/asf/hive/blob/78a85f82/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 bcc729c..b5c4d1d 100644 --- a/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java +++ b/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java @@ -19,6 +19,7 @@ package org.apache.hadoop.hive.metastore; import org.apache.hadoop.hive.common.ObjectPair; +import org.apache.hadoop.hive.common.StatsSetupConst; import org.apache.hadoop.hive.common.ValidTxnList; import org.apache.hadoop.hive.common.classification.InterfaceAudience; import org.apache.hadoop.hive.common.classification.InterfaceAudience.Public; @@ -371,16 +372,10 @@ public class HiveMetaStoreClient implements IMetaStoreClient { @Override public void alter_table(String dbname, String tbl_name, Table new_tbl) throws InvalidOperationException, MetaException, TException { - alter_table(dbname, tbl_name, new_tbl, null); + alter_table_with_environmentContext(dbname, tbl_name, new_tbl, null); } - @Override - public void alter_table(String dbname, String tbl_name, Table new_tbl, boolean cascade) - throws InvalidOperationException, MetaException, TException { - client.alter_table_with_cascade(dbname, tbl_name, new_tbl, cascade); - } - - public void alter_table(String dbname, String tbl_name, Table new_tbl, + public void alter_table_with_environmentContext(String dbname, String tbl_name, Table new_tbl, EnvironmentContext envContext) throws InvalidOperationException, MetaException, TException { client.alter_table_with_environment_context(dbname, tbl_name, new_tbl, envContext); } @@ -1416,15 +1411,15 @@ public class HiveMetaStoreClient implements IMetaStoreClient { } @Override - public void alter_partition(String dbName, String tblName, Partition newPart) + public void alter_partition(String dbName, String tblName, Partition newPart, EnvironmentContext environmentContext) throws InvalidOperationException, MetaException, TException { - client.alter_partition(dbName, tblName, newPart); + client.alter_partition_with_environment_context(dbName, tblName, newPart, environmentContext); } @Override - public void alter_partitions(String dbName, String tblName, List newParts) + public void alter_partitions(String dbName, String tblName, List newParts, EnvironmentContext environmentContext) throws InvalidOperationException, MetaException, TException { - client.alter_partitions(dbName, tblName, newParts); + client.alter_partitions_with_environment_context(dbName, tblName, newParts, environmentContext); } @Override