diff --git metastore/if/hive_metastore.thrift metastore/if/hive_metastore.thrift index 7b44bda..baab31b 100755 --- metastore/if/hive_metastore.thrift +++ metastore/if/hive_metastore.thrift @@ -751,9 +751,9 @@ struct CompactionRequest { } struct CompactionResponse { - 1: optional i64 newId, - 2: optional i64 existingId, - 3: optional string existingState + 1: required i64 id, + 2: required string state, + 3: required bool accepted } struct ShowCompactRequest { diff --git metastore/src/gen/thrift/gen-cpp/hive_metastore_types.cpp metastore/src/gen/thrift/gen-cpp/hive_metastore_types.cpp index ab95e8c..1fae3bc 100644 --- metastore/src/gen/thrift/gen-cpp/hive_metastore_types.cpp +++ metastore/src/gen/thrift/gen-cpp/hive_metastore_types.cpp @@ -14717,19 +14717,16 @@ CompactionResponse::~CompactionResponse() throw() { } -void CompactionResponse::__set_newId(const int64_t val) { - this->newId = val; -__isset.newId = true; +void CompactionResponse::__set_id(const int64_t val) { + this->id = val; } -void CompactionResponse::__set_existingId(const int64_t val) { - this->existingId = val; -__isset.existingId = true; +void CompactionResponse::__set_state(const std::string& val) { + this->state = val; } -void CompactionResponse::__set_existingState(const std::string& val) { - this->existingState = val; -__isset.existingState = true; +void CompactionResponse::__set_accepted(const bool val) { + this->accepted = val; } uint32_t CompactionResponse::read(::apache::thrift::protocol::TProtocol* iprot) { @@ -14744,6 +14741,9 @@ uint32_t CompactionResponse::read(::apache::thrift::protocol::TProtocol* iprot) using ::apache::thrift::protocol::TProtocolException; + bool isset_id = false; + bool isset_state = false; + bool isset_accepted = false; while (true) { @@ -14755,24 +14755,24 @@ uint32_t CompactionResponse::read(::apache::thrift::protocol::TProtocol* iprot) { case 1: if (ftype == ::apache::thrift::protocol::T_I64) { - xfer += iprot->readI64(this->newId); - this->__isset.newId = true; + xfer += iprot->readI64(this->id); + isset_id = true; } else { xfer += iprot->skip(ftype); } break; case 2: - if (ftype == ::apache::thrift::protocol::T_I64) { - xfer += iprot->readI64(this->existingId); - this->__isset.existingId = true; + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->state); + isset_state = true; } else { xfer += iprot->skip(ftype); } break; case 3: - if (ftype == ::apache::thrift::protocol::T_STRING) { - xfer += iprot->readString(this->existingState); - this->__isset.existingState = true; + if (ftype == ::apache::thrift::protocol::T_BOOL) { + xfer += iprot->readBool(this->accepted); + isset_accepted = true; } else { xfer += iprot->skip(ftype); } @@ -14786,6 +14786,12 @@ uint32_t CompactionResponse::read(::apache::thrift::protocol::TProtocol* iprot) xfer += iprot->readStructEnd(); + if (!isset_id) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_state) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_accepted) + throw TProtocolException(TProtocolException::INVALID_DATA); return xfer; } @@ -14794,21 +14800,18 @@ uint32_t CompactionResponse::write(::apache::thrift::protocol::TProtocol* oprot) apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); xfer += oprot->writeStructBegin("CompactionResponse"); - if (this->__isset.newId) { - xfer += oprot->writeFieldBegin("newId", ::apache::thrift::protocol::T_I64, 1); - xfer += oprot->writeI64(this->newId); - xfer += oprot->writeFieldEnd(); - } - if (this->__isset.existingId) { - xfer += oprot->writeFieldBegin("existingId", ::apache::thrift::protocol::T_I64, 2); - xfer += oprot->writeI64(this->existingId); - xfer += oprot->writeFieldEnd(); - } - if (this->__isset.existingState) { - xfer += oprot->writeFieldBegin("existingState", ::apache::thrift::protocol::T_STRING, 3); - xfer += oprot->writeString(this->existingState); - xfer += oprot->writeFieldEnd(); - } + xfer += oprot->writeFieldBegin("id", ::apache::thrift::protocol::T_I64, 1); + xfer += oprot->writeI64(this->id); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldBegin("state", ::apache::thrift::protocol::T_STRING, 2); + xfer += oprot->writeString(this->state); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldBegin("accepted", ::apache::thrift::protocol::T_BOOL, 3); + xfer += oprot->writeBool(this->accepted); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); xfer += oprot->writeStructEnd(); return xfer; @@ -14816,31 +14819,28 @@ uint32_t CompactionResponse::write(::apache::thrift::protocol::TProtocol* oprot) void swap(CompactionResponse &a, CompactionResponse &b) { using ::std::swap; - swap(a.newId, b.newId); - swap(a.existingId, b.existingId); - swap(a.existingState, b.existingState); - swap(a.__isset, b.__isset); + swap(a.id, b.id); + swap(a.state, b.state); + swap(a.accepted, b.accepted); } CompactionResponse::CompactionResponse(const CompactionResponse& other613) { - newId = other613.newId; - existingId = other613.existingId; - existingState = other613.existingState; - __isset = other613.__isset; + id = other613.id; + state = other613.state; + accepted = other613.accepted; } CompactionResponse& CompactionResponse::operator=(const CompactionResponse& other614) { - newId = other614.newId; - existingId = other614.existingId; - existingState = other614.existingState; - __isset = other614.__isset; + id = other614.id; + state = other614.state; + accepted = other614.accepted; return *this; } void CompactionResponse::printTo(std::ostream& out) const { using ::apache::thrift::to_string; out << "CompactionResponse("; - out << "newId="; (__isset.newId ? (out << to_string(newId)) : (out << "")); - out << ", " << "existingId="; (__isset.existingId ? (out << to_string(existingId)) : (out << "")); - out << ", " << "existingState="; (__isset.existingState ? (out << to_string(existingState)) : (out << "")); + out << "id=" << to_string(id); + out << ", " << "state=" << to_string(state); + out << ", " << "accepted=" << to_string(accepted); out << ")"; } diff --git metastore/src/gen/thrift/gen-cpp/hive_metastore_types.h metastore/src/gen/thrift/gen-cpp/hive_metastore_types.h index d32aa6a..6838133 100644 --- metastore/src/gen/thrift/gen-cpp/hive_metastore_types.h +++ metastore/src/gen/thrift/gen-cpp/hive_metastore_types.h @@ -6002,47 +6002,33 @@ inline std::ostream& operator<<(std::ostream& out, const CompactionRequest& obj) return out; } -typedef struct _CompactionResponse__isset { - _CompactionResponse__isset() : newId(false), existingId(false), existingState(false) {} - bool newId :1; - bool existingId :1; - bool existingState :1; -} _CompactionResponse__isset; class CompactionResponse { public: CompactionResponse(const CompactionResponse&); CompactionResponse& operator=(const CompactionResponse&); - CompactionResponse() : newId(0), existingId(0), existingState() { + CompactionResponse() : id(0), state(), accepted(0) { } virtual ~CompactionResponse() throw(); - int64_t newId; - int64_t existingId; - std::string existingState; - - _CompactionResponse__isset __isset; + int64_t id; + std::string state; + bool accepted; - void __set_newId(const int64_t val); + void __set_id(const int64_t val); - void __set_existingId(const int64_t val); + void __set_state(const std::string& val); - void __set_existingState(const std::string& val); + void __set_accepted(const bool val); bool operator == (const CompactionResponse & rhs) const { - if (__isset.newId != rhs.__isset.newId) - return false; - else if (__isset.newId && !(newId == rhs.newId)) - return false; - if (__isset.existingId != rhs.__isset.existingId) - return false; - else if (__isset.existingId && !(existingId == rhs.existingId)) + if (!(id == rhs.id)) return false; - if (__isset.existingState != rhs.__isset.existingState) + if (!(state == rhs.state)) return false; - else if (__isset.existingState && !(existingState == rhs.existingState)) + if (!(accepted == rhs.accepted)) return false; return true; } diff --git metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/CompactionResponse.java metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/CompactionResponse.java index 30d791f..157ff53 100644 --- metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/CompactionResponse.java +++ metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/CompactionResponse.java @@ -38,9 +38,9 @@ public class CompactionResponse implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("CompactionResponse"); - private static final org.apache.thrift.protocol.TField NEW_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("newId", org.apache.thrift.protocol.TType.I64, (short)1); - private static final org.apache.thrift.protocol.TField EXISTING_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("existingId", org.apache.thrift.protocol.TType.I64, (short)2); - private static final org.apache.thrift.protocol.TField EXISTING_STATE_FIELD_DESC = new org.apache.thrift.protocol.TField("existingState", org.apache.thrift.protocol.TType.STRING, (short)3); + private static final org.apache.thrift.protocol.TField ID_FIELD_DESC = new org.apache.thrift.protocol.TField("id", org.apache.thrift.protocol.TType.I64, (short)1); + private static final org.apache.thrift.protocol.TField STATE_FIELD_DESC = new org.apache.thrift.protocol.TField("state", org.apache.thrift.protocol.TType.STRING, (short)2); + private static final org.apache.thrift.protocol.TField ACCEPTED_FIELD_DESC = new org.apache.thrift.protocol.TField("accepted", org.apache.thrift.protocol.TType.BOOL, (short)3); private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); static { @@ -48,15 +48,15 @@ schemes.put(TupleScheme.class, new CompactionResponseTupleSchemeFactory()); } - private long newId; // optional - private long existingId; // optional - private String existingState; // optional + private long id; // required + private String state; // required + private boolean accepted; // 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 { - NEW_ID((short)1, "newId"), - EXISTING_ID((short)2, "existingId"), - EXISTING_STATE((short)3, "existingState"); + ID((short)1, "id"), + STATE((short)2, "state"), + ACCEPTED((short)3, "accepted"); private static final Map byName = new HashMap(); @@ -71,12 +71,12 @@ */ public static _Fields findByThriftId(int fieldId) { switch(fieldId) { - case 1: // NEW_ID - return NEW_ID; - case 2: // EXISTING_ID - return EXISTING_ID; - case 3: // EXISTING_STATE - return EXISTING_STATE; + case 1: // ID + return ID; + case 2: // STATE + return STATE; + case 3: // ACCEPTED + return ACCEPTED; default: return null; } @@ -117,19 +117,18 @@ public String getFieldName() { } // isset id assignments - private static final int __NEWID_ISSET_ID = 0; - private static final int __EXISTINGID_ISSET_ID = 1; + private static final int __ID_ISSET_ID = 0; + private static final int __ACCEPTED_ISSET_ID = 1; private byte __isset_bitfield = 0; - private static final _Fields optionals[] = {_Fields.NEW_ID,_Fields.EXISTING_ID,_Fields.EXISTING_STATE}; public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; static { Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - tmpMap.put(_Fields.NEW_ID, new org.apache.thrift.meta_data.FieldMetaData("newId", org.apache.thrift.TFieldRequirementType.OPTIONAL, + tmpMap.put(_Fields.ID, new org.apache.thrift.meta_data.FieldMetaData("id", org.apache.thrift.TFieldRequirementType.REQUIRED, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))); - tmpMap.put(_Fields.EXISTING_ID, new org.apache.thrift.meta_data.FieldMetaData("existingId", org.apache.thrift.TFieldRequirementType.OPTIONAL, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))); - tmpMap.put(_Fields.EXISTING_STATE, new org.apache.thrift.meta_data.FieldMetaData("existingState", org.apache.thrift.TFieldRequirementType.OPTIONAL, + tmpMap.put(_Fields.STATE, new org.apache.thrift.meta_data.FieldMetaData("state", org.apache.thrift.TFieldRequirementType.REQUIRED, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.ACCEPTED, new org.apache.thrift.meta_data.FieldMetaData("accepted", org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL))); metaDataMap = Collections.unmodifiableMap(tmpMap); org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(CompactionResponse.class, metaDataMap); } @@ -137,16 +136,29 @@ public String getFieldName() { public CompactionResponse() { } + public CompactionResponse( + long id, + String state, + boolean accepted) + { + this(); + this.id = id; + setIdIsSet(true); + this.state = state; + this.accepted = accepted; + setAcceptedIsSet(true); + } + /** * Performs a deep copy on other. */ public CompactionResponse(CompactionResponse other) { __isset_bitfield = other.__isset_bitfield; - this.newId = other.newId; - this.existingId = other.existingId; - if (other.isSetExistingState()) { - this.existingState = other.existingState; + this.id = other.id; + if (other.isSetState()) { + this.state = other.state; } + this.accepted = other.accepted; } public CompactionResponse deepCopy() { @@ -155,103 +167,103 @@ public CompactionResponse deepCopy() { @Override public void clear() { - setNewIdIsSet(false); - this.newId = 0; - setExistingIdIsSet(false); - this.existingId = 0; - this.existingState = null; + setIdIsSet(false); + this.id = 0; + this.state = null; + setAcceptedIsSet(false); + this.accepted = false; } - public long getNewId() { - return this.newId; + public long getId() { + return this.id; } - public void setNewId(long newId) { - this.newId = newId; - setNewIdIsSet(true); + public void setId(long id) { + this.id = id; + setIdIsSet(true); } - public void unsetNewId() { - __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __NEWID_ISSET_ID); + public void unsetId() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __ID_ISSET_ID); } - /** Returns true if field newId is set (has been assigned a value) and false otherwise */ - public boolean isSetNewId() { - return EncodingUtils.testBit(__isset_bitfield, __NEWID_ISSET_ID); + /** Returns true if field id is set (has been assigned a value) and false otherwise */ + public boolean isSetId() { + return EncodingUtils.testBit(__isset_bitfield, __ID_ISSET_ID); } - public void setNewIdIsSet(boolean value) { - __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __NEWID_ISSET_ID, value); + public void setIdIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __ID_ISSET_ID, value); } - public long getExistingId() { - return this.existingId; + public String getState() { + return this.state; } - public void setExistingId(long existingId) { - this.existingId = existingId; - setExistingIdIsSet(true); + public void setState(String state) { + this.state = state; } - public void unsetExistingId() { - __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __EXISTINGID_ISSET_ID); + public void unsetState() { + this.state = null; } - /** Returns true if field existingId is set (has been assigned a value) and false otherwise */ - public boolean isSetExistingId() { - return EncodingUtils.testBit(__isset_bitfield, __EXISTINGID_ISSET_ID); + /** Returns true if field state is set (has been assigned a value) and false otherwise */ + public boolean isSetState() { + return this.state != null; } - public void setExistingIdIsSet(boolean value) { - __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __EXISTINGID_ISSET_ID, value); + public void setStateIsSet(boolean value) { + if (!value) { + this.state = null; + } } - public String getExistingState() { - return this.existingState; + public boolean isAccepted() { + return this.accepted; } - public void setExistingState(String existingState) { - this.existingState = existingState; + public void setAccepted(boolean accepted) { + this.accepted = accepted; + setAcceptedIsSet(true); } - public void unsetExistingState() { - this.existingState = null; + public void unsetAccepted() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __ACCEPTED_ISSET_ID); } - /** Returns true if field existingState is set (has been assigned a value) and false otherwise */ - public boolean isSetExistingState() { - return this.existingState != null; + /** Returns true if field accepted is set (has been assigned a value) and false otherwise */ + public boolean isSetAccepted() { + return EncodingUtils.testBit(__isset_bitfield, __ACCEPTED_ISSET_ID); } - public void setExistingStateIsSet(boolean value) { - if (!value) { - this.existingState = null; - } + public void setAcceptedIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __ACCEPTED_ISSET_ID, value); } public void setFieldValue(_Fields field, Object value) { switch (field) { - case NEW_ID: + case ID: if (value == null) { - unsetNewId(); + unsetId(); } else { - setNewId((Long)value); + setId((Long)value); } break; - case EXISTING_ID: + case STATE: if (value == null) { - unsetExistingId(); + unsetState(); } else { - setExistingId((Long)value); + setState((String)value); } break; - case EXISTING_STATE: + case ACCEPTED: if (value == null) { - unsetExistingState(); + unsetAccepted(); } else { - setExistingState((String)value); + setAccepted((Boolean)value); } break; @@ -260,14 +272,14 @@ public void setFieldValue(_Fields field, Object value) { public Object getFieldValue(_Fields field) { switch (field) { - case NEW_ID: - return getNewId(); + case ID: + return getId(); - case EXISTING_ID: - return getExistingId(); + case STATE: + return getState(); - case EXISTING_STATE: - return getExistingState(); + case ACCEPTED: + return isAccepted(); } throw new IllegalStateException(); @@ -280,12 +292,12 @@ public boolean isSet(_Fields field) { } switch (field) { - case NEW_ID: - return isSetNewId(); - case EXISTING_ID: - return isSetExistingId(); - case EXISTING_STATE: - return isSetExistingState(); + case ID: + return isSetId(); + case STATE: + return isSetState(); + case ACCEPTED: + return isSetAccepted(); } throw new IllegalStateException(); } @@ -303,30 +315,30 @@ public boolean equals(CompactionResponse that) { if (that == null) return false; - boolean this_present_newId = true && this.isSetNewId(); - boolean that_present_newId = true && that.isSetNewId(); - if (this_present_newId || that_present_newId) { - if (!(this_present_newId && that_present_newId)) + boolean this_present_id = true; + boolean that_present_id = true; + if (this_present_id || that_present_id) { + if (!(this_present_id && that_present_id)) return false; - if (this.newId != that.newId) + if (this.id != that.id) return false; } - boolean this_present_existingId = true && this.isSetExistingId(); - boolean that_present_existingId = true && that.isSetExistingId(); - if (this_present_existingId || that_present_existingId) { - if (!(this_present_existingId && that_present_existingId)) + boolean this_present_state = true && this.isSetState(); + boolean that_present_state = true && that.isSetState(); + if (this_present_state || that_present_state) { + if (!(this_present_state && that_present_state)) return false; - if (this.existingId != that.existingId) + if (!this.state.equals(that.state)) return false; } - boolean this_present_existingState = true && this.isSetExistingState(); - boolean that_present_existingState = true && that.isSetExistingState(); - if (this_present_existingState || that_present_existingState) { - if (!(this_present_existingState && that_present_existingState)) + boolean this_present_accepted = true; + boolean that_present_accepted = true; + if (this_present_accepted || that_present_accepted) { + if (!(this_present_accepted && that_present_accepted)) return false; - if (!this.existingState.equals(that.existingState)) + if (this.accepted != that.accepted) return false; } @@ -337,20 +349,20 @@ public boolean equals(CompactionResponse that) { public int hashCode() { List list = new ArrayList(); - boolean present_newId = true && (isSetNewId()); - list.add(present_newId); - if (present_newId) - list.add(newId); + boolean present_id = true; + list.add(present_id); + if (present_id) + list.add(id); - boolean present_existingId = true && (isSetExistingId()); - list.add(present_existingId); - if (present_existingId) - list.add(existingId); + boolean present_state = true && (isSetState()); + list.add(present_state); + if (present_state) + list.add(state); - boolean present_existingState = true && (isSetExistingState()); - list.add(present_existingState); - if (present_existingState) - list.add(existingState); + boolean present_accepted = true; + list.add(present_accepted); + if (present_accepted) + list.add(accepted); return list.hashCode(); } @@ -363,32 +375,32 @@ public int compareTo(CompactionResponse other) { int lastComparison = 0; - lastComparison = Boolean.valueOf(isSetNewId()).compareTo(other.isSetNewId()); + lastComparison = Boolean.valueOf(isSetId()).compareTo(other.isSetId()); if (lastComparison != 0) { return lastComparison; } - if (isSetNewId()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.newId, other.newId); + if (isSetId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.id, other.id); if (lastComparison != 0) { return lastComparison; } } - lastComparison = Boolean.valueOf(isSetExistingId()).compareTo(other.isSetExistingId()); + lastComparison = Boolean.valueOf(isSetState()).compareTo(other.isSetState()); if (lastComparison != 0) { return lastComparison; } - if (isSetExistingId()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.existingId, other.existingId); + if (isSetState()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.state, other.state); if (lastComparison != 0) { return lastComparison; } } - lastComparison = Boolean.valueOf(isSetExistingState()).compareTo(other.isSetExistingState()); + lastComparison = Boolean.valueOf(isSetAccepted()).compareTo(other.isSetAccepted()); if (lastComparison != 0) { return lastComparison; } - if (isSetExistingState()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.existingState, other.existingState); + if (isSetAccepted()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.accepted, other.accepted); if (lastComparison != 0) { return lastComparison; } @@ -413,33 +425,39 @@ public String toString() { StringBuilder sb = new StringBuilder("CompactionResponse("); boolean first = true; - if (isSetNewId()) { - sb.append("newId:"); - sb.append(this.newId); - first = false; - } - if (isSetExistingId()) { - if (!first) sb.append(", "); - sb.append("existingId:"); - sb.append(this.existingId); - first = false; - } - if (isSetExistingState()) { - if (!first) sb.append(", "); - sb.append("existingState:"); - if (this.existingState == null) { - sb.append("null"); - } else { - sb.append(this.existingState); - } - first = false; - } + sb.append("id:"); + sb.append(this.id); + first = false; + if (!first) sb.append(", "); + sb.append("state:"); + if (this.state == null) { + sb.append("null"); + } else { + sb.append(this.state); + } + first = false; + if (!first) sb.append(", "); + sb.append("accepted:"); + sb.append(this.accepted); + first = false; sb.append(")"); return sb.toString(); } public void validate() throws org.apache.thrift.TException { // check for required fields + if (!isSetId()) { + throw new org.apache.thrift.protocol.TProtocolException("Required field 'id' is unset! Struct:" + toString()); + } + + if (!isSetState()) { + throw new org.apache.thrift.protocol.TProtocolException("Required field 'state' is unset! Struct:" + toString()); + } + + if (!isSetAccepted()) { + throw new org.apache.thrift.protocol.TProtocolException("Required field 'accepted' is unset! Struct:" + toString()); + } + // check for sub-struct validity } @@ -479,26 +497,26 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, CompactionResponse break; } switch (schemeField.id) { - case 1: // NEW_ID + case 1: // ID if (schemeField.type == org.apache.thrift.protocol.TType.I64) { - struct.newId = iprot.readI64(); - struct.setNewIdIsSet(true); + struct.id = iprot.readI64(); + struct.setIdIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; - case 2: // EXISTING_ID - if (schemeField.type == org.apache.thrift.protocol.TType.I64) { - struct.existingId = iprot.readI64(); - struct.setExistingIdIsSet(true); + case 2: // STATE + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.state = iprot.readString(); + struct.setStateIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; - case 3: // EXISTING_STATE - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.existingState = iprot.readString(); - struct.setExistingStateIsSet(true); + case 3: // ACCEPTED + if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) { + struct.accepted = iprot.readBool(); + struct.setAcceptedIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } @@ -516,23 +534,17 @@ public void write(org.apache.thrift.protocol.TProtocol oprot, CompactionResponse struct.validate(); oprot.writeStructBegin(STRUCT_DESC); - if (struct.isSetNewId()) { - oprot.writeFieldBegin(NEW_ID_FIELD_DESC); - oprot.writeI64(struct.newId); - oprot.writeFieldEnd(); - } - if (struct.isSetExistingId()) { - oprot.writeFieldBegin(EXISTING_ID_FIELD_DESC); - oprot.writeI64(struct.existingId); + oprot.writeFieldBegin(ID_FIELD_DESC); + oprot.writeI64(struct.id); + oprot.writeFieldEnd(); + if (struct.state != null) { + oprot.writeFieldBegin(STATE_FIELD_DESC); + oprot.writeString(struct.state); oprot.writeFieldEnd(); } - if (struct.existingState != null) { - if (struct.isSetExistingState()) { - oprot.writeFieldBegin(EXISTING_STATE_FIELD_DESC); - oprot.writeString(struct.existingState); - oprot.writeFieldEnd(); - } - } + oprot.writeFieldBegin(ACCEPTED_FIELD_DESC); + oprot.writeBool(struct.accepted); + oprot.writeFieldEnd(); oprot.writeFieldStop(); oprot.writeStructEnd(); } @@ -550,44 +562,20 @@ public CompactionResponseTupleScheme getScheme() { @Override public void write(org.apache.thrift.protocol.TProtocol prot, CompactionResponse struct) throws org.apache.thrift.TException { TTupleProtocol oprot = (TTupleProtocol) prot; - BitSet optionals = new BitSet(); - if (struct.isSetNewId()) { - optionals.set(0); - } - if (struct.isSetExistingId()) { - optionals.set(1); - } - if (struct.isSetExistingState()) { - optionals.set(2); - } - oprot.writeBitSet(optionals, 3); - if (struct.isSetNewId()) { - oprot.writeI64(struct.newId); - } - if (struct.isSetExistingId()) { - oprot.writeI64(struct.existingId); - } - if (struct.isSetExistingState()) { - oprot.writeString(struct.existingState); - } + oprot.writeI64(struct.id); + oprot.writeString(struct.state); + oprot.writeBool(struct.accepted); } @Override public void read(org.apache.thrift.protocol.TProtocol prot, CompactionResponse struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(3); - if (incoming.get(0)) { - struct.newId = iprot.readI64(); - struct.setNewIdIsSet(true); - } - if (incoming.get(1)) { - struct.existingId = iprot.readI64(); - struct.setExistingIdIsSet(true); - } - if (incoming.get(2)) { - struct.existingState = iprot.readString(); - struct.setExistingStateIsSet(true); - } + struct.id = iprot.readI64(); + struct.setIdIsSet(true); + struct.state = iprot.readString(); + struct.setStateIsSet(true); + struct.accepted = iprot.readBool(); + struct.setAcceptedIsSet(true); } } diff --git metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/FieldSchema.java metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/FieldSchema.java index 06a7b4d..d21d11b 100644 --- metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/FieldSchema.java +++ metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/FieldSchema.java @@ -139,9 +139,9 @@ public FieldSchema( String comment) { this(); - this.name = org.apache.hive.common.util.HiveStringUtils.intern(name); - this.type = org.apache.hive.common.util.HiveStringUtils.intern(type); - this.comment = org.apache.hive.common.util.HiveStringUtils.intern(comment); + this.name = name; + this.type = type; + this.comment = comment; } /** @@ -149,13 +149,13 @@ public FieldSchema( */ public FieldSchema(FieldSchema other) { if (other.isSetName()) { - this.name = org.apache.hive.common.util.HiveStringUtils.intern(other.name); + this.name = other.name; } if (other.isSetType()) { - this.type = org.apache.hive.common.util.HiveStringUtils.intern(other.type); + this.type = other.type; } if (other.isSetComment()) { - this.comment = org.apache.hive.common.util.HiveStringUtils.intern(other.comment); + this.comment = other.comment; } } @@ -175,7 +175,7 @@ public String getName() { } public void setName(String name) { - this.name = org.apache.hive.common.util.HiveStringUtils.intern(name); + this.name = name; } public void unsetName() { @@ -198,7 +198,7 @@ public String getType() { } public void setType(String type) { - this.type = org.apache.hive.common.util.HiveStringUtils.intern(type); + this.type = type; } public void unsetType() { @@ -221,7 +221,7 @@ public String getComment() { } public void setComment(String comment) { - this.comment = org.apache.hive.common.util.HiveStringUtils.intern(comment); + this.comment = comment; } public void unsetComment() { diff --git metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/Partition.java metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/Partition.java index a247221..7bbb5de 100644 --- metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/Partition.java +++ metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/Partition.java @@ -186,14 +186,14 @@ public Partition( { this(); this.values = values; - this.dbName = org.apache.hive.common.util.HiveStringUtils.intern(dbName); - this.tableName = org.apache.hive.common.util.HiveStringUtils.intern(tableName); + this.dbName = dbName; + this.tableName = tableName; this.createTime = createTime; setCreateTimeIsSet(true); this.lastAccessTime = lastAccessTime; setLastAccessTimeIsSet(true); this.sd = sd; - this.parameters = org.apache.hive.common.util.HiveStringUtils.intern(parameters); + this.parameters = parameters; } /** @@ -206,10 +206,10 @@ public Partition(Partition other) { this.values = __this__values; } if (other.isSetDbName()) { - this.dbName = org.apache.hive.common.util.HiveStringUtils.intern(other.dbName); + this.dbName = other.dbName; } if (other.isSetTableName()) { - this.tableName = org.apache.hive.common.util.HiveStringUtils.intern(other.tableName); + this.tableName = other.tableName; } this.createTime = other.createTime; this.lastAccessTime = other.lastAccessTime; @@ -286,7 +286,7 @@ public String getDbName() { } public void setDbName(String dbName) { - this.dbName = org.apache.hive.common.util.HiveStringUtils.intern(dbName); + this.dbName = dbName; } public void unsetDbName() { @@ -309,7 +309,7 @@ public String getTableName() { } public void setTableName(String tableName) { - this.tableName = org.apache.hive.common.util.HiveStringUtils.intern(tableName); + this.tableName = tableName; } public void unsetTableName() { @@ -410,7 +410,7 @@ public void putToParameters(String key, String val) { } public void setParameters(Map parameters) { - this.parameters = org.apache.hive.common.util.HiveStringUtils.intern(parameters); + this.parameters = parameters; } public void unsetParameters() { diff --git metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/SerDeInfo.java metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/SerDeInfo.java index d5a8d99..d16606f 100644 --- metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/SerDeInfo.java +++ metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/SerDeInfo.java @@ -141,9 +141,9 @@ public SerDeInfo( Map parameters) { this(); - this.name = org.apache.hive.common.util.HiveStringUtils.intern(name); - this.serializationLib = org.apache.hive.common.util.HiveStringUtils.intern(serializationLib); - this.parameters = org.apache.hive.common.util.HiveStringUtils.intern(parameters); + this.name = name; + this.serializationLib = serializationLib; + this.parameters = parameters; } /** @@ -151,10 +151,10 @@ public SerDeInfo( */ public SerDeInfo(SerDeInfo other) { if (other.isSetName()) { - this.name = org.apache.hive.common.util.HiveStringUtils.intern(other.name); + this.name = other.name; } if (other.isSetSerializationLib()) { - this.serializationLib = org.apache.hive.common.util.HiveStringUtils.intern(other.serializationLib); + this.serializationLib = other.serializationLib; } if (other.isSetParameters()) { Map __this__parameters = new HashMap(other.parameters); @@ -178,7 +178,7 @@ public String getName() { } public void setName(String name) { - this.name = org.apache.hive.common.util.HiveStringUtils.intern(name); + this.name = name; } public void unsetName() { @@ -201,7 +201,7 @@ public String getSerializationLib() { } public void setSerializationLib(String serializationLib) { - this.serializationLib = org.apache.hive.common.util.HiveStringUtils.intern(serializationLib); + this.serializationLib = serializationLib; } public void unsetSerializationLib() { @@ -235,7 +235,7 @@ public void putToParameters(String key, String val) { } public void setParameters(Map parameters) { - this.parameters = org.apache.hive.common.util.HiveStringUtils.intern(parameters); + this.parameters = parameters; } public void unsetParameters() { diff --git metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/StorageDescriptor.java metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/StorageDescriptor.java index 938f06b..9a439bf 100644 --- metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/StorageDescriptor.java +++ metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/StorageDescriptor.java @@ -220,17 +220,17 @@ public StorageDescriptor( { this(); this.cols = cols; - this.location = org.apache.hive.common.util.HiveStringUtils.intern(location); - this.inputFormat = org.apache.hive.common.util.HiveStringUtils.intern(inputFormat); - this.outputFormat = org.apache.hive.common.util.HiveStringUtils.intern(outputFormat); + this.location = location; + this.inputFormat = inputFormat; + this.outputFormat = outputFormat; this.compressed = compressed; setCompressedIsSet(true); this.numBuckets = numBuckets; setNumBucketsIsSet(true); this.serdeInfo = serdeInfo; - this.bucketCols = org.apache.hive.common.util.HiveStringUtils.intern(bucketCols); + this.bucketCols = bucketCols; this.sortCols = sortCols; - this.parameters = org.apache.hive.common.util.HiveStringUtils.intern(parameters); + this.parameters = parameters; } /** @@ -246,13 +246,13 @@ public StorageDescriptor(StorageDescriptor other) { this.cols = __this__cols; } if (other.isSetLocation()) { - this.location = org.apache.hive.common.util.HiveStringUtils.intern(other.location); + this.location = other.location; } if (other.isSetInputFormat()) { - this.inputFormat = org.apache.hive.common.util.HiveStringUtils.intern(other.inputFormat); + this.inputFormat = other.inputFormat; } if (other.isSetOutputFormat()) { - this.outputFormat = org.apache.hive.common.util.HiveStringUtils.intern(other.outputFormat); + this.outputFormat = other.outputFormat; } this.compressed = other.compressed; this.numBuckets = other.numBuckets; @@ -346,7 +346,7 @@ public String getLocation() { } public void setLocation(String location) { - this.location = org.apache.hive.common.util.HiveStringUtils.intern(location); + this.location = location; } public void unsetLocation() { @@ -369,7 +369,7 @@ public String getInputFormat() { } public void setInputFormat(String inputFormat) { - this.inputFormat = org.apache.hive.common.util.HiveStringUtils.intern(inputFormat); + this.inputFormat = inputFormat; } public void unsetInputFormat() { @@ -392,7 +392,7 @@ public String getOutputFormat() { } public void setOutputFormat(String outputFormat) { - this.outputFormat = org.apache.hive.common.util.HiveStringUtils.intern(outputFormat); + this.outputFormat = outputFormat; } public void unsetOutputFormat() { @@ -497,7 +497,7 @@ public void addToBucketCols(String elem) { } public void setBucketCols(List bucketCols) { - this.bucketCols = org.apache.hive.common.util.HiveStringUtils.intern(bucketCols); + this.bucketCols = bucketCols; } public void unsetBucketCols() { @@ -569,7 +569,7 @@ public void putToParameters(String key, String val) { } public void setParameters(Map parameters) { - this.parameters = org.apache.hive.common.util.HiveStringUtils.intern(parameters); + this.parameters = parameters; } public void unsetParameters() { diff --git metastore/src/gen/thrift/gen-php/metastore/Types.php metastore/src/gen/thrift/gen-php/metastore/Types.php index 02733a1..b9af4ef 100644 --- metastore/src/gen/thrift/gen-php/metastore/Types.php +++ metastore/src/gen/thrift/gen-php/metastore/Types.php @@ -14679,42 +14679,42 @@ class CompactionResponse { /** * @var int */ - public $newId = null; + public $id = null; /** - * @var int + * @var string */ - public $existingId = null; + public $state = null; /** - * @var string + * @var bool */ - public $existingState = null; + public $accepted = null; public function __construct($vals=null) { if (!isset(self::$_TSPEC)) { self::$_TSPEC = array( 1 => array( - 'var' => 'newId', + 'var' => 'id', 'type' => TType::I64, ), 2 => array( - 'var' => 'existingId', - 'type' => TType::I64, + 'var' => 'state', + 'type' => TType::STRING, ), 3 => array( - 'var' => 'existingState', - 'type' => TType::STRING, + 'var' => 'accepted', + 'type' => TType::BOOL, ), ); } if (is_array($vals)) { - if (isset($vals['newId'])) { - $this->newId = $vals['newId']; + if (isset($vals['id'])) { + $this->id = $vals['id']; } - if (isset($vals['existingId'])) { - $this->existingId = $vals['existingId']; + if (isset($vals['state'])) { + $this->state = $vals['state']; } - if (isset($vals['existingState'])) { - $this->existingState = $vals['existingState']; + if (isset($vals['accepted'])) { + $this->accepted = $vals['accepted']; } } } @@ -14740,21 +14740,21 @@ class CompactionResponse { { case 1: if ($ftype == TType::I64) { - $xfer += $input->readI64($this->newId); + $xfer += $input->readI64($this->id); } else { $xfer += $input->skip($ftype); } break; case 2: - if ($ftype == TType::I64) { - $xfer += $input->readI64($this->existingId); + if ($ftype == TType::STRING) { + $xfer += $input->readString($this->state); } else { $xfer += $input->skip($ftype); } break; case 3: - if ($ftype == TType::STRING) { - $xfer += $input->readString($this->existingState); + if ($ftype == TType::BOOL) { + $xfer += $input->readBool($this->accepted); } else { $xfer += $input->skip($ftype); } @@ -14772,19 +14772,19 @@ class CompactionResponse { public function write($output) { $xfer = 0; $xfer += $output->writeStructBegin('CompactionResponse'); - if ($this->newId !== null) { - $xfer += $output->writeFieldBegin('newId', TType::I64, 1); - $xfer += $output->writeI64($this->newId); + if ($this->id !== null) { + $xfer += $output->writeFieldBegin('id', TType::I64, 1); + $xfer += $output->writeI64($this->id); $xfer += $output->writeFieldEnd(); } - if ($this->existingId !== null) { - $xfer += $output->writeFieldBegin('existingId', TType::I64, 2); - $xfer += $output->writeI64($this->existingId); + if ($this->state !== null) { + $xfer += $output->writeFieldBegin('state', TType::STRING, 2); + $xfer += $output->writeString($this->state); $xfer += $output->writeFieldEnd(); } - if ($this->existingState !== null) { - $xfer += $output->writeFieldBegin('existingState', TType::STRING, 3); - $xfer += $output->writeString($this->existingState); + if ($this->accepted !== null) { + $xfer += $output->writeFieldBegin('accepted', TType::BOOL, 3); + $xfer += $output->writeBool($this->accepted); $xfer += $output->writeFieldEnd(); } $xfer += $output->writeFieldStop(); diff --git metastore/src/gen/thrift/gen-py/hive_metastore/ttypes.py metastore/src/gen/thrift/gen-py/hive_metastore/ttypes.py index 60bd996..21c0390 100644 --- metastore/src/gen/thrift/gen-py/hive_metastore/ttypes.py +++ metastore/src/gen/thrift/gen-py/hive_metastore/ttypes.py @@ -10188,22 +10188,22 @@ def __ne__(self, other): class CompactionResponse: """ Attributes: - - newId - - existingId - - existingState + - id + - state + - accepted """ thrift_spec = ( None, # 0 - (1, TType.I64, 'newId', None, None, ), # 1 - (2, TType.I64, 'existingId', None, None, ), # 2 - (3, TType.STRING, 'existingState', None, None, ), # 3 + (1, TType.I64, 'id', None, None, ), # 1 + (2, TType.STRING, 'state', None, None, ), # 2 + (3, TType.BOOL, 'accepted', None, None, ), # 3 ) - def __init__(self, newId=None, existingId=None, existingState=None,): - self.newId = newId - self.existingId = existingId - self.existingState = existingState + def __init__(self, id=None, state=None, accepted=None,): + self.id = id + self.state = state + self.accepted = accepted 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: @@ -10216,17 +10216,17 @@ def read(self, iprot): break if fid == 1: if ftype == TType.I64: - self.newId = iprot.readI64() + self.id = iprot.readI64() else: iprot.skip(ftype) elif fid == 2: - if ftype == TType.I64: - self.existingId = iprot.readI64() + if ftype == TType.STRING: + self.state = iprot.readString() else: iprot.skip(ftype) elif fid == 3: - if ftype == TType.STRING: - self.existingState = iprot.readString() + if ftype == TType.BOOL: + self.accepted = iprot.readBool() else: iprot.skip(ftype) else: @@ -10239,30 +10239,36 @@ def write(self, oprot): oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec))) return oprot.writeStructBegin('CompactionResponse') - if self.newId is not None: - oprot.writeFieldBegin('newId', TType.I64, 1) - oprot.writeI64(self.newId) + if self.id is not None: + oprot.writeFieldBegin('id', TType.I64, 1) + oprot.writeI64(self.id) oprot.writeFieldEnd() - if self.existingId is not None: - oprot.writeFieldBegin('existingId', TType.I64, 2) - oprot.writeI64(self.existingId) + if self.state is not None: + oprot.writeFieldBegin('state', TType.STRING, 2) + oprot.writeString(self.state) oprot.writeFieldEnd() - if self.existingState is not None: - oprot.writeFieldBegin('existingState', TType.STRING, 3) - oprot.writeString(self.existingState) + if self.accepted is not None: + oprot.writeFieldBegin('accepted', TType.BOOL, 3) + oprot.writeBool(self.accepted) oprot.writeFieldEnd() oprot.writeFieldStop() oprot.writeStructEnd() def validate(self): + if self.id is None: + raise TProtocol.TProtocolException(message='Required field id is unset!') + if self.state is None: + raise TProtocol.TProtocolException(message='Required field state is unset!') + if self.accepted is None: + raise TProtocol.TProtocolException(message='Required field accepted is unset!') return def __hash__(self): value = 17 - value = (value * 31) ^ hash(self.newId) - value = (value * 31) ^ hash(self.existingId) - value = (value * 31) ^ hash(self.existingState) + value = (value * 31) ^ hash(self.id) + value = (value * 31) ^ hash(self.state) + value = (value * 31) ^ hash(self.accepted) return value def __repr__(self): diff --git metastore/src/gen/thrift/gen-rb/hive_metastore_types.rb metastore/src/gen/thrift/gen-rb/hive_metastore_types.rb index 6dcf059..c735932 100644 --- metastore/src/gen/thrift/gen-rb/hive_metastore_types.rb +++ metastore/src/gen/thrift/gen-rb/hive_metastore_types.rb @@ -2283,19 +2283,22 @@ end class CompactionResponse include ::Thrift::Struct, ::Thrift::Struct_Union - NEWID = 1 - EXISTINGID = 2 - EXISTINGSTATE = 3 + ID = 1 + STATE = 2 + ACCEPTED = 3 FIELDS = { - NEWID => {:type => ::Thrift::Types::I64, :name => 'newId', :optional => true}, - EXISTINGID => {:type => ::Thrift::Types::I64, :name => 'existingId', :optional => true}, - EXISTINGSTATE => {:type => ::Thrift::Types::STRING, :name => 'existingState', :optional => true} + ID => {:type => ::Thrift::Types::I64, :name => 'id'}, + STATE => {:type => ::Thrift::Types::STRING, :name => 'state'}, + ACCEPTED => {:type => ::Thrift::Types::BOOL, :name => 'accepted'} } def struct_fields; FIELDS; end def validate + raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field id is unset!') unless @id + raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field state is unset!') unless @state + raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field accepted is unset!') if @accepted.nil? end ::Thrift::Struct.generate_accessors self diff --git metastore/src/java/org/apache/hadoop/hive/metastore/txn/TxnHandler.java metastore/src/java/org/apache/hadoop/hive/metastore/txn/TxnHandler.java index 8d3c7e7..6ea43b4 100644 --- metastore/src/java/org/apache/hadoop/hive/metastore/txn/TxnHandler.java +++ metastore/src/java/org/apache/hadoop/hive/metastore/txn/TxnHandler.java @@ -1415,10 +1415,7 @@ public CompactionResponse compact(CompactionRequest rqst) throws MetaException { LOG.info("Ignoring request to compact " + rqst.getDbname() + "/" + rqst.getTablename() + "/" + rqst.getPartitionname() + " since it is already " + quoteString(state) + " with id=" + enqueuedId); - CompactionResponse resp = new CompactionResponse(); - resp.setExistingId(enqueuedId); - resp.setExistingState(state); - return resp; + return new CompactionResponse(enqueuedId, state, false); } close(rs); StringBuilder buf = new StringBuilder("insert into COMPACTION_QUEUE (cq_id, cq_database, " + @@ -1471,9 +1468,7 @@ public CompactionResponse compact(CompactionRequest rqst) throws MetaException { stmt.executeUpdate(s); LOG.debug("Going to commit"); dbConn.commit(); - CompactionResponse resp = new CompactionResponse(); - resp.setNewId(id); - return resp; + return new CompactionResponse(id, INITIATED_RESPONSE, true); } catch (SQLException e) { LOG.debug("Going to rollback"); rollbackDBConn(dbConn); diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java index f261141..0ac9053 100644 --- ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java +++ ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java @@ -1812,12 +1812,12 @@ private int compact(Hive db, AlterTableSimpleDesc desc) throws HiveException { } CompactionResponse resp = db.compact2(tbl.getDbName(), tbl.getTableName(), partName, desc.getCompactionType(), desc.getProps()); - if(resp.isSetNewId()) { - console.printInfo("Compaction enqueued with id " + resp.getNewId()); + if(resp.isAccepted()) { + console.printInfo("Compaction enqueued with id " + resp.getId()); } else { - console.printInfo("Compaction already enqueued with id " + resp.getExistingId() + - "; State is " + resp.getExistingState()); + console.printInfo("Compaction already enqueued with id " + resp.getId() + + "; State is " + resp.getState()); } return 0; } diff --git ql/src/java/org/apache/hadoop/hive/ql/txn/compactor/Initiator.java ql/src/java/org/apache/hadoop/hive/ql/txn/compactor/Initiator.java index 77ce31c..af4a1da 100644 --- ql/src/java/org/apache/hadoop/hive/ql/txn/compactor/Initiator.java +++ ql/src/java/org/apache/hadoop/hive/ql/txn/compactor/Initiator.java @@ -338,8 +338,8 @@ private void requestCompaction(CompactionInfo ci, String runAs, CompactionType t rqst.setRunas(runAs); LOG.info("Requesting compaction: " + rqst); CompactionResponse resp = txnHandler.compact(rqst); - if(resp.isSetNewId()) { - ci.id = resp.getNewId(); + if(resp.isAccepted()) { + ci.id = resp.getId(); } } diff --git ql/src/test/org/apache/hadoop/hive/metastore/txn/TestTxnHandler.java ql/src/test/org/apache/hadoop/hive/metastore/txn/TestTxnHandler.java index db187ba..dbe1ce8 100644 --- ql/src/test/org/apache/hadoop/hive/metastore/txn/TestTxnHandler.java +++ ql/src/test/org/apache/hadoop/hive/metastore/txn/TestTxnHandler.java @@ -1153,9 +1153,7 @@ public void testCompactWhenAlreadyCompacting() throws Exception { CompactionRequest rqst = new CompactionRequest("foo", "bar", CompactionType.MAJOR); rqst.setPartitionname("ds=today"); CompactionResponse resp = txnHandler.compact(rqst); - Assert.assertTrue(resp.isSetNewId()); - Assert.assertTrue(!resp.isSetExistingId()); - Assert.assertTrue(!resp.isSetExistingState()); + Assert.assertEquals(resp, new CompactionResponse(1, TxnStore.INITIATED_RESPONSE, true)); ShowCompactResponse rsp = txnHandler.showCompact(new ShowCompactRequest()); List compacts = rsp.getCompacts(); @@ -1163,9 +1161,7 @@ public void testCompactWhenAlreadyCompacting() throws Exception { rqst.setType(CompactionType.MINOR); resp = txnHandler.compact(rqst); - Assert.assertTrue(!resp.isSetNewId()); - Assert.assertTrue(resp.isSetExistingId()); - Assert.assertTrue(resp.isSetExistingState()); + Assert.assertEquals(resp, new CompactionResponse(1, TxnStore.INITIATED_RESPONSE, false)); rsp = txnHandler.showCompact(new ShowCompactRequest()); compacts = rsp.getCompacts();