Repository: hive Updated Branches: refs/heads/master c8dccfdde -> 55d8ee0b5
HIVE-17494: Bootstrap REPL DUMP throws exception if a partitioned table is dropped while reading partitions (Sankar Hariappan, reviewed by Daniel Dai) Project: http://git-wip-us.apache.org/repos/asf/hive/repo Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/55d8ee0b Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/55d8ee0b Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/55d8ee0b Branch: refs/heads/master Commit: 55d8ee0b510ba6ce0233c81293b912534d80f732 Parents: c8dccfd Author: Daniel Dai <da...@hortonworks.com> Authored: Tue Sep 12 12:52:49 2017 -0700 Committer: Daniel Dai <da...@hortonworks.com> Committed: Tue Sep 12 12:53:29 2017 -0700 ---------------------------------------------------------------------- .../hive/ql/parse/TestReplicationScenarios.java | 64 +++++++++ .../hadoop/hive/metastore/HiveMetaStore.java | 2 +- .../hive/metastore/HiveMetaStoreClient.java | 2 +- .../hadoop/hive/metastore/IMetaStoreClient.java | 2 +- .../apache/hadoop/hive/ql/metadata/Hive.java | 1 - .../hive/ql/parse/repl/dump/TableExport.java | 9 +- .../gen/thrift/gen-cpp/ThriftHiveMetastore.cpp | 32 ++++- .../gen/thrift/gen-cpp/ThriftHiveMetastore.h | 12 +- .../hive/metastore/api/ThriftHiveMetastore.java | 140 +++++++++++++++++-- .../gen-php/metastore/ThriftHiveMetastore.php | 31 +++- .../hive_metastore/ThriftHiveMetastore.py | 25 +++- .../gen/thrift/gen-rb/thrift_hive_metastore.rb | 7 +- .../src/main/thrift/hive_metastore.thrift | 2 +- 13 files changed, 303 insertions(+), 26 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hive/blob/55d8ee0b/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/parse/TestReplicationScenarios.java ---------------------------------------------------------------------- diff --git a/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/parse/TestReplicationScenarios.java b/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/parse/TestReplicationScenarios.java index 40fc3fa..ba2b3f3 100644 --- a/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/parse/TestReplicationScenarios.java +++ b/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/parse/TestReplicationScenarios.java @@ -627,6 +627,70 @@ public class TestReplicationScenarios { } @Test + public void testBootstrapWithDropPartitionedTable() throws IOException { + String name = testName.getMethodName(); + String dbName = createDB(name, driver); + String replDbName = dbName + "_dupe"; + run("CREATE TABLE " + dbName + ".ptned(a string) partitioned by (b int) STORED AS TEXTFILE", driver); + + String[] ptn_data = new String[]{ "eleven" , "twelve" }; + String[] empty = new String[]{}; + String ptn_locn = new Path(TEST_PATH, name + "_ptn").toUri().getPath(); + + createTestDataFile(ptn_locn, ptn_data); + run("LOAD DATA LOCAL INPATH '" + ptn_locn + "' OVERWRITE INTO TABLE " + dbName + ".ptned PARTITION(b=1)", driver); + + BehaviourInjection<Table,Table> ptnedTableRenamer = new BehaviourInjection<Table,Table>(){ + boolean success = false; + + @Nullable + @Override + public Table apply(@Nullable Table table) { + if (injectionPathCalled) { + nonInjectedPathCalled = true; + } else { + // getTable is invoked after fetching the table names + injectionPathCalled = true; + Thread t = new Thread(new Runnable() { + public void run() { + try { + LOG.info("Entered new thread"); + Driver driver2 = new Driver(hconf); + SessionState.start(new CliSessionState(hconf)); + CommandProcessorResponse ret = driver2.run("DROP TABLE " + dbName + ".ptned"); + success = (ret.getException() == null); + assertTrue(success); + LOG.info("Exit new thread success - {}", success); + } catch (CommandNeedRetryException e) { + LOG.info("Hit Exception {} from new thread", e.getMessage()); + throw new RuntimeException(e); + } + } + }); + t.start(); + LOG.info("Created new thread {}", t.getName()); + try { + t.join(); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + } + return table; + } + }; + InjectableBehaviourObjectStore.setGetTableBehaviour(ptnedTableRenamer); + + Tuple bootstrap = bootstrapLoadAndVerify(dbName, replDbName); + + ptnedTableRenamer.assertInjectionsPerformed(true,true); + InjectableBehaviourObjectStore.resetGetTableBehaviour(); // reset the behaviour + + incrementalLoadAndVerify(dbName, bootstrap.lastReplId, replDbName); + verifyIfTableNotExist(replDbName, "ptned", metaStoreClientMirror); + + } + + @Test public void testIncrementalAdds() throws IOException { String name = testName.getMethodName(); String dbName = createDB(name, driver); http://git-wip-us.apache.org/repos/asf/hive/blob/55d8ee0b/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 5812a1b..6393c8e 100644 --- a/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java +++ b/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java @@ -4112,7 +4112,7 @@ public class HiveMetaStore extends ThriftHiveMetastore { @Override public List<String> get_partition_names(final String db_name, final String tbl_name, - final short max_parts) throws MetaException, NoSuchObjectException { + final short max_parts) throws NoSuchObjectException, MetaException { startTableFunction("get_partition_names", db_name, tbl_name); fireReadTablePreEvent(db_name, tbl_name); List<String> ret = null; http://git-wip-us.apache.org/repos/asf/hive/blob/55d8ee0b/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 70451c4..751dd91 100644 --- a/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java +++ b/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java @@ -1522,7 +1522,7 @@ public class HiveMetaStoreClient implements IMetaStoreClient, AutoCloseable { @Override public List<String> listPartitionNames(String dbName, String tblName, - short max) throws MetaException, TException { + short max) throws NoSuchObjectException, MetaException, TException { return filterHook.filterPartitionNames(dbName, tblName, client.get_partition_names(dbName, tblName, max)); } http://git-wip-us.apache.org/repos/asf/hive/blob/55d8ee0b/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 69a845c..4d251d1 100644 --- a/metastore/src/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java +++ b/metastore/src/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java @@ -581,7 +581,7 @@ public interface IMetaStoreClient { List<String> part_vals, short max_parts) throws NoSuchObjectException, MetaException, TException; List<String> listPartitionNames(String db_name, String tbl_name, - short max_parts) throws MetaException, TException; + short max_parts) throws NoSuchObjectException, MetaException, TException; List<String> listPartitionNames(String db_name, String tbl_name, List<String> part_vals, short max_parts) http://git-wip-us.apache.org/repos/asf/hive/blob/55d8ee0b/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 aa44c62..9f98b69 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 @@ -151,7 +151,6 @@ import org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe; import org.apache.hadoop.hive.shims.HadoopShims; import org.apache.hadoop.hive.shims.ShimLoader; import org.apache.hadoop.mapred.InputFormat; -import org.apache.hadoop.security.AccessControlException; import org.apache.hadoop.security.UserGroupInformation; import org.apache.hadoop.util.StringUtils; import org.apache.thrift.TException; http://git-wip-us.apache.org/repos/asf/hive/blob/55d8ee0b/ql/src/java/org/apache/hadoop/hive/ql/parse/repl/dump/TableExport.java ---------------------------------------------------------------------- diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/repl/dump/TableExport.java b/ql/src/java/org/apache/hadoop/hive/ql/parse/repl/dump/TableExport.java index e490633..ed43272 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/parse/repl/dump/TableExport.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/repl/dump/TableExport.java @@ -22,10 +22,12 @@ import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hive.common.FileUtils; import org.apache.hadoop.hive.conf.HiveConf; +import org.apache.hadoop.hive.metastore.api.NoSuchObjectException; import org.apache.hadoop.hive.ql.ErrorMsg; import org.apache.hadoop.hive.ql.hooks.ReadEntity; import org.apache.hadoop.hive.ql.hooks.WriteEntity; import org.apache.hadoop.hive.ql.metadata.Hive; +import org.apache.hadoop.hive.ql.metadata.HiveException; import org.apache.hadoop.hive.ql.metadata.PartitionIterable; import org.apache.hadoop.hive.ql.parse.BaseSemanticAnalyzer.TableSpec; import org.apache.hadoop.hive.ql.parse.EximUtil; @@ -38,6 +40,7 @@ import org.slf4j.LoggerFactory; import java.io.FileNotFoundException; import java.io.IOException; import java.net.URI; +import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; import java.util.Set; @@ -111,7 +114,11 @@ public class TableExport { // or this is a noop-replication export, so we can skip looking at ptns. return null; } - } catch (Exception e) { + } catch (HiveException e) { + if (e.getCause() instanceof NoSuchObjectException) { + // If table is dropped when dump in progress, just skip partitions dump + return new PartitionIterable(new ArrayList<>()); + } throw new SemanticException("Error when identifying partitions", e); } } http://git-wip-us.apache.org/repos/asf/hive/blob/55d8ee0b/standalone-metastore/src/gen/thrift/gen-cpp/ThriftHiveMetastore.cpp ---------------------------------------------------------------------- diff --git a/standalone-metastore/src/gen/thrift/gen-cpp/ThriftHiveMetastore.cpp b/standalone-metastore/src/gen/thrift/gen-cpp/ThriftHiveMetastore.cpp index 569bc45..e285021 100644 --- a/standalone-metastore/src/gen/thrift/gen-cpp/ThriftHiveMetastore.cpp +++ b/standalone-metastore/src/gen/thrift/gen-cpp/ThriftHiveMetastore.cpp @@ -16454,6 +16454,14 @@ uint32_t ThriftHiveMetastore_get_partition_names_result::read(::apache::thrift:: 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 { @@ -16490,8 +16498,12 @@ uint32_t ThriftHiveMetastore_get_partition_names_result::write(::apache::thrift: xfer += oprot->writeListEnd(); } 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, 1); + xfer += oprot->writeFieldBegin("o2", ::apache::thrift::protocol::T_STRUCT, 2); xfer += this->o2.write(oprot); xfer += oprot->writeFieldEnd(); } @@ -16548,6 +16560,14 @@ uint32_t ThriftHiveMetastore_get_partition_names_presult::read(::apache::thrift: 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 { @@ -43729,6 +43749,9 @@ void ThriftHiveMetastoreClient::recv_get_partition_names(std::vector<std::string // _return pointer has now been filled return; } + if (result.__isset.o1) { + throw result.o1; + } if (result.__isset.o2) { throw result.o2; } @@ -53620,6 +53643,9 @@ void ThriftHiveMetastoreProcessor::process_get_partition_names(int32_t seqid, :: try { iface_->get_partition_names(result.success, args.db_name, args.tbl_name, args.max_parts); result.__isset.success = true; + } catch (NoSuchObjectException &o1) { + result.o1 = o1; + result.__isset.o1 = true; } catch (MetaException &o2) { result.o2 = o2; result.__isset.o2 = true; @@ -65156,6 +65182,10 @@ void ThriftHiveMetastoreConcurrentClient::recv_get_partition_names(std::vector<s sentry.commit(); return; } + if (result.__isset.o1) { + sentry.commit(); + throw result.o1; + } if (result.__isset.o2) { sentry.commit(); throw result.o2; http://git-wip-us.apache.org/repos/asf/hive/blob/55d8ee0b/standalone-metastore/src/gen/thrift/gen-cpp/ThriftHiveMetastore.h ---------------------------------------------------------------------- diff --git a/standalone-metastore/src/gen/thrift/gen-cpp/ThriftHiveMetastore.h b/standalone-metastore/src/gen/thrift/gen-cpp/ThriftHiveMetastore.h index 3094394..b7834f8 100644 --- a/standalone-metastore/src/gen/thrift/gen-cpp/ThriftHiveMetastore.h +++ b/standalone-metastore/src/gen/thrift/gen-cpp/ThriftHiveMetastore.h @@ -8697,8 +8697,9 @@ class ThriftHiveMetastore_get_partition_names_pargs { }; typedef struct _ThriftHiveMetastore_get_partition_names_result__isset { - _ThriftHiveMetastore_get_partition_names_result__isset() : success(false), o2(false) {} + _ThriftHiveMetastore_get_partition_names_result__isset() : success(false), o1(false), o2(false) {} bool success :1; + bool o1 :1; bool o2 :1; } _ThriftHiveMetastore_get_partition_names_result__isset; @@ -8712,18 +8713,23 @@ class ThriftHiveMetastore_get_partition_names_result { virtual ~ThriftHiveMetastore_get_partition_names_result() throw(); std::vector<std::string> success; + NoSuchObjectException o1; MetaException o2; _ThriftHiveMetastore_get_partition_names_result__isset __isset; void __set_success(const std::vector<std::string> & val); + void __set_o1(const NoSuchObjectException& val); + void __set_o2(const MetaException& val); bool operator == (const ThriftHiveMetastore_get_partition_names_result & rhs) const { if (!(success == rhs.success)) return false; + if (!(o1 == rhs.o1)) + return false; if (!(o2 == rhs.o2)) return false; return true; @@ -8740,8 +8746,9 @@ class ThriftHiveMetastore_get_partition_names_result { }; typedef struct _ThriftHiveMetastore_get_partition_names_presult__isset { - _ThriftHiveMetastore_get_partition_names_presult__isset() : success(false), o2(false) {} + _ThriftHiveMetastore_get_partition_names_presult__isset() : success(false), o1(false), o2(false) {} bool success :1; + bool o1 :1; bool o2 :1; } _ThriftHiveMetastore_get_partition_names_presult__isset; @@ -8751,6 +8758,7 @@ class ThriftHiveMetastore_get_partition_names_presult { virtual ~ThriftHiveMetastore_get_partition_names_presult() throw(); std::vector<std::string> * success; + NoSuchObjectException o1; MetaException o2; _ThriftHiveMetastore_get_partition_names_presult__isset __isset; http://git-wip-us.apache.org/repos/asf/hive/blob/55d8ee0b/standalone-metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/ThriftHiveMetastore.java ---------------------------------------------------------------------- diff --git a/standalone-metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/ThriftHiveMetastore.java b/standalone-metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/ThriftHiveMetastore.java index 47335b4..4e49b7c 100644 --- a/standalone-metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/ThriftHiveMetastore.java +++ b/standalone-metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/ThriftHiveMetastore.java @@ -164,7 +164,7 @@ public class ThriftHiveMetastore { public List<PartitionSpec> get_partitions_pspec(String db_name, String tbl_name, int max_parts) throws NoSuchObjectException, MetaException, org.apache.thrift.TException; - public List<String> get_partition_names(String db_name, String tbl_name, short max_parts) throws MetaException, org.apache.thrift.TException; + public List<String> get_partition_names(String db_name, String tbl_name, short max_parts) throws NoSuchObjectException, MetaException, org.apache.thrift.TException; public List<Partition> get_partitions_ps(String db_name, String tbl_name, List<String> part_vals, short max_parts) throws MetaException, NoSuchObjectException, org.apache.thrift.TException; @@ -2562,7 +2562,7 @@ public class ThriftHiveMetastore { throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "get_partitions_pspec failed: unknown result"); } - public List<String> get_partition_names(String db_name, String tbl_name, short max_parts) throws MetaException, org.apache.thrift.TException + public List<String> get_partition_names(String db_name, String tbl_name, short max_parts) throws NoSuchObjectException, MetaException, org.apache.thrift.TException { send_get_partition_names(db_name, tbl_name, max_parts); return recv_get_partition_names(); @@ -2577,13 +2577,16 @@ public class ThriftHiveMetastore { sendBase("get_partition_names", args); } - public List<String> recv_get_partition_names() throws MetaException, org.apache.thrift.TException + public List<String> recv_get_partition_names() throws NoSuchObjectException, MetaException, org.apache.thrift.TException { get_partition_names_result result = new get_partition_names_result(); receiveBase(result, "get_partition_names"); if (result.isSetSuccess()) { return result.success; } + if (result.o1 != null) { + throw result.o1; + } if (result.o2 != null) { throw result.o2; } @@ -7584,7 +7587,7 @@ public class ThriftHiveMetastore { prot.writeMessageEnd(); } - public List<String> getResult() throws MetaException, org.apache.thrift.TException { + public List<String> getResult() throws NoSuchObjectException, MetaException, org.apache.thrift.TException { if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { throw new IllegalStateException("Method call not finished!"); } @@ -12811,6 +12814,8 @@ public class ThriftHiveMetastore { get_partition_names_result result = new get_partition_names_result(); try { result.success = iface.get_partition_names(args.db_name, args.tbl_name, args.max_parts); + } catch (NoSuchObjectException o1) { + result.o1 = o1; } catch (MetaException o2) { result.o2 = o2; } @@ -19317,7 +19322,12 @@ public class ThriftHiveMetastore { byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; org.apache.thrift.TBase msg; get_partition_names_result result = new get_partition_names_result(); - if (e instanceof MetaException) { + if (e instanceof NoSuchObjectException) { + result.o1 = (NoSuchObjectException) e; + result.setO1IsSet(true); + msg = result; + } + else if (e instanceof MetaException) { result.o2 = (MetaException) e; result.setO2IsSet(true); msg = result; @@ -93329,7 +93339,8 @@ public class ThriftHiveMetastore { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("get_partition_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 O2_FIELD_DESC = new org.apache.thrift.protocol.TField("o2", org.apache.thrift.protocol.TType.STRUCT, (short)1); + 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 { @@ -93338,12 +93349,14 @@ public class ThriftHiveMetastore { } private List<String> success; // required + private NoSuchObjectException o1; // required private MetaException 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"), - O2((short)1, "o2"); + O1((short)1, "o1"), + O2((short)2, "o2"); private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); @@ -93360,7 +93373,9 @@ public class ThriftHiveMetastore { switch(fieldId) { case 0: // SUCCESS return SUCCESS; - case 1: // O2 + case 1: // O1 + return O1; + case 2: // O2 return O2; default: return null; @@ -93408,6 +93423,8 @@ public class ThriftHiveMetastore { 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.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)))); + 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); @@ -93419,10 +93436,12 @@ public class ThriftHiveMetastore { public get_partition_names_result( List<String> success, + NoSuchObjectException o1, MetaException o2) { this(); this.success = success; + this.o1 = o1; this.o2 = o2; } @@ -93434,6 +93453,9 @@ public class ThriftHiveMetastore { List<String> __this__success = new ArrayList<String>(other.success); this.success = __this__success; } + if (other.isSetO1()) { + this.o1 = new NoSuchObjectException(other.o1); + } if (other.isSetO2()) { this.o2 = new MetaException(other.o2); } @@ -93446,6 +93468,7 @@ public class ThriftHiveMetastore { @Override public void clear() { this.success = null; + this.o1 = null; this.o2 = null; } @@ -93487,6 +93510,29 @@ public class ThriftHiveMetastore { } } + public NoSuchObjectException getO1() { + return this.o1; + } + + public void setO1(NoSuchObjectException o1) { + this.o1 = o1; + } + + public void unsetO1() { + this.o1 = null; + } + + /** Returns true if field o1 is set (has been assigned a value) and false otherwise */ + public boolean isSetO1() { + return this.o1 != null; + } + + public void setO1IsSet(boolean value) { + if (!value) { + this.o1 = null; + } + } + public MetaException getO2() { return this.o2; } @@ -93520,6 +93566,14 @@ public class ThriftHiveMetastore { } break; + case O1: + if (value == null) { + unsetO1(); + } else { + setO1((NoSuchObjectException)value); + } + break; + case O2: if (value == null) { unsetO2(); @@ -93536,6 +93590,9 @@ public class ThriftHiveMetastore { case SUCCESS: return getSuccess(); + case O1: + return getO1(); + case O2: return getO2(); @@ -93552,6 +93609,8 @@ public class ThriftHiveMetastore { switch (field) { case SUCCESS: return isSetSuccess(); + case O1: + return isSetO1(); case O2: return isSetO2(); } @@ -93580,6 +93639,15 @@ public class ThriftHiveMetastore { return false; } + boolean this_present_o1 = true && this.isSetO1(); + boolean that_present_o1 = true && that.isSetO1(); + if (this_present_o1 || that_present_o1) { + if (!(this_present_o1 && that_present_o1)) + return false; + if (!this.o1.equals(that.o1)) + return false; + } + boolean this_present_o2 = true && this.isSetO2(); boolean that_present_o2 = true && that.isSetO2(); if (this_present_o2 || that_present_o2) { @@ -93601,6 +93669,11 @@ public class ThriftHiveMetastore { if (present_success) list.add(success); + boolean present_o1 = true && (isSetO1()); + list.add(present_o1); + if (present_o1) + list.add(o1); + boolean present_o2 = true && (isSetO2()); list.add(present_o2); if (present_o2) @@ -93627,6 +93700,16 @@ public class ThriftHiveMetastore { return lastComparison; } } + lastComparison = Boolean.valueOf(isSetO1()).compareTo(other.isSetO1()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetO1()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.o1, other.o1); + if (lastComparison != 0) { + return lastComparison; + } + } lastComparison = Boolean.valueOf(isSetO2()).compareTo(other.isSetO2()); if (lastComparison != 0) { return lastComparison; @@ -93665,6 +93748,14 @@ public class ThriftHiveMetastore { } first = false; if (!first) sb.append(", "); + sb.append("o1:"); + if (this.o1 == null) { + sb.append("null"); + } else { + sb.append(this.o1); + } + first = false; + if (!first) sb.append(", "); sb.append("o2:"); if (this.o2 == null) { sb.append("null"); @@ -93733,7 +93824,16 @@ public class ThriftHiveMetastore { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; - case 1: // O2 + case 1: // O1 + if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { + struct.o1 = new NoSuchObjectException(); + struct.o1.read(iprot); + struct.setO1IsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // O2 if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { struct.o2 = new MetaException(); struct.o2.read(iprot); @@ -93767,6 +93867,11 @@ public class ThriftHiveMetastore { } oprot.writeFieldEnd(); } + if (struct.o1 != null) { + oprot.writeFieldBegin(O1_FIELD_DESC); + struct.o1.write(oprot); + oprot.writeFieldEnd(); + } if (struct.o2 != null) { oprot.writeFieldBegin(O2_FIELD_DESC); struct.o2.write(oprot); @@ -93793,10 +93898,13 @@ public class ThriftHiveMetastore { 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()); @@ -93806,6 +93914,9 @@ public class ThriftHiveMetastore { } } } + if (struct.isSetO1()) { + struct.o1.write(oprot); + } if (struct.isSetO2()) { struct.o2.write(oprot); } @@ -93814,7 +93925,7 @@ public class ThriftHiveMetastore { @Override public void read(org.apache.thrift.protocol.TProtocol prot, get_partition_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)) { { org.apache.thrift.protocol.TList _list1005 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32()); @@ -93829,6 +93940,11 @@ public class ThriftHiveMetastore { struct.setSuccessIsSet(true); } if (incoming.get(1)) { + struct.o1 = new NoSuchObjectException(); + struct.o1.read(iprot); + struct.setO1IsSet(true); + } + if (incoming.get(2)) { struct.o2 = new MetaException(); struct.o2.read(iprot); struct.setO2IsSet(true); http://git-wip-us.apache.org/repos/asf/hive/blob/55d8ee0b/standalone-metastore/src/gen/thrift/gen-php/metastore/ThriftHiveMetastore.php ---------------------------------------------------------------------- diff --git a/standalone-metastore/src/gen/thrift/gen-php/metastore/ThriftHiveMetastore.php b/standalone-metastore/src/gen/thrift/gen-php/metastore/ThriftHiveMetastore.php index 644def0..dbe0f4e 100644 --- a/standalone-metastore/src/gen/thrift/gen-php/metastore/ThriftHiveMetastore.php +++ b/standalone-metastore/src/gen/thrift/gen-php/metastore/ThriftHiveMetastore.php @@ -537,6 +537,7 @@ interface ThriftHiveMetastoreIf extends \FacebookServiceIf { * @param string $tbl_name * @param int $max_parts * @return string[] + * @throws \metastore\NoSuchObjectException * @throws \metastore\MetaException */ public function get_partition_names($db_name, $tbl_name, $max_parts); @@ -4854,6 +4855,9 @@ class ThriftHiveMetastoreClient extends \FacebookServiceClient implements \metas if ($result->success !== null) { return $result->success; } + if ($result->o1 !== null) { + throw $result->o1; + } if ($result->o2 !== null) { throw $result->o2; } @@ -25914,6 +25918,10 @@ class ThriftHiveMetastore_get_partition_names_result { */ public $success = null; /** + * @var \metastore\NoSuchObjectException + */ + public $o1 = null; + /** * @var \metastore\MetaException */ public $o2 = null; @@ -25930,6 +25938,11 @@ class ThriftHiveMetastore_get_partition_names_result { ), ), 1 => array( + 'var' => 'o1', + 'type' => TType::STRUCT, + 'class' => '\metastore\NoSuchObjectException', + ), + 2 => array( 'var' => 'o2', 'type' => TType::STRUCT, 'class' => '\metastore\MetaException', @@ -25940,6 +25953,9 @@ class ThriftHiveMetastore_get_partition_names_result { if (isset($vals['success'])) { $this->success = $vals['success']; } + if (isset($vals['o1'])) { + $this->o1 = $vals['o1']; + } if (isset($vals['o2'])) { $this->o2 = $vals['o2']; } @@ -25984,6 +26000,14 @@ class ThriftHiveMetastore_get_partition_names_result { break; case 1: if ($ftype == TType::STRUCT) { + $this->o1 = new \metastore\NoSuchObjectException(); + $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 { @@ -26020,8 +26044,13 @@ class ThriftHiveMetastore_get_partition_names_result { } $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, 1); + $xfer += $output->writeFieldBegin('o2', TType::STRUCT, 2); $xfer += $this->o2->write($output); $xfer += $output->writeFieldEnd(); } http://git-wip-us.apache.org/repos/asf/hive/blob/55d8ee0b/standalone-metastore/src/gen/thrift/gen-py/hive_metastore/ThriftHiveMetastore.py ---------------------------------------------------------------------- diff --git a/standalone-metastore/src/gen/thrift/gen-py/hive_metastore/ThriftHiveMetastore.py b/standalone-metastore/src/gen/thrift/gen-py/hive_metastore/ThriftHiveMetastore.py index 4b45c3a..7bf5898 100644 --- a/standalone-metastore/src/gen/thrift/gen-py/hive_metastore/ThriftHiveMetastore.py +++ b/standalone-metastore/src/gen/thrift/gen-py/hive_metastore/ThriftHiveMetastore.py @@ -3629,6 +3629,8 @@ class Client(fb303.FacebookService.Client, Iface): 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_partition_names failed: unknown result") @@ -8847,6 +8849,9 @@ class Processor(fb303.FacebookService.Processor, Iface, TProcessor): msg_type = TMessageType.REPLY except (TTransport.TTransportException, KeyboardInterrupt, SystemExit): raise + except NoSuchObjectException as o1: + msg_type = TMessageType.REPLY + result.o1 = o1 except MetaException as o2: msg_type = TMessageType.REPLY result.o2 = o2 @@ -22347,16 +22352,19 @@ class get_partition_names_result: """ Attributes: - success + - o1 - o2 """ thrift_spec = ( (0, TType.LIST, 'success', (TType.STRING,None), None, ), # 0 - (1, TType.STRUCT, 'o2', (MetaException, MetaException.thrift_spec), None, ), # 1 + (1, TType.STRUCT, 'o1', (NoSuchObjectException, NoSuchObjectException.thrift_spec), None, ), # 1 + (2, TType.STRUCT, 'o2', (MetaException, MetaException.thrift_spec), None, ), # 2 ) - def __init__(self, success=None, o2=None,): + def __init__(self, success=None, o1=None, o2=None,): self.success = success + self.o1 = o1 self.o2 = o2 def read(self, iprot): @@ -22380,6 +22388,12 @@ class get_partition_names_result: iprot.skip(ftype) elif fid == 1: if ftype == TType.STRUCT: + self.o1 = NoSuchObjectException() + self.o1.read(iprot) + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRUCT: self.o2 = MetaException() self.o2.read(iprot) else: @@ -22401,8 +22415,12 @@ class get_partition_names_result: oprot.writeString(iter886) oprot.writeListEnd() 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, 1) + oprot.writeFieldBegin('o2', TType.STRUCT, 2) self.o2.write(oprot) oprot.writeFieldEnd() oprot.writeFieldStop() @@ -22415,6 +22433,7 @@ class get_partition_names_result: 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 http://git-wip-us.apache.org/repos/asf/hive/blob/55d8ee0b/standalone-metastore/src/gen/thrift/gen-rb/thrift_hive_metastore.rb ---------------------------------------------------------------------- diff --git a/standalone-metastore/src/gen/thrift/gen-rb/thrift_hive_metastore.rb b/standalone-metastore/src/gen/thrift/gen-rb/thrift_hive_metastore.rb index 54b3dfb..1c97139 100644 --- a/standalone-metastore/src/gen/thrift/gen-rb/thrift_hive_metastore.rb +++ b/standalone-metastore/src/gen/thrift/gen-rb/thrift_hive_metastore.rb @@ -1059,6 +1059,7 @@ module ThriftHiveMetastore def recv_get_partition_names() result = receive_message(Get_partition_names_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_partition_names failed: unknown result') end @@ -3508,6 +3509,8 @@ module ThriftHiveMetastore result = Get_partition_names_result.new() begin result.success = @handler.get_partition_names(args.db_name, args.tbl_name, args.max_parts) + rescue ::NoSuchObjectException => o1 + result.o1 = o1 rescue ::MetaException => o2 result.o2 = o2 end @@ -7045,10 +7048,12 @@ module ThriftHiveMetastore class Get_partition_names_result include ::Thrift::Struct, ::Thrift::Struct_Union SUCCESS = 0 - O2 = 1 + O1 = 1 + O2 = 2 FIELDS = { SUCCESS => {:type => ::Thrift::Types::LIST, :name => 'success', :element => {:type => ::Thrift::Types::STRING}}, + O1 => {:type => ::Thrift::Types::STRUCT, :name => 'o1', :class => ::NoSuchObjectException}, O2 => {:type => ::Thrift::Types::STRUCT, :name => 'o2', :class => ::MetaException} } http://git-wip-us.apache.org/repos/asf/hive/blob/55d8ee0b/standalone-metastore/src/main/thrift/hive_metastore.thrift ---------------------------------------------------------------------- diff --git a/standalone-metastore/src/main/thrift/hive_metastore.thrift b/standalone-metastore/src/main/thrift/hive_metastore.thrift index 7268d53..090c3e3 100644 --- a/standalone-metastore/src/main/thrift/hive_metastore.thrift +++ b/standalone-metastore/src/main/thrift/hive_metastore.thrift @@ -1272,7 +1272,7 @@ service ThriftHiveMetastore extends fb303.FacebookService throws(1:NoSuchObjectException o1, 2:MetaException o2) list<string> get_partition_names(1:string db_name, 2:string tbl_name, 3:i16 max_parts=-1) - throws(1:MetaException o2) + throws(1:NoSuchObjectException o1, 2:MetaException o2) // get_partition*_ps methods allow filtering by a partial partition specification, // as needed for dynamic partitions. The values that are not restricted should