Index: hbase-server/src/test/java/org/apache/hadoop/hbase/thrift2/TestThriftHBaseServiceHandler.java =================================================================== --- hbase-server/src/test/java/org/apache/hadoop/hbase/thrift2/TestThriftHBaseServiceHandler.java (revision 1502190) +++ hbase-server/src/test/java/org/apache/hadoop/hbase/thrift2/TestThriftHBaseServiceHandler.java (working copy) @@ -26,7 +26,12 @@ import org.apache.hadoop.hbase.HColumnDescriptor; import org.apache.hadoop.hbase.HTableDescriptor; import org.apache.hadoop.hbase.MediumTests; +import org.apache.hadoop.hbase.client.Get; import org.apache.hadoop.hbase.client.HBaseAdmin; +import org.apache.hadoop.hbase.client.Put; +import org.apache.hadoop.hbase.client.Scan; +import org.apache.hadoop.hbase.client.Increment; +import org.apache.hadoop.hbase.client.Delete; import org.apache.hadoop.hbase.filter.ParseFilter; import org.apache.hadoop.hbase.test.MetricsAssertHelper; import org.apache.hadoop.hbase.thrift.ThriftMetrics; @@ -57,7 +62,13 @@ import java.util.Comparator; import java.util.List; import java.util.Map; +import java.util.HashMap; +import static org.apache.hadoop.hbase.thrift2.ThriftUtilities.getFromThrift; +import static org.apache.hadoop.hbase.thrift2.ThriftUtilities.putFromThrift; +import static org.apache.hadoop.hbase.thrift2.ThriftUtilities.scanFromThrift; +import static org.apache.hadoop.hbase.thrift2.ThriftUtilities.incrementFromThrift; +import static org.apache.hadoop.hbase.thrift2.ThriftUtilities.deleteFromThrift; import static org.junit.Assert.*; import static java.nio.ByteBuffer.wrap; @@ -694,5 +705,43 @@ return m; } + @Test + public void testAttribute() throws Exception { + byte[] rowName = "testAttribute".getBytes(); + byte[] attributeKey = "attribute1".getBytes(); + byte[] attributeValue = "value1".getBytes(); + Map attributes = new HashMap(); + attributes.put(wrap(attributeKey), wrap(attributeValue)); + + TGet tGet = new TGet(wrap(rowName)); + tGet.setAttributes(attributes); + Get get = getFromThrift(tGet); + assertArrayEquals(get.getAttribute("attribute1"), attributeValue); + + List columnValues = new ArrayList(); + columnValues.add(new TColumnValue(wrap(familyAname), wrap(qualifierAname), wrap(valueAname))); + TPut tPut = new TPut(wrap(rowName) , columnValues); + tPut.setAttributes(attributes); + Put put = putFromThrift(tPut); + assertArrayEquals(put.getAttribute("attribute1"), attributeValue); + + TScan tScan = new TScan(); + tScan.setAttributes(attributes); + Scan scan = scanFromThrift(tScan); + assertArrayEquals(scan.getAttribute("attribute1"), attributeValue); + + List incrementColumns = new ArrayList(); + incrementColumns.add(new TColumnIncrement(wrap(familyAname), wrap(qualifierAname))); + TIncrement tIncrement = new TIncrement(wrap(rowName), incrementColumns); + tIncrement.setAttributes(attributes); + Increment increment = incrementFromThrift(tIncrement); + assertArrayEquals(increment.getAttribute("attribute1"), attributeValue); + + TDelete tDelete = new TDelete(wrap(rowName)); + tDelete.setAttributes(attributes); + Delete delete = deleteFromThrift(tDelete); + assertArrayEquals(delete.getAttribute("attribute1"), attributeValue); + } + } Index: hbase-server/src/main/java/org/apache/hadoop/hbase/thrift2/ThriftUtilities.java =================================================================== --- hbase-server/src/main/java/org/apache/hadoop/hbase/thrift2/ThriftUtilities.java (revision 1502190) +++ hbase-server/src/main/java/org/apache/hadoop/hbase/thrift2/ThriftUtilities.java (working copy) @@ -25,11 +25,14 @@ import org.apache.hadoop.hbase.client.*; import org.apache.hadoop.hbase.filter.ParseFilter; import org.apache.hadoop.hbase.thrift2.generated.*; +import org.apache.hadoop.hbase.util.Bytes; import java.io.IOException; import java.nio.ByteBuffer; import java.util.*; +import static org.apache.hadoop.hbase.util.Bytes.getBytes; + @InterfaceAudience.Private public class ThriftUtilities { @@ -62,6 +65,15 @@ out.setMaxVersions(in.getMaxVersions()); } + if (in.isSetFilterString()) { + ParseFilter parseFilter = new ParseFilter(); + out.setFilter(parseFilter.parseFilterString(in.getFilterString())); + } + + if (in.isSetAttributes()) { + addAttributes(out,in.getAttributes()); + } + if (!in.isSetColumns()) { return out; } @@ -74,11 +86,6 @@ } } - if (in.isSetFilterString()) { - ParseFilter parseFilter = new ParseFilter(); - out.setFilter(parseFilter.parseFilterString(in.getFilterString())); - } - return out; } @@ -171,6 +178,10 @@ } } + if (in.isSetAttributes()) { + addAttributes(out,in.getAttributes()); + } + return out; } @@ -234,6 +245,11 @@ out = new Delete(in.getRow()); } } + + if (in.isSetAttributes()) { + addAttributes(out,in.getAttributes()); + } + out.setDurability(in.isWriteToWal() ? Durability.SYNC_WAL : Durability.SKIP_WAL); return out; } @@ -329,6 +345,10 @@ out.setFilter(parseFilter.parseFilterString(in.getFilterString())); } + if (in.isSetAttributes()) { + addAttributes(out,in.getAttributes()); + } + return out; } @@ -337,7 +357,27 @@ for (TColumnIncrement column : in.getColumns()) { out.addColumn(column.getFamily(), column.getQualifier(), column.getAmount()); } + + if (in.isSetAttributes()) { + addAttributes(out,in.getAttributes()); + } + out.setDurability(in.isWriteToWal() ? Durability.SYNC_WAL : Durability.SKIP_WAL); return out; } + + /** + * Adds all the attributes into the Operation object + */ + private static void addAttributes(OperationWithAttributes op, + Map attributes) { + if (attributes == null || attributes.size() == 0) { + return; + } + for (Map.Entry entry : attributes.entrySet()) { + String name = Bytes.toStringBinary(getBytes(entry.getKey())); + byte[] value = getBytes(entry.getValue()); + op.setAttribute(name, value); + } + } } Index: hbase-server/src/main/java/org/apache/hadoop/hbase/thrift2/generated/TGet.java =================================================================== --- hbase-server/src/main/java/org/apache/hadoop/hbase/thrift2/generated/TGet.java (revision 1502255) +++ hbase-server/src/main/java/org/apache/hadoop/hbase/thrift2/generated/TGet.java (working copy) @@ -52,6 +52,7 @@ private static final org.apache.thrift.protocol.TField TIME_RANGE_FIELD_DESC = new org.apache.thrift.protocol.TField("timeRange", org.apache.thrift.protocol.TType.STRUCT, (short)4); private static final org.apache.thrift.protocol.TField MAX_VERSIONS_FIELD_DESC = new org.apache.thrift.protocol.TField("maxVersions", org.apache.thrift.protocol.TType.I32, (short)5); private static final org.apache.thrift.protocol.TField FILTER_STRING_FIELD_DESC = new org.apache.thrift.protocol.TField("filterString", org.apache.thrift.protocol.TType.STRING, (short)6); + private static final org.apache.thrift.protocol.TField ATTRIBUTES_FIELD_DESC = new org.apache.thrift.protocol.TField("attributes", org.apache.thrift.protocol.TType.MAP, (short)7); private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); static { @@ -65,6 +66,7 @@ public TTimeRange timeRange; // optional public int maxVersions; // optional public ByteBuffer filterString; // optional + public Map attributes; // optional /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements org.apache.thrift.TFieldIdEnum { @@ -73,7 +75,8 @@ TIMESTAMP((short)3, "timestamp"), TIME_RANGE((short)4, "timeRange"), MAX_VERSIONS((short)5, "maxVersions"), - FILTER_STRING((short)6, "filterString"); + FILTER_STRING((short)6, "filterString"), + ATTRIBUTES((short)7, "attributes"); private static final Map byName = new HashMap(); @@ -100,6 +103,8 @@ return MAX_VERSIONS; case 6: // FILTER_STRING return FILTER_STRING; + case 7: // ATTRIBUTES + return ATTRIBUTES; default: return null; } @@ -143,7 +148,7 @@ private static final int __TIMESTAMP_ISSET_ID = 0; private static final int __MAXVERSIONS_ISSET_ID = 1; private byte __isset_bitfield = 0; - private _Fields optionals[] = {_Fields.COLUMNS,_Fields.TIMESTAMP,_Fields.TIME_RANGE,_Fields.MAX_VERSIONS,_Fields.FILTER_STRING}; + private _Fields optionals[] = {_Fields.COLUMNS,_Fields.TIMESTAMP,_Fields.TIME_RANGE,_Fields.MAX_VERSIONS,_Fields.FILTER_STRING,_Fields.ATTRIBUTES}; 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); @@ -160,6 +165,10 @@ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); tmpMap.put(_Fields.FILTER_STRING, new org.apache.thrift.meta_data.FieldMetaData("filterString", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true))); + tmpMap.put(_Fields.ATTRIBUTES, new org.apache.thrift.meta_data.FieldMetaData("attributes", org.apache.thrift.TFieldRequirementType.OPTIONAL, + new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true), + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true)))); metaDataMap = Collections.unmodifiableMap(tmpMap); org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TGet.class, metaDataMap); } @@ -199,6 +208,23 @@ this.filterString = org.apache.thrift.TBaseHelper.copyBinary(other.filterString); ; } + if (other.isSetAttributes()) { + Map __this__attributes = new HashMap(); + for (Map.Entry other_element : other.attributes.entrySet()) { + + ByteBuffer other_element_key = other_element.getKey(); + ByteBuffer other_element_value = other_element.getValue(); + + ByteBuffer __this__attributes_copy_key = org.apache.thrift.TBaseHelper.copyBinary(other_element_key); +; + + ByteBuffer __this__attributes_copy_value = org.apache.thrift.TBaseHelper.copyBinary(other_element_value); +; + + __this__attributes.put(__this__attributes_copy_key, __this__attributes_copy_value); + } + this.attributes = __this__attributes; + } } public TGet deepCopy() { @@ -215,6 +241,7 @@ setMaxVersionsIsSet(false); this.maxVersions = 0; this.filterString = null; + this.attributes = null; } public byte[] getRow() { @@ -394,6 +421,41 @@ } } + public int getAttributesSize() { + return (this.attributes == null) ? 0 : this.attributes.size(); + } + + public void putToAttributes(ByteBuffer key, ByteBuffer val) { + if (this.attributes == null) { + this.attributes = new HashMap(); + } + this.attributes.put(key, val); + } + + public Map getAttributes() { + return this.attributes; + } + + public TGet setAttributes(Map attributes) { + this.attributes = attributes; + return this; + } + + public void unsetAttributes() { + this.attributes = null; + } + + /** Returns true if field attributes is set (has been assigned a value) and false otherwise */ + public boolean isSetAttributes() { + return this.attributes != null; + } + + public void setAttributesIsSet(boolean value) { + if (!value) { + this.attributes = null; + } + } + public void setFieldValue(_Fields field, Object value) { switch (field) { case ROW: @@ -444,6 +506,14 @@ } break; + case ATTRIBUTES: + if (value == null) { + unsetAttributes(); + } else { + setAttributes((Map)value); + } + break; + } } @@ -467,6 +537,9 @@ case FILTER_STRING: return getFilterString(); + case ATTRIBUTES: + return getAttributes(); + } throw new IllegalStateException(); } @@ -490,6 +563,8 @@ return isSetMaxVersions(); case FILTER_STRING: return isSetFilterString(); + case ATTRIBUTES: + return isSetAttributes(); } throw new IllegalStateException(); } @@ -561,6 +636,15 @@ return false; } + boolean this_present_attributes = true && this.isSetAttributes(); + boolean that_present_attributes = true && that.isSetAttributes(); + if (this_present_attributes || that_present_attributes) { + if (!(this_present_attributes && that_present_attributes)) + return false; + if (!this.attributes.equals(that.attributes)) + return false; + } + return true; } @@ -637,6 +721,16 @@ return lastComparison; } } + lastComparison = Boolean.valueOf(isSetAttributes()).compareTo(typedOther.isSetAttributes()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAttributes()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.attributes, typedOther.attributes); + if (lastComparison != 0) { + return lastComparison; + } + } return 0; } @@ -706,6 +800,16 @@ } first = false; } + if (isSetAttributes()) { + if (!first) sb.append(", "); + sb.append("attributes:"); + if (this.attributes == null) { + sb.append("null"); + } else { + sb.append(this.attributes); + } + first = false; + } sb.append(")"); return sb.toString(); } @@ -772,7 +876,7 @@ struct.columns = new ArrayList(_list8.size); for (int _i9 = 0; _i9 < _list8.size; ++_i9) { - TColumn _elem10; // optional + TColumn _elem10; // required _elem10 = new TColumn(); _elem10.read(iprot); struct.columns.add(_elem10); @@ -817,6 +921,26 @@ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; + case 7: // ATTRIBUTES + if (schemeField.type == org.apache.thrift.protocol.TType.MAP) { + { + org.apache.thrift.protocol.TMap _map11 = iprot.readMapBegin(); + struct.attributes = new HashMap(2*_map11.size); + for (int _i12 = 0; _i12 < _map11.size; ++_i12) + { + ByteBuffer _key13; // required + ByteBuffer _val14; // required + _key13 = iprot.readBinary(); + _val14 = iprot.readBinary(); + struct.attributes.put(_key13, _val14); + } + iprot.readMapEnd(); + } + struct.setAttributesIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; default: org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } @@ -842,9 +966,9 @@ oprot.writeFieldBegin(COLUMNS_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.columns.size())); - for (TColumn _iter11 : struct.columns) + for (TColumn _iter15 : struct.columns) { - _iter11.write(oprot); + _iter15.write(oprot); } oprot.writeListEnd(); } @@ -875,6 +999,21 @@ oprot.writeFieldEnd(); } } + if (struct.attributes != null) { + if (struct.isSetAttributes()) { + oprot.writeFieldBegin(ATTRIBUTES_FIELD_DESC); + { + oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, struct.attributes.size())); + for (Map.Entry _iter16 : struct.attributes.entrySet()) + { + oprot.writeBinary(_iter16.getKey()); + oprot.writeBinary(_iter16.getValue()); + } + oprot.writeMapEnd(); + } + oprot.writeFieldEnd(); + } + } oprot.writeFieldStop(); oprot.writeStructEnd(); } @@ -909,13 +1048,16 @@ if (struct.isSetFilterString()) { optionals.set(4); } - oprot.writeBitSet(optionals, 5); + if (struct.isSetAttributes()) { + optionals.set(5); + } + oprot.writeBitSet(optionals, 6); if (struct.isSetColumns()) { { oprot.writeI32(struct.columns.size()); - for (TColumn _iter12 : struct.columns) + for (TColumn _iter17 : struct.columns) { - _iter12.write(oprot); + _iter17.write(oprot); } } } @@ -931,6 +1073,16 @@ if (struct.isSetFilterString()) { oprot.writeBinary(struct.filterString); } + if (struct.isSetAttributes()) { + { + oprot.writeI32(struct.attributes.size()); + for (Map.Entry _iter18 : struct.attributes.entrySet()) + { + oprot.writeBinary(_iter18.getKey()); + oprot.writeBinary(_iter18.getValue()); + } + } + } } @Override @@ -938,17 +1090,17 @@ TTupleProtocol iprot = (TTupleProtocol) prot; struct.row = iprot.readBinary(); struct.setRowIsSet(true); - BitSet incoming = iprot.readBitSet(5); + BitSet incoming = iprot.readBitSet(6); if (incoming.get(0)) { { - org.apache.thrift.protocol.TList _list13 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); - struct.columns = new ArrayList(_list13.size); - for (int _i14 = 0; _i14 < _list13.size; ++_i14) - { - TColumn _elem15; // optional - _elem15 = new TColumn(); - _elem15.read(iprot); - struct.columns.add(_elem15); + org.apache.thrift.protocol.TList _list19 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.columns = new ArrayList(_list19.size); + for (int _i20 = 0; _i20 < _list19.size; ++_i20) + { + TColumn _elem21; // required + _elem21 = new TColumn(); + _elem21.read(iprot); + struct.columns.add(_elem21); } } struct.setColumnsIsSet(true); @@ -970,6 +1122,21 @@ struct.filterString = iprot.readBinary(); struct.setFilterStringIsSet(true); } + if (incoming.get(5)) { + { + org.apache.thrift.protocol.TMap _map22 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32()); + struct.attributes = new HashMap(2*_map22.size); + for (int _i23 = 0; _i23 < _map22.size; ++_i23) + { + ByteBuffer _key24; // required + ByteBuffer _val25; // required + _key24 = iprot.readBinary(); + _val25 = iprot.readBinary(); + struct.attributes.put(_key24, _val25); + } + } + struct.setAttributesIsSet(true); + } } } Index: hbase-server/src/main/java/org/apache/hadoop/hbase/thrift2/generated/TDelete.java =================================================================== --- hbase-server/src/main/java/org/apache/hadoop/hbase/thrift2/generated/TDelete.java (revision 1502190) +++ hbase-server/src/main/java/org/apache/hadoop/hbase/thrift2/generated/TDelete.java (working copy) @@ -61,6 +61,7 @@ private static final org.apache.thrift.protocol.TField TIMESTAMP_FIELD_DESC = new org.apache.thrift.protocol.TField("timestamp", org.apache.thrift.protocol.TType.I64, (short)3); private static final org.apache.thrift.protocol.TField DELETE_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("deleteType", org.apache.thrift.protocol.TType.I32, (short)4); private static final org.apache.thrift.protocol.TField WRITE_TO_WAL_FIELD_DESC = new org.apache.thrift.protocol.TField("writeToWal", org.apache.thrift.protocol.TType.BOOL, (short)5); + private static final org.apache.thrift.protocol.TField ATTRIBUTES_FIELD_DESC = new org.apache.thrift.protocol.TField("attributes", org.apache.thrift.protocol.TType.MAP, (short)6); private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); static { @@ -77,6 +78,7 @@ */ public TDeleteType deleteType; // optional public boolean writeToWal; // optional + public Map attributes; // optional /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements org.apache.thrift.TFieldIdEnum { @@ -88,7 +90,8 @@ * @see TDeleteType */ DELETE_TYPE((short)4, "deleteType"), - WRITE_TO_WAL((short)5, "writeToWal"); + WRITE_TO_WAL((short)5, "writeToWal"), + ATTRIBUTES((short)6, "attributes"); private static final Map byName = new HashMap(); @@ -113,6 +116,8 @@ return DELETE_TYPE; case 5: // WRITE_TO_WAL return WRITE_TO_WAL; + case 6: // ATTRIBUTES + return ATTRIBUTES; default: return null; } @@ -156,7 +161,7 @@ private static final int __TIMESTAMP_ISSET_ID = 0; private static final int __WRITETOWAL_ISSET_ID = 1; private byte __isset_bitfield = 0; - private _Fields optionals[] = {_Fields.COLUMNS,_Fields.TIMESTAMP,_Fields.DELETE_TYPE,_Fields.WRITE_TO_WAL}; + private _Fields optionals[] = {_Fields.COLUMNS,_Fields.TIMESTAMP,_Fields.DELETE_TYPE,_Fields.WRITE_TO_WAL,_Fields.ATTRIBUTES}; 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); @@ -171,6 +176,10 @@ new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, TDeleteType.class))); tmpMap.put(_Fields.WRITE_TO_WAL, new org.apache.thrift.meta_data.FieldMetaData("writeToWal", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL))); + tmpMap.put(_Fields.ATTRIBUTES, new org.apache.thrift.meta_data.FieldMetaData("attributes", org.apache.thrift.TFieldRequirementType.OPTIONAL, + new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true), + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true)))); metaDataMap = Collections.unmodifiableMap(tmpMap); org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TDelete.class, metaDataMap); } @@ -210,6 +219,23 @@ this.deleteType = other.deleteType; } this.writeToWal = other.writeToWal; + if (other.isSetAttributes()) { + Map __this__attributes = new HashMap(); + for (Map.Entry other_element : other.attributes.entrySet()) { + + ByteBuffer other_element_key = other_element.getKey(); + ByteBuffer other_element_value = other_element.getValue(); + + ByteBuffer __this__attributes_copy_key = org.apache.thrift.TBaseHelper.copyBinary(other_element_key); +; + + ByteBuffer __this__attributes_copy_value = org.apache.thrift.TBaseHelper.copyBinary(other_element_value); +; + + __this__attributes.put(__this__attributes_copy_key, __this__attributes_copy_value); + } + this.attributes = __this__attributes; + } } public TDelete deepCopy() { @@ -226,6 +252,7 @@ this.writeToWal = true; + this.attributes = null; } public byte[] getRow() { @@ -379,6 +406,41 @@ __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __WRITETOWAL_ISSET_ID, value); } + public int getAttributesSize() { + return (this.attributes == null) ? 0 : this.attributes.size(); + } + + public void putToAttributes(ByteBuffer key, ByteBuffer val) { + if (this.attributes == null) { + this.attributes = new HashMap(); + } + this.attributes.put(key, val); + } + + public Map getAttributes() { + return this.attributes; + } + + public TDelete setAttributes(Map attributes) { + this.attributes = attributes; + return this; + } + + public void unsetAttributes() { + this.attributes = null; + } + + /** Returns true if field attributes is set (has been assigned a value) and false otherwise */ + public boolean isSetAttributes() { + return this.attributes != null; + } + + public void setAttributesIsSet(boolean value) { + if (!value) { + this.attributes = null; + } + } + public void setFieldValue(_Fields field, Object value) { switch (field) { case ROW: @@ -421,6 +483,14 @@ } break; + case ATTRIBUTES: + if (value == null) { + unsetAttributes(); + } else { + setAttributes((Map)value); + } + break; + } } @@ -441,6 +511,9 @@ case WRITE_TO_WAL: return Boolean.valueOf(isWriteToWal()); + case ATTRIBUTES: + return getAttributes(); + } throw new IllegalStateException(); } @@ -462,6 +535,8 @@ return isSetDeleteType(); case WRITE_TO_WAL: return isSetWriteToWal(); + case ATTRIBUTES: + return isSetAttributes(); } throw new IllegalStateException(); } @@ -524,6 +599,15 @@ return false; } + boolean this_present_attributes = true && this.isSetAttributes(); + boolean that_present_attributes = true && that.isSetAttributes(); + if (this_present_attributes || that_present_attributes) { + if (!(this_present_attributes && that_present_attributes)) + return false; + if (!this.attributes.equals(that.attributes)) + return false; + } + return true; } @@ -590,6 +674,16 @@ return lastComparison; } } + lastComparison = Boolean.valueOf(isSetAttributes()).compareTo(typedOther.isSetAttributes()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAttributes()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.attributes, typedOther.attributes); + if (lastComparison != 0) { + return lastComparison; + } + } return 0; } @@ -649,6 +743,16 @@ sb.append(this.writeToWal); first = false; } + if (isSetAttributes()) { + if (!first) sb.append(", "); + sb.append("attributes:"); + if (this.attributes == null) { + sb.append("null"); + } else { + sb.append(this.attributes); + } + first = false; + } sb.append(")"); return sb.toString(); } @@ -708,14 +812,14 @@ case 2: // COLUMNS if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list24 = iprot.readListBegin(); - struct.columns = new ArrayList(_list24.size); - for (int _i25 = 0; _i25 < _list24.size; ++_i25) - { - TColumn _elem26; // required - _elem26 = new TColumn(); - _elem26.read(iprot); - struct.columns.add(_elem26); + org.apache.thrift.protocol.TList _list44 = iprot.readListBegin(); + struct.columns = new ArrayList(_list44.size); + for (int _i45 = 0; _i45 < _list44.size; ++_i45) + { + TColumn _elem46; // required + _elem46 = new TColumn(); + _elem46.read(iprot); + struct.columns.add(_elem46); } iprot.readListEnd(); } @@ -748,6 +852,26 @@ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; + case 6: // ATTRIBUTES + if (schemeField.type == org.apache.thrift.protocol.TType.MAP) { + { + org.apache.thrift.protocol.TMap _map47 = iprot.readMapBegin(); + struct.attributes = new HashMap(2*_map47.size); + for (int _i48 = 0; _i48 < _map47.size; ++_i48) + { + ByteBuffer _key49; // required + ByteBuffer _val50; // required + _key49 = iprot.readBinary(); + _val50 = iprot.readBinary(); + struct.attributes.put(_key49, _val50); + } + iprot.readMapEnd(); + } + struct.setAttributesIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; default: org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } @@ -773,9 +897,9 @@ oprot.writeFieldBegin(COLUMNS_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.columns.size())); - for (TColumn _iter27 : struct.columns) + for (TColumn _iter51 : struct.columns) { - _iter27.write(oprot); + _iter51.write(oprot); } oprot.writeListEnd(); } @@ -799,6 +923,21 @@ oprot.writeBool(struct.writeToWal); oprot.writeFieldEnd(); } + if (struct.attributes != null) { + if (struct.isSetAttributes()) { + oprot.writeFieldBegin(ATTRIBUTES_FIELD_DESC); + { + oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, struct.attributes.size())); + for (Map.Entry _iter52 : struct.attributes.entrySet()) + { + oprot.writeBinary(_iter52.getKey()); + oprot.writeBinary(_iter52.getValue()); + } + oprot.writeMapEnd(); + } + oprot.writeFieldEnd(); + } + } oprot.writeFieldStop(); oprot.writeStructEnd(); } @@ -830,13 +969,16 @@ if (struct.isSetWriteToWal()) { optionals.set(3); } - oprot.writeBitSet(optionals, 4); + if (struct.isSetAttributes()) { + optionals.set(4); + } + oprot.writeBitSet(optionals, 5); if (struct.isSetColumns()) { { oprot.writeI32(struct.columns.size()); - for (TColumn _iter28 : struct.columns) + for (TColumn _iter53 : struct.columns) { - _iter28.write(oprot); + _iter53.write(oprot); } } } @@ -849,6 +991,16 @@ if (struct.isSetWriteToWal()) { oprot.writeBool(struct.writeToWal); } + if (struct.isSetAttributes()) { + { + oprot.writeI32(struct.attributes.size()); + for (Map.Entry _iter54 : struct.attributes.entrySet()) + { + oprot.writeBinary(_iter54.getKey()); + oprot.writeBinary(_iter54.getValue()); + } + } + } } @Override @@ -856,17 +1008,17 @@ TTupleProtocol iprot = (TTupleProtocol) prot; struct.row = iprot.readBinary(); struct.setRowIsSet(true); - BitSet incoming = iprot.readBitSet(4); + BitSet incoming = iprot.readBitSet(5); if (incoming.get(0)) { { - org.apache.thrift.protocol.TList _list29 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); - struct.columns = new ArrayList(_list29.size); - for (int _i30 = 0; _i30 < _list29.size; ++_i30) - { - TColumn _elem31; // required - _elem31 = new TColumn(); - _elem31.read(iprot); - struct.columns.add(_elem31); + org.apache.thrift.protocol.TList _list55 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.columns = new ArrayList(_list55.size); + for (int _i56 = 0; _i56 < _list55.size; ++_i56) + { + TColumn _elem57; // required + _elem57 = new TColumn(); + _elem57.read(iprot); + struct.columns.add(_elem57); } } struct.setColumnsIsSet(true); @@ -883,6 +1035,21 @@ struct.writeToWal = iprot.readBool(); struct.setWriteToWalIsSet(true); } + if (incoming.get(4)) { + { + org.apache.thrift.protocol.TMap _map58 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32()); + struct.attributes = new HashMap(2*_map58.size); + for (int _i59 = 0; _i59 < _map58.size; ++_i59) + { + ByteBuffer _key60; // required + ByteBuffer _val61; // required + _key60 = iprot.readBinary(); + _val61 = iprot.readBinary(); + struct.attributes.put(_key60, _val61); + } + } + struct.setAttributesIsSet(true); + } } } Index: hbase-server/src/main/java/org/apache/hadoop/hbase/thrift2/generated/THBaseService.java =================================================================== --- hbase-server/src/main/java/org/apache/hadoop/hbase/thrift2/generated/THBaseService.java (revision 1502190) +++ hbase-server/src/main/java/org/apache/hadoop/hbase/thrift2/generated/THBaseService.java (working copy) @@ -131,9 +131,9 @@ /** * Bulk commit a List of TDeletes to the table. * - * This returns a list of TDeletes that were not - * executed. So if everything succeeds you'll - * receive an empty list. + * Throws a TIOError if any of the deletes fail. + * + * Always returns an empty list for backwards compatibility. * * @param table the table to delete from * @@ -3772,14 +3772,14 @@ case 2: // GETS if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list48 = iprot.readListBegin(); - struct.gets = new ArrayList(_list48.size); - for (int _i49 = 0; _i49 < _list48.size; ++_i49) - { - TGet _elem50; // required - _elem50 = new TGet(); - _elem50.read(iprot); - struct.gets.add(_elem50); + org.apache.thrift.protocol.TList _list98 = iprot.readListBegin(); + struct.gets = new ArrayList(_list98.size); + for (int _i99 = 0; _i99 < _list98.size; ++_i99) + { + TGet _elem100; // required + _elem100 = new TGet(); + _elem100.read(iprot); + struct.gets.add(_elem100); } iprot.readListEnd(); } @@ -3812,9 +3812,9 @@ oprot.writeFieldBegin(GETS_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.gets.size())); - for (TGet _iter51 : struct.gets) + for (TGet _iter101 : struct.gets) { - _iter51.write(oprot); + _iter101.write(oprot); } oprot.writeListEnd(); } @@ -3840,9 +3840,9 @@ oprot.writeBinary(struct.table); { oprot.writeI32(struct.gets.size()); - for (TGet _iter52 : struct.gets) + for (TGet _iter102 : struct.gets) { - _iter52.write(oprot); + _iter102.write(oprot); } } } @@ -3853,14 +3853,14 @@ struct.table = iprot.readBinary(); struct.setTableIsSet(true); { - org.apache.thrift.protocol.TList _list53 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); - struct.gets = new ArrayList(_list53.size); - for (int _i54 = 0; _i54 < _list53.size; ++_i54) - { - TGet _elem55; // required - _elem55 = new TGet(); - _elem55.read(iprot); - struct.gets.add(_elem55); + org.apache.thrift.protocol.TList _list103 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.gets = new ArrayList(_list103.size); + for (int _i104 = 0; _i104 < _list103.size; ++_i104) + { + TGet _elem105; // required + _elem105 = new TGet(); + _elem105.read(iprot); + struct.gets.add(_elem105); } } struct.setGetsIsSet(true); @@ -4255,14 +4255,14 @@ case 0: // SUCCESS if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list56 = iprot.readListBegin(); - struct.success = new ArrayList(_list56.size); - for (int _i57 = 0; _i57 < _list56.size; ++_i57) - { - TResult _elem58; // required - _elem58 = new TResult(); - _elem58.read(iprot); - struct.success.add(_elem58); + org.apache.thrift.protocol.TList _list106 = iprot.readListBegin(); + struct.success = new ArrayList(_list106.size); + for (int _i107 = 0; _i107 < _list106.size; ++_i107) + { + TResult _elem108; // required + _elem108 = new TResult(); + _elem108.read(iprot); + struct.success.add(_elem108); } iprot.readListEnd(); } @@ -4299,9 +4299,9 @@ oprot.writeFieldBegin(SUCCESS_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.success.size())); - for (TResult _iter59 : struct.success) + for (TResult _iter109 : struct.success) { - _iter59.write(oprot); + _iter109.write(oprot); } oprot.writeListEnd(); } @@ -4340,9 +4340,9 @@ if (struct.isSetSuccess()) { { oprot.writeI32(struct.success.size()); - for (TResult _iter60 : struct.success) + for (TResult _iter110 : struct.success) { - _iter60.write(oprot); + _iter110.write(oprot); } } } @@ -4357,14 +4357,14 @@ BitSet incoming = iprot.readBitSet(2); if (incoming.get(0)) { { - org.apache.thrift.protocol.TList _list61 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); - struct.success = new ArrayList(_list61.size); - for (int _i62 = 0; _i62 < _list61.size; ++_i62) - { - TResult _elem63; // required - _elem63 = new TResult(); - _elem63.read(iprot); - struct.success.add(_elem63); + org.apache.thrift.protocol.TList _list111 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.success = new ArrayList(_list111.size); + for (int _i112 = 0; _i112 < _list111.size; ++_i112) + { + TResult _elem113; // required + _elem113 = new TResult(); + _elem113.read(iprot); + struct.success.add(_elem113); } } struct.setSuccessIsSet(true); @@ -7083,14 +7083,14 @@ case 2: // PUTS if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list64 = iprot.readListBegin(); - struct.puts = new ArrayList(_list64.size); - for (int _i65 = 0; _i65 < _list64.size; ++_i65) - { - TPut _elem66; // required - _elem66 = new TPut(); - _elem66.read(iprot); - struct.puts.add(_elem66); + org.apache.thrift.protocol.TList _list114 = iprot.readListBegin(); + struct.puts = new ArrayList(_list114.size); + for (int _i115 = 0; _i115 < _list114.size; ++_i115) + { + TPut _elem116; // required + _elem116 = new TPut(); + _elem116.read(iprot); + struct.puts.add(_elem116); } iprot.readListEnd(); } @@ -7123,9 +7123,9 @@ oprot.writeFieldBegin(PUTS_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.puts.size())); - for (TPut _iter67 : struct.puts) + for (TPut _iter117 : struct.puts) { - _iter67.write(oprot); + _iter117.write(oprot); } oprot.writeListEnd(); } @@ -7151,9 +7151,9 @@ oprot.writeBinary(struct.table); { oprot.writeI32(struct.puts.size()); - for (TPut _iter68 : struct.puts) + for (TPut _iter118 : struct.puts) { - _iter68.write(oprot); + _iter118.write(oprot); } } } @@ -7164,14 +7164,14 @@ struct.table = iprot.readBinary(); struct.setTableIsSet(true); { - org.apache.thrift.protocol.TList _list69 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); - struct.puts = new ArrayList(_list69.size); - for (int _i70 = 0; _i70 < _list69.size; ++_i70) - { - TPut _elem71; // required - _elem71 = new TPut(); - _elem71.read(iprot); - struct.puts.add(_elem71); + org.apache.thrift.protocol.TList _list119 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.puts = new ArrayList(_list119.size); + for (int _i120 = 0; _i120 < _list119.size; ++_i120) + { + TPut _elem121; // required + _elem121 = new TPut(); + _elem121.read(iprot); + struct.puts.add(_elem121); } } struct.setPutsIsSet(true); @@ -8810,14 +8810,14 @@ case 2: // DELETES if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list72 = iprot.readListBegin(); - struct.deletes = new ArrayList(_list72.size); - for (int _i73 = 0; _i73 < _list72.size; ++_i73) - { - TDelete _elem74; // required - _elem74 = new TDelete(); - _elem74.read(iprot); - struct.deletes.add(_elem74); + org.apache.thrift.protocol.TList _list122 = iprot.readListBegin(); + struct.deletes = new ArrayList(_list122.size); + for (int _i123 = 0; _i123 < _list122.size; ++_i123) + { + TDelete _elem124; // required + _elem124 = new TDelete(); + _elem124.read(iprot); + struct.deletes.add(_elem124); } iprot.readListEnd(); } @@ -8850,9 +8850,9 @@ oprot.writeFieldBegin(DELETES_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.deletes.size())); - for (TDelete _iter75 : struct.deletes) + for (TDelete _iter125 : struct.deletes) { - _iter75.write(oprot); + _iter125.write(oprot); } oprot.writeListEnd(); } @@ -8878,9 +8878,9 @@ oprot.writeBinary(struct.table); { oprot.writeI32(struct.deletes.size()); - for (TDelete _iter76 : struct.deletes) + for (TDelete _iter126 : struct.deletes) { - _iter76.write(oprot); + _iter126.write(oprot); } } } @@ -8891,14 +8891,14 @@ struct.table = iprot.readBinary(); struct.setTableIsSet(true); { - org.apache.thrift.protocol.TList _list77 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); - struct.deletes = new ArrayList(_list77.size); - for (int _i78 = 0; _i78 < _list77.size; ++_i78) - { - TDelete _elem79; // required - _elem79 = new TDelete(); - _elem79.read(iprot); - struct.deletes.add(_elem79); + org.apache.thrift.protocol.TList _list127 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.deletes = new ArrayList(_list127.size); + for (int _i128 = 0; _i128 < _list127.size; ++_i128) + { + TDelete _elem129; // required + _elem129 = new TDelete(); + _elem129.read(iprot); + struct.deletes.add(_elem129); } } struct.setDeletesIsSet(true); @@ -9293,14 +9293,14 @@ case 0: // SUCCESS if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list80 = iprot.readListBegin(); - struct.success = new ArrayList(_list80.size); - for (int _i81 = 0; _i81 < _list80.size; ++_i81) - { - TDelete _elem82; // required - _elem82 = new TDelete(); - _elem82.read(iprot); - struct.success.add(_elem82); + org.apache.thrift.protocol.TList _list130 = iprot.readListBegin(); + struct.success = new ArrayList(_list130.size); + for (int _i131 = 0; _i131 < _list130.size; ++_i131) + { + TDelete _elem132; // required + _elem132 = new TDelete(); + _elem132.read(iprot); + struct.success.add(_elem132); } iprot.readListEnd(); } @@ -9337,9 +9337,9 @@ oprot.writeFieldBegin(SUCCESS_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.success.size())); - for (TDelete _iter83 : struct.success) + for (TDelete _iter133 : struct.success) { - _iter83.write(oprot); + _iter133.write(oprot); } oprot.writeListEnd(); } @@ -9378,9 +9378,9 @@ if (struct.isSetSuccess()) { { oprot.writeI32(struct.success.size()); - for (TDelete _iter84 : struct.success) + for (TDelete _iter134 : struct.success) { - _iter84.write(oprot); + _iter134.write(oprot); } } } @@ -9395,14 +9395,14 @@ BitSet incoming = iprot.readBitSet(2); if (incoming.get(0)) { { - org.apache.thrift.protocol.TList _list85 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); - struct.success = new ArrayList(_list85.size); - for (int _i86 = 0; _i86 < _list85.size; ++_i86) - { - TDelete _elem87; // required - _elem87 = new TDelete(); - _elem87.read(iprot); - struct.success.add(_elem87); + org.apache.thrift.protocol.TList _list135 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.success = new ArrayList(_list135.size); + for (int _i136 = 0; _i136 < _list135.size; ++_i136) + { + TDelete _elem137; // required + _elem137 = new TDelete(); + _elem137.read(iprot); + struct.success.add(_elem137); } } struct.setSuccessIsSet(true); @@ -13674,14 +13674,14 @@ case 0: // SUCCESS if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list88 = iprot.readListBegin(); - struct.success = new ArrayList(_list88.size); - for (int _i89 = 0; _i89 < _list88.size; ++_i89) - { - TResult _elem90; // required - _elem90 = new TResult(); - _elem90.read(iprot); - struct.success.add(_elem90); + org.apache.thrift.protocol.TList _list138 = iprot.readListBegin(); + struct.success = new ArrayList(_list138.size); + for (int _i139 = 0; _i139 < _list138.size; ++_i139) + { + TResult _elem140; // required + _elem140 = new TResult(); + _elem140.read(iprot); + struct.success.add(_elem140); } iprot.readListEnd(); } @@ -13727,9 +13727,9 @@ oprot.writeFieldBegin(SUCCESS_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.success.size())); - for (TResult _iter91 : struct.success) + for (TResult _iter141 : struct.success) { - _iter91.write(oprot); + _iter141.write(oprot); } oprot.writeListEnd(); } @@ -13776,9 +13776,9 @@ if (struct.isSetSuccess()) { { oprot.writeI32(struct.success.size()); - for (TResult _iter92 : struct.success) + for (TResult _iter142 : struct.success) { - _iter92.write(oprot); + _iter142.write(oprot); } } } @@ -13796,14 +13796,14 @@ BitSet incoming = iprot.readBitSet(3); if (incoming.get(0)) { { - org.apache.thrift.protocol.TList _list93 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); - struct.success = new ArrayList(_list93.size); - for (int _i94 = 0; _i94 < _list93.size; ++_i94) - { - TResult _elem95; // required - _elem95 = new TResult(); - _elem95.read(iprot); - struct.success.add(_elem95); + org.apache.thrift.protocol.TList _list143 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.success = new ArrayList(_list143.size); + for (int _i144 = 0; _i144 < _list143.size; ++_i144) + { + TResult _elem145; // required + _elem145 = new TResult(); + _elem145.read(iprot); + struct.success.add(_elem145); } } struct.setSuccessIsSet(true); Index: hbase-server/src/main/java/org/apache/hadoop/hbase/thrift2/generated/TIncrement.java =================================================================== --- hbase-server/src/main/java/org/apache/hadoop/hbase/thrift2/generated/TIncrement.java (revision 1502190) +++ hbase-server/src/main/java/org/apache/hadoop/hbase/thrift2/generated/TIncrement.java (working copy) @@ -42,6 +42,7 @@ private static final org.apache.thrift.protocol.TField ROW_FIELD_DESC = new org.apache.thrift.protocol.TField("row", org.apache.thrift.protocol.TType.STRING, (short)1); private static final org.apache.thrift.protocol.TField COLUMNS_FIELD_DESC = new org.apache.thrift.protocol.TField("columns", org.apache.thrift.protocol.TType.LIST, (short)2); private static final org.apache.thrift.protocol.TField WRITE_TO_WAL_FIELD_DESC = new org.apache.thrift.protocol.TField("writeToWal", org.apache.thrift.protocol.TType.BOOL, (short)3); + private static final org.apache.thrift.protocol.TField ATTRIBUTES_FIELD_DESC = new org.apache.thrift.protocol.TField("attributes", org.apache.thrift.protocol.TType.MAP, (short)4); private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); static { @@ -52,12 +53,14 @@ public ByteBuffer row; // required public List columns; // required public boolean writeToWal; // optional + public Map attributes; // optional /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements org.apache.thrift.TFieldIdEnum { ROW((short)1, "row"), COLUMNS((short)2, "columns"), - WRITE_TO_WAL((short)3, "writeToWal"); + WRITE_TO_WAL((short)3, "writeToWal"), + ATTRIBUTES((short)4, "attributes"); private static final Map byName = new HashMap(); @@ -78,6 +81,8 @@ return COLUMNS; case 3: // WRITE_TO_WAL return WRITE_TO_WAL; + case 4: // ATTRIBUTES + return ATTRIBUTES; default: return null; } @@ -120,7 +125,7 @@ // isset id assignments private static final int __WRITETOWAL_ISSET_ID = 0; private byte __isset_bitfield = 0; - private _Fields optionals[] = {_Fields.WRITE_TO_WAL}; + private _Fields optionals[] = {_Fields.WRITE_TO_WAL,_Fields.ATTRIBUTES}; 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); @@ -131,6 +136,10 @@ new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TColumnIncrement.class)))); tmpMap.put(_Fields.WRITE_TO_WAL, new org.apache.thrift.meta_data.FieldMetaData("writeToWal", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL))); + tmpMap.put(_Fields.ATTRIBUTES, new org.apache.thrift.meta_data.FieldMetaData("attributes", org.apache.thrift.TFieldRequirementType.OPTIONAL, + new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true), + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true)))); metaDataMap = Collections.unmodifiableMap(tmpMap); org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TIncrement.class, metaDataMap); } @@ -166,6 +175,23 @@ this.columns = __this__columns; } this.writeToWal = other.writeToWal; + if (other.isSetAttributes()) { + Map __this__attributes = new HashMap(); + for (Map.Entry other_element : other.attributes.entrySet()) { + + ByteBuffer other_element_key = other_element.getKey(); + ByteBuffer other_element_value = other_element.getValue(); + + ByteBuffer __this__attributes_copy_key = org.apache.thrift.TBaseHelper.copyBinary(other_element_key); +; + + ByteBuffer __this__attributes_copy_value = org.apache.thrift.TBaseHelper.copyBinary(other_element_value); +; + + __this__attributes.put(__this__attributes_copy_key, __this__attributes_copy_value); + } + this.attributes = __this__attributes; + } } public TIncrement deepCopy() { @@ -178,6 +204,7 @@ this.columns = null; this.writeToWal = true; + this.attributes = null; } public byte[] getRow() { @@ -276,6 +303,41 @@ __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __WRITETOWAL_ISSET_ID, value); } + public int getAttributesSize() { + return (this.attributes == null) ? 0 : this.attributes.size(); + } + + public void putToAttributes(ByteBuffer key, ByteBuffer val) { + if (this.attributes == null) { + this.attributes = new HashMap(); + } + this.attributes.put(key, val); + } + + public Map getAttributes() { + return this.attributes; + } + + public TIncrement setAttributes(Map attributes) { + this.attributes = attributes; + return this; + } + + public void unsetAttributes() { + this.attributes = null; + } + + /** Returns true if field attributes is set (has been assigned a value) and false otherwise */ + public boolean isSetAttributes() { + return this.attributes != null; + } + + public void setAttributesIsSet(boolean value) { + if (!value) { + this.attributes = null; + } + } + public void setFieldValue(_Fields field, Object value) { switch (field) { case ROW: @@ -302,6 +364,14 @@ } break; + case ATTRIBUTES: + if (value == null) { + unsetAttributes(); + } else { + setAttributes((Map)value); + } + break; + } } @@ -316,6 +386,9 @@ case WRITE_TO_WAL: return Boolean.valueOf(isWriteToWal()); + case ATTRIBUTES: + return getAttributes(); + } throw new IllegalStateException(); } @@ -333,6 +406,8 @@ return isSetColumns(); case WRITE_TO_WAL: return isSetWriteToWal(); + case ATTRIBUTES: + return isSetAttributes(); } throw new IllegalStateException(); } @@ -377,6 +452,15 @@ return false; } + boolean this_present_attributes = true && this.isSetAttributes(); + boolean that_present_attributes = true && that.isSetAttributes(); + if (this_present_attributes || that_present_attributes) { + if (!(this_present_attributes && that_present_attributes)) + return false; + if (!this.attributes.equals(that.attributes)) + return false; + } + return true; } @@ -423,6 +507,16 @@ return lastComparison; } } + lastComparison = Boolean.valueOf(isSetAttributes()).compareTo(typedOther.isSetAttributes()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAttributes()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.attributes, typedOther.attributes); + if (lastComparison != 0) { + return lastComparison; + } + } return 0; } @@ -464,6 +558,16 @@ sb.append(this.writeToWal); first = false; } + if (isSetAttributes()) { + if (!first) sb.append(", "); + sb.append("attributes:"); + if (this.attributes == null) { + sb.append("null"); + } else { + sb.append(this.attributes); + } + first = false; + } sb.append(")"); return sb.toString(); } @@ -526,14 +630,14 @@ case 2: // COLUMNS if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list32 = iprot.readListBegin(); - struct.columns = new ArrayList(_list32.size); - for (int _i33 = 0; _i33 < _list32.size; ++_i33) - { - TColumnIncrement _elem34; // required - _elem34 = new TColumnIncrement(); - _elem34.read(iprot); - struct.columns.add(_elem34); + org.apache.thrift.protocol.TList _list62 = iprot.readListBegin(); + struct.columns = new ArrayList(_list62.size); + for (int _i63 = 0; _i63 < _list62.size; ++_i63) + { + TColumnIncrement _elem64; // required + _elem64 = new TColumnIncrement(); + _elem64.read(iprot); + struct.columns.add(_elem64); } iprot.readListEnd(); } @@ -550,6 +654,26 @@ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; + case 4: // ATTRIBUTES + if (schemeField.type == org.apache.thrift.protocol.TType.MAP) { + { + org.apache.thrift.protocol.TMap _map65 = iprot.readMapBegin(); + struct.attributes = new HashMap(2*_map65.size); + for (int _i66 = 0; _i66 < _map65.size; ++_i66) + { + ByteBuffer _key67; // required + ByteBuffer _val68; // required + _key67 = iprot.readBinary(); + _val68 = iprot.readBinary(); + struct.attributes.put(_key67, _val68); + } + iprot.readMapEnd(); + } + struct.setAttributesIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; default: org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } @@ -574,9 +698,9 @@ oprot.writeFieldBegin(COLUMNS_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.columns.size())); - for (TColumnIncrement _iter35 : struct.columns) + for (TColumnIncrement _iter69 : struct.columns) { - _iter35.write(oprot); + _iter69.write(oprot); } oprot.writeListEnd(); } @@ -587,6 +711,21 @@ oprot.writeBool(struct.writeToWal); oprot.writeFieldEnd(); } + if (struct.attributes != null) { + if (struct.isSetAttributes()) { + oprot.writeFieldBegin(ATTRIBUTES_FIELD_DESC); + { + oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, struct.attributes.size())); + for (Map.Entry _iter70 : struct.attributes.entrySet()) + { + oprot.writeBinary(_iter70.getKey()); + oprot.writeBinary(_iter70.getValue()); + } + oprot.writeMapEnd(); + } + oprot.writeFieldEnd(); + } + } oprot.writeFieldStop(); oprot.writeStructEnd(); } @@ -607,19 +746,32 @@ oprot.writeBinary(struct.row); { oprot.writeI32(struct.columns.size()); - for (TColumnIncrement _iter36 : struct.columns) + for (TColumnIncrement _iter71 : struct.columns) { - _iter36.write(oprot); + _iter71.write(oprot); } } BitSet optionals = new BitSet(); if (struct.isSetWriteToWal()) { optionals.set(0); } - oprot.writeBitSet(optionals, 1); + if (struct.isSetAttributes()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); if (struct.isSetWriteToWal()) { oprot.writeBool(struct.writeToWal); } + if (struct.isSetAttributes()) { + { + oprot.writeI32(struct.attributes.size()); + for (Map.Entry _iter72 : struct.attributes.entrySet()) + { + oprot.writeBinary(_iter72.getKey()); + oprot.writeBinary(_iter72.getValue()); + } + } + } } @Override @@ -628,22 +780,37 @@ struct.row = iprot.readBinary(); struct.setRowIsSet(true); { - org.apache.thrift.protocol.TList _list37 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); - struct.columns = new ArrayList(_list37.size); - for (int _i38 = 0; _i38 < _list37.size; ++_i38) - { - TColumnIncrement _elem39; // required - _elem39 = new TColumnIncrement(); - _elem39.read(iprot); - struct.columns.add(_elem39); + org.apache.thrift.protocol.TList _list73 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.columns = new ArrayList(_list73.size); + for (int _i74 = 0; _i74 < _list73.size; ++_i74) + { + TColumnIncrement _elem75; // required + _elem75 = new TColumnIncrement(); + _elem75.read(iprot); + struct.columns.add(_elem75); } } struct.setColumnsIsSet(true); - BitSet incoming = iprot.readBitSet(1); + BitSet incoming = iprot.readBitSet(2); if (incoming.get(0)) { struct.writeToWal = iprot.readBool(); struct.setWriteToWalIsSet(true); } + if (incoming.get(1)) { + { + org.apache.thrift.protocol.TMap _map76 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32()); + struct.attributes = new HashMap(2*_map76.size); + for (int _i77 = 0; _i77 < _map76.size; ++_i77) + { + ByteBuffer _key78; // required + ByteBuffer _val79; // required + _key78 = iprot.readBinary(); + _val79 = iprot.readBinary(); + struct.attributes.put(_key78, _val79); + } + } + struct.setAttributesIsSet(true); + } } } Index: hbase-server/src/main/java/org/apache/hadoop/hbase/thrift2/generated/TScan.java =================================================================== --- hbase-server/src/main/java/org/apache/hadoop/hbase/thrift2/generated/TScan.java (revision 1502255) +++ hbase-server/src/main/java/org/apache/hadoop/hbase/thrift2/generated/TScan.java (working copy) @@ -45,6 +45,7 @@ private static final org.apache.thrift.protocol.TField TIME_RANGE_FIELD_DESC = new org.apache.thrift.protocol.TField("timeRange", org.apache.thrift.protocol.TType.STRUCT, (short)6); private static final org.apache.thrift.protocol.TField FILTER_STRING_FIELD_DESC = new org.apache.thrift.protocol.TField("filterString", org.apache.thrift.protocol.TType.STRING, (short)7); private static final org.apache.thrift.protocol.TField BATCH_SIZE_FIELD_DESC = new org.apache.thrift.protocol.TField("batchSize", org.apache.thrift.protocol.TType.I32, (short)8); + private static final org.apache.thrift.protocol.TField ATTRIBUTES_FIELD_DESC = new org.apache.thrift.protocol.TField("attributes", org.apache.thrift.protocol.TType.MAP, (short)9); private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); static { @@ -60,6 +61,7 @@ public TTimeRange timeRange; // optional public ByteBuffer filterString; // optional public int batchSize; // optional + public Map attributes; // optional /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements org.apache.thrift.TFieldIdEnum { @@ -70,7 +72,8 @@ MAX_VERSIONS((short)5, "maxVersions"), TIME_RANGE((short)6, "timeRange"), FILTER_STRING((short)7, "filterString"), - BATCH_SIZE((short)8, "batchSize"); + BATCH_SIZE((short)8, "batchSize"), + ATTRIBUTES((short)9, "attributes"); private static final Map byName = new HashMap(); @@ -101,6 +104,8 @@ return FILTER_STRING; case 8: // BATCH_SIZE return BATCH_SIZE; + case 9: // ATTRIBUTES + return ATTRIBUTES; default: return null; } @@ -145,7 +150,7 @@ private static final int __MAXVERSIONS_ISSET_ID = 1; private static final int __BATCHSIZE_ISSET_ID = 2; private byte __isset_bitfield = 0; - private _Fields optionals[] = {_Fields.START_ROW,_Fields.STOP_ROW,_Fields.COLUMNS,_Fields.CACHING,_Fields.MAX_VERSIONS,_Fields.TIME_RANGE,_Fields.FILTER_STRING,_Fields.BATCH_SIZE}; + private _Fields optionals[] = {_Fields.START_ROW,_Fields.STOP_ROW,_Fields.COLUMNS,_Fields.CACHING,_Fields.MAX_VERSIONS,_Fields.TIME_RANGE,_Fields.FILTER_STRING,_Fields.BATCH_SIZE,_Fields.ATTRIBUTES}; 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); @@ -166,6 +171,10 @@ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true))); tmpMap.put(_Fields.BATCH_SIZE, new org.apache.thrift.meta_data.FieldMetaData("batchSize", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); + tmpMap.put(_Fields.ATTRIBUTES, new org.apache.thrift.meta_data.FieldMetaData("attributes", org.apache.thrift.TFieldRequirementType.OPTIONAL, + new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true), + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true)))); metaDataMap = Collections.unmodifiableMap(tmpMap); org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TScan.class, metaDataMap); } @@ -205,6 +214,23 @@ ; } this.batchSize = other.batchSize; + if (other.isSetAttributes()) { + Map __this__attributes = new HashMap(); + for (Map.Entry other_element : other.attributes.entrySet()) { + + ByteBuffer other_element_key = other_element.getKey(); + ByteBuffer other_element_value = other_element.getValue(); + + ByteBuffer __this__attributes_copy_key = org.apache.thrift.TBaseHelper.copyBinary(other_element_key); +; + + ByteBuffer __this__attributes_copy_value = org.apache.thrift.TBaseHelper.copyBinary(other_element_value); +; + + __this__attributes.put(__this__attributes_copy_key, __this__attributes_copy_value); + } + this.attributes = __this__attributes; + } } public TScan deepCopy() { @@ -224,6 +250,7 @@ this.filterString = null; setBatchSizeIsSet(false); this.batchSize = 0; + this.attributes = null; } public byte[] getStartRow() { @@ -460,6 +487,41 @@ __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __BATCHSIZE_ISSET_ID, value); } + public int getAttributesSize() { + return (this.attributes == null) ? 0 : this.attributes.size(); + } + + public void putToAttributes(ByteBuffer key, ByteBuffer val) { + if (this.attributes == null) { + this.attributes = new HashMap(); + } + this.attributes.put(key, val); + } + + public Map getAttributes() { + return this.attributes; + } + + public TScan setAttributes(Map attributes) { + this.attributes = attributes; + return this; + } + + public void unsetAttributes() { + this.attributes = null; + } + + /** Returns true if field attributes is set (has been assigned a value) and false otherwise */ + public boolean isSetAttributes() { + return this.attributes != null; + } + + public void setAttributesIsSet(boolean value) { + if (!value) { + this.attributes = null; + } + } + public void setFieldValue(_Fields field, Object value) { switch (field) { case START_ROW: @@ -526,6 +588,14 @@ } break; + case ATTRIBUTES: + if (value == null) { + unsetAttributes(); + } else { + setAttributes((Map)value); + } + break; + } } @@ -555,6 +625,9 @@ case BATCH_SIZE: return Integer.valueOf(getBatchSize()); + case ATTRIBUTES: + return getAttributes(); + } throw new IllegalStateException(); } @@ -582,6 +655,8 @@ return isSetFilterString(); case BATCH_SIZE: return isSetBatchSize(); + case ATTRIBUTES: + return isSetAttributes(); } throw new IllegalStateException(); } @@ -671,6 +746,15 @@ return false; } + boolean this_present_attributes = true && this.isSetAttributes(); + boolean that_present_attributes = true && that.isSetAttributes(); + if (this_present_attributes || that_present_attributes) { + if (!(this_present_attributes && that_present_attributes)) + return false; + if (!this.attributes.equals(that.attributes)) + return false; + } + return true; } @@ -767,6 +851,16 @@ return lastComparison; } } + lastComparison = Boolean.valueOf(isSetAttributes()).compareTo(typedOther.isSetAttributes()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAttributes()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.attributes, typedOther.attributes); + if (lastComparison != 0) { + return lastComparison; + } + } return 0; } @@ -854,6 +948,16 @@ sb.append(this.batchSize); first = false; } + if (isSetAttributes()) { + if (!first) sb.append(", "); + sb.append("attributes:"); + if (this.attributes == null) { + sb.append("null"); + } else { + sb.append(this.attributes); + } + first = false; + } sb.append(")"); return sb.toString(); } @@ -921,14 +1025,14 @@ case 3: // COLUMNS if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list40 = iprot.readListBegin(); - struct.columns = new ArrayList(_list40.size); - for (int _i41 = 0; _i41 < _list40.size; ++_i41) + org.apache.thrift.protocol.TList _list80 = iprot.readListBegin(); + struct.columns = new ArrayList(_list80.size); + for (int _i81 = 0; _i81 < _list80.size; ++_i81) { - TColumn _elem42; // optional - _elem42 = new TColumn(); - _elem42.read(iprot); - struct.columns.add(_elem42); + TColumn _elem82; // required + _elem82 = new TColumn(); + _elem82.read(iprot); + struct.columns.add(_elem82); } iprot.readListEnd(); } @@ -978,6 +1082,26 @@ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; + case 9: // ATTRIBUTES + if (schemeField.type == org.apache.thrift.protocol.TType.MAP) { + { + org.apache.thrift.protocol.TMap _map83 = iprot.readMapBegin(); + struct.attributes = new HashMap(2*_map83.size); + for (int _i84 = 0; _i84 < _map83.size; ++_i84) + { + ByteBuffer _key85; // required + ByteBuffer _val86; // required + _key85 = iprot.readBinary(); + _val86 = iprot.readBinary(); + struct.attributes.put(_key85, _val86); + } + iprot.readMapEnd(); + } + struct.setAttributesIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; default: org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } @@ -1012,9 +1136,9 @@ oprot.writeFieldBegin(COLUMNS_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.columns.size())); - for (TColumn _iter43 : struct.columns) + for (TColumn _iter87 : struct.columns) { - _iter43.write(oprot); + _iter87.write(oprot); } oprot.writeListEnd(); } @@ -1050,6 +1174,21 @@ oprot.writeI32(struct.batchSize); oprot.writeFieldEnd(); } + if (struct.attributes != null) { + if (struct.isSetAttributes()) { + oprot.writeFieldBegin(ATTRIBUTES_FIELD_DESC); + { + oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, struct.attributes.size())); + for (Map.Entry _iter88 : struct.attributes.entrySet()) + { + oprot.writeBinary(_iter88.getKey()); + oprot.writeBinary(_iter88.getValue()); + } + oprot.writeMapEnd(); + } + oprot.writeFieldEnd(); + } + } oprot.writeFieldStop(); oprot.writeStructEnd(); } @@ -1092,7 +1231,10 @@ if (struct.isSetBatchSize()) { optionals.set(7); } - oprot.writeBitSet(optionals, 8); + if (struct.isSetAttributes()) { + optionals.set(8); + } + oprot.writeBitSet(optionals, 9); if (struct.isSetStartRow()) { oprot.writeBinary(struct.startRow); } @@ -1102,9 +1244,9 @@ if (struct.isSetColumns()) { { oprot.writeI32(struct.columns.size()); - for (TColumn _iter44 : struct.columns) + for (TColumn _iter89 : struct.columns) { - _iter44.write(oprot); + _iter89.write(oprot); } } } @@ -1123,12 +1265,22 @@ if (struct.isSetBatchSize()) { oprot.writeI32(struct.batchSize); } + if (struct.isSetAttributes()) { + { + oprot.writeI32(struct.attributes.size()); + for (Map.Entry _iter90 : struct.attributes.entrySet()) + { + oprot.writeBinary(_iter90.getKey()); + oprot.writeBinary(_iter90.getValue()); + } + } + } } @Override public void read(org.apache.thrift.protocol.TProtocol prot, TScan struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(8); + BitSet incoming = iprot.readBitSet(9); if (incoming.get(0)) { struct.startRow = iprot.readBinary(); struct.setStartRowIsSet(true); @@ -1139,14 +1291,14 @@ } if (incoming.get(2)) { { - org.apache.thrift.protocol.TList _list45 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); - struct.columns = new ArrayList(_list45.size); - for (int _i46 = 0; _i46 < _list45.size; ++_i46) + org.apache.thrift.protocol.TList _list91 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.columns = new ArrayList(_list91.size); + for (int _i92 = 0; _i92 < _list91.size; ++_i92) { - TColumn _elem47; // optional - _elem47 = new TColumn(); - _elem47.read(iprot); - struct.columns.add(_elem47); + TColumn _elem93; // required + _elem93 = new TColumn(); + _elem93.read(iprot); + struct.columns.add(_elem93); } } struct.setColumnsIsSet(true); @@ -1172,6 +1324,21 @@ struct.batchSize = iprot.readI32(); struct.setBatchSizeIsSet(true); } + if (incoming.get(8)) { + { + org.apache.thrift.protocol.TMap _map94 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32()); + struct.attributes = new HashMap(2*_map94.size); + for (int _i95 = 0; _i95 < _map94.size; ++_i95) + { + ByteBuffer _key96; // required + ByteBuffer _val97; // required + _key96 = iprot.readBinary(); + _val97 = iprot.readBinary(); + struct.attributes.put(_key96, _val97); + } + } + struct.setAttributesIsSet(true); + } } } Index: hbase-server/src/main/java/org/apache/hadoop/hbase/thrift2/generated/TPut.java =================================================================== --- hbase-server/src/main/java/org/apache/hadoop/hbase/thrift2/generated/TPut.java (revision 1502190) +++ hbase-server/src/main/java/org/apache/hadoop/hbase/thrift2/generated/TPut.java (working copy) @@ -48,6 +48,7 @@ private static final org.apache.thrift.protocol.TField COLUMN_VALUES_FIELD_DESC = new org.apache.thrift.protocol.TField("columnValues", org.apache.thrift.protocol.TType.LIST, (short)2); private static final org.apache.thrift.protocol.TField TIMESTAMP_FIELD_DESC = new org.apache.thrift.protocol.TField("timestamp", org.apache.thrift.protocol.TType.I64, (short)3); private static final org.apache.thrift.protocol.TField WRITE_TO_WAL_FIELD_DESC = new org.apache.thrift.protocol.TField("writeToWal", org.apache.thrift.protocol.TType.BOOL, (short)4); + private static final org.apache.thrift.protocol.TField ATTRIBUTES_FIELD_DESC = new org.apache.thrift.protocol.TField("attributes", org.apache.thrift.protocol.TType.MAP, (short)5); private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); static { @@ -59,13 +60,15 @@ public List columnValues; // required public long timestamp; // optional public boolean writeToWal; // optional + public Map attributes; // optional /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements org.apache.thrift.TFieldIdEnum { ROW((short)1, "row"), COLUMN_VALUES((short)2, "columnValues"), TIMESTAMP((short)3, "timestamp"), - WRITE_TO_WAL((short)4, "writeToWal"); + WRITE_TO_WAL((short)4, "writeToWal"), + ATTRIBUTES((short)5, "attributes"); private static final Map byName = new HashMap(); @@ -88,6 +91,8 @@ return TIMESTAMP; case 4: // WRITE_TO_WAL return WRITE_TO_WAL; + case 5: // ATTRIBUTES + return ATTRIBUTES; default: return null; } @@ -131,7 +136,7 @@ private static final int __TIMESTAMP_ISSET_ID = 0; private static final int __WRITETOWAL_ISSET_ID = 1; private byte __isset_bitfield = 0; - private _Fields optionals[] = {_Fields.TIMESTAMP,_Fields.WRITE_TO_WAL}; + private _Fields optionals[] = {_Fields.TIMESTAMP,_Fields.WRITE_TO_WAL,_Fields.ATTRIBUTES}; 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); @@ -144,6 +149,10 @@ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))); tmpMap.put(_Fields.WRITE_TO_WAL, new org.apache.thrift.meta_data.FieldMetaData("writeToWal", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL))); + tmpMap.put(_Fields.ATTRIBUTES, new org.apache.thrift.meta_data.FieldMetaData("attributes", org.apache.thrift.TFieldRequirementType.OPTIONAL, + new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true), + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true)))); metaDataMap = Collections.unmodifiableMap(tmpMap); org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TPut.class, metaDataMap); } @@ -180,6 +189,23 @@ } this.timestamp = other.timestamp; this.writeToWal = other.writeToWal; + if (other.isSetAttributes()) { + Map __this__attributes = new HashMap(); + for (Map.Entry other_element : other.attributes.entrySet()) { + + ByteBuffer other_element_key = other_element.getKey(); + ByteBuffer other_element_value = other_element.getValue(); + + ByteBuffer __this__attributes_copy_key = org.apache.thrift.TBaseHelper.copyBinary(other_element_key); +; + + ByteBuffer __this__attributes_copy_value = org.apache.thrift.TBaseHelper.copyBinary(other_element_value); +; + + __this__attributes.put(__this__attributes_copy_key, __this__attributes_copy_value); + } + this.attributes = __this__attributes; + } } public TPut deepCopy() { @@ -194,6 +220,7 @@ this.timestamp = 0; this.writeToWal = true; + this.attributes = null; } public byte[] getRow() { @@ -315,6 +342,41 @@ __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __WRITETOWAL_ISSET_ID, value); } + public int getAttributesSize() { + return (this.attributes == null) ? 0 : this.attributes.size(); + } + + public void putToAttributes(ByteBuffer key, ByteBuffer val) { + if (this.attributes == null) { + this.attributes = new HashMap(); + } + this.attributes.put(key, val); + } + + public Map getAttributes() { + return this.attributes; + } + + public TPut setAttributes(Map attributes) { + this.attributes = attributes; + return this; + } + + public void unsetAttributes() { + this.attributes = null; + } + + /** Returns true if field attributes is set (has been assigned a value) and false otherwise */ + public boolean isSetAttributes() { + return this.attributes != null; + } + + public void setAttributesIsSet(boolean value) { + if (!value) { + this.attributes = null; + } + } + public void setFieldValue(_Fields field, Object value) { switch (field) { case ROW: @@ -349,6 +411,14 @@ } break; + case ATTRIBUTES: + if (value == null) { + unsetAttributes(); + } else { + setAttributes((Map)value); + } + break; + } } @@ -366,6 +436,9 @@ case WRITE_TO_WAL: return Boolean.valueOf(isWriteToWal()); + case ATTRIBUTES: + return getAttributes(); + } throw new IllegalStateException(); } @@ -385,6 +458,8 @@ return isSetTimestamp(); case WRITE_TO_WAL: return isSetWriteToWal(); + case ATTRIBUTES: + return isSetAttributes(); } throw new IllegalStateException(); } @@ -438,6 +513,15 @@ return false; } + boolean this_present_attributes = true && this.isSetAttributes(); + boolean that_present_attributes = true && that.isSetAttributes(); + if (this_present_attributes || that_present_attributes) { + if (!(this_present_attributes && that_present_attributes)) + return false; + if (!this.attributes.equals(that.attributes)) + return false; + } + return true; } @@ -494,6 +578,16 @@ return lastComparison; } } + lastComparison = Boolean.valueOf(isSetAttributes()).compareTo(typedOther.isSetAttributes()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAttributes()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.attributes, typedOther.attributes); + if (lastComparison != 0) { + return lastComparison; + } + } return 0; } @@ -541,6 +635,16 @@ sb.append(this.writeToWal); first = false; } + if (isSetAttributes()) { + if (!first) sb.append(", "); + sb.append("attributes:"); + if (this.attributes == null) { + sb.append("null"); + } else { + sb.append(this.attributes); + } + first = false; + } sb.append(")"); return sb.toString(); } @@ -603,14 +707,14 @@ case 2: // COLUMN_VALUES if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list16 = iprot.readListBegin(); - struct.columnValues = new ArrayList(_list16.size); - for (int _i17 = 0; _i17 < _list16.size; ++_i17) - { - TColumnValue _elem18; // required - _elem18 = new TColumnValue(); - _elem18.read(iprot); - struct.columnValues.add(_elem18); + org.apache.thrift.protocol.TList _list26 = iprot.readListBegin(); + struct.columnValues = new ArrayList(_list26.size); + for (int _i27 = 0; _i27 < _list26.size; ++_i27) + { + TColumnValue _elem28; // required + _elem28 = new TColumnValue(); + _elem28.read(iprot); + struct.columnValues.add(_elem28); } iprot.readListEnd(); } @@ -635,6 +739,26 @@ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; + case 5: // ATTRIBUTES + if (schemeField.type == org.apache.thrift.protocol.TType.MAP) { + { + org.apache.thrift.protocol.TMap _map29 = iprot.readMapBegin(); + struct.attributes = new HashMap(2*_map29.size); + for (int _i30 = 0; _i30 < _map29.size; ++_i30) + { + ByteBuffer _key31; // required + ByteBuffer _val32; // required + _key31 = iprot.readBinary(); + _val32 = iprot.readBinary(); + struct.attributes.put(_key31, _val32); + } + iprot.readMapEnd(); + } + struct.setAttributesIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; default: org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } @@ -659,9 +783,9 @@ oprot.writeFieldBegin(COLUMN_VALUES_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.columnValues.size())); - for (TColumnValue _iter19 : struct.columnValues) + for (TColumnValue _iter33 : struct.columnValues) { - _iter19.write(oprot); + _iter33.write(oprot); } oprot.writeListEnd(); } @@ -677,6 +801,21 @@ oprot.writeBool(struct.writeToWal); oprot.writeFieldEnd(); } + if (struct.attributes != null) { + if (struct.isSetAttributes()) { + oprot.writeFieldBegin(ATTRIBUTES_FIELD_DESC); + { + oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, struct.attributes.size())); + for (Map.Entry _iter34 : struct.attributes.entrySet()) + { + oprot.writeBinary(_iter34.getKey()); + oprot.writeBinary(_iter34.getValue()); + } + oprot.writeMapEnd(); + } + oprot.writeFieldEnd(); + } + } oprot.writeFieldStop(); oprot.writeStructEnd(); } @@ -697,9 +836,9 @@ oprot.writeBinary(struct.row); { oprot.writeI32(struct.columnValues.size()); - for (TColumnValue _iter20 : struct.columnValues) + for (TColumnValue _iter35 : struct.columnValues) { - _iter20.write(oprot); + _iter35.write(oprot); } } BitSet optionals = new BitSet(); @@ -709,13 +848,26 @@ if (struct.isSetWriteToWal()) { optionals.set(1); } - oprot.writeBitSet(optionals, 2); + if (struct.isSetAttributes()) { + optionals.set(2); + } + oprot.writeBitSet(optionals, 3); if (struct.isSetTimestamp()) { oprot.writeI64(struct.timestamp); } if (struct.isSetWriteToWal()) { oprot.writeBool(struct.writeToWal); } + if (struct.isSetAttributes()) { + { + oprot.writeI32(struct.attributes.size()); + for (Map.Entry _iter36 : struct.attributes.entrySet()) + { + oprot.writeBinary(_iter36.getKey()); + oprot.writeBinary(_iter36.getValue()); + } + } + } } @Override @@ -724,18 +876,18 @@ struct.row = iprot.readBinary(); struct.setRowIsSet(true); { - org.apache.thrift.protocol.TList _list21 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); - struct.columnValues = new ArrayList(_list21.size); - for (int _i22 = 0; _i22 < _list21.size; ++_i22) - { - TColumnValue _elem23; // required - _elem23 = new TColumnValue(); - _elem23.read(iprot); - struct.columnValues.add(_elem23); + org.apache.thrift.protocol.TList _list37 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.columnValues = new ArrayList(_list37.size); + for (int _i38 = 0; _i38 < _list37.size; ++_i38) + { + TColumnValue _elem39; // required + _elem39 = new TColumnValue(); + _elem39.read(iprot); + struct.columnValues.add(_elem39); } } struct.setColumnValuesIsSet(true); - BitSet incoming = iprot.readBitSet(2); + BitSet incoming = iprot.readBitSet(3); if (incoming.get(0)) { struct.timestamp = iprot.readI64(); struct.setTimestampIsSet(true); @@ -744,6 +896,21 @@ struct.writeToWal = iprot.readBool(); struct.setWriteToWalIsSet(true); } + if (incoming.get(2)) { + { + org.apache.thrift.protocol.TMap _map40 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32()); + struct.attributes = new HashMap(2*_map40.size); + for (int _i41 = 0; _i41 < _map40.size; ++_i41) + { + ByteBuffer _key42; // required + ByteBuffer _val43; // required + _key42 = iprot.readBinary(); + _val43 = iprot.readBinary(); + struct.attributes.put(_key42, _val43); + } + } + struct.setAttributesIsSet(true); + } } } Index: hbase-server/src/main/resources/org/apache/hadoop/hbase/thrift2/hbase.thrift =================================================================== --- hbase-server/src/main/resources/org/apache/hadoop/hbase/thrift2/hbase.thrift (revision 1502190) +++ hbase-server/src/main/resources/org/apache/hadoop/hbase/thrift2/hbase.thrift (working copy) @@ -98,7 +98,8 @@ 4: optional TTimeRange timeRange, 5: optional i32 maxVersions, - 6: optional binary filterString + 6: optional binary filterString, + 7: optional map attributes } /** @@ -116,7 +117,8 @@ 1: required binary row, 2: required list columnValues 3: optional i64 timestamp, - 4: optional bool writeToWal = 1 + 4: optional bool writeToWal = 1, + 5: optional map attributes } /** @@ -147,7 +149,8 @@ 2: optional list columns, 3: optional i64 timestamp, 4: optional TDeleteType deleteType = 1, - 5: optional bool writeToWal = 1 + 5: optional bool writeToWal = 1, + 6: optional map attributes } /** @@ -159,7 +162,8 @@ struct TIncrement { 1: required binary row, 2: required list columns, - 3: optional bool writeToWal = 1 + 3: optional bool writeToWal = 1, + 4: optional map attributes } /** @@ -174,7 +178,8 @@ 5: optional i32 maxVersions=1, 6: optional TTimeRange timeRange, 7: optional binary filterString, - 8: optional i32 batchSize + 8: optional i32 batchSize, + 9: optional map attributes } //