public Object getFieldValue(_Fields field) { switch (field) { case NUM_BYTES: return Long.valueOf(get_num_bytes()); case NUM_RECORDS: return Long.valueOf(get_num_records()); } throw new IllegalStateException(); }
public PartitionMetadata deepCopy() { return new PartitionMetadata(this); }
@Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof PartitionMetadata) return this.equals((PartitionMetadata)that); return false; }
public PartitionMetadata( long num_bytes, long num_records) { this(); this.num_bytes = num_bytes; set_num_bytes_isSet(true); this.num_records = num_records; set_num_records_isSet(true); }
public void setFieldValue(_Fields field, Object value) { switch (field) { case NUM_BYTES: if (value == null) { unset_num_bytes(); } else { set_num_bytes((Long)value); } break; case NUM_RECORDS: if (value == null) { unset_num_records(); } else { set_num_records((Long)value); } break; } }
if (schemeField.type == org.apache.thrift.protocol.TType.I64) { struct.num_bytes = iprot.readI64(); struct.set_num_bytes_isSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); if (schemeField.type == org.apache.thrift.protocol.TType.I64) { struct.num_records = iprot.readI64(); struct.set_num_records_isSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); if (!struct.is_set_num_bytes()) { throw new org.apache.thrift.protocol.TProtocolException("Required field 'num_bytes' was not found in serialized data! Struct: " + toString()); if (!struct.is_set_num_records()) { throw new org.apache.thrift.protocol.TProtocolException("Required field 'num_records' was not found in serialized data! Struct: " + toString()); struct.validate();
/** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ public boolean isSet(_Fields field) { if (field == null) { throw new IllegalArgumentException(); } switch (field) { case NUM_BYTES: return is_set_num_bytes(); case NUM_RECORDS: return is_set_num_records(); } throw new IllegalStateException(); }
@Override public void read(org.apache.thrift.protocol.TProtocol prot, DomainVersionMetadata struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; { org.apache.thrift.protocol.TMap _map14 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.I32, org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); struct.partitions = new HashMap<Integer,PartitionMetadata>(2*_map14.size); for (int _i15 = 0; _i15 < _map14.size; ++_i15) { int _key16; // required PartitionMetadata _val17; // optional _key16 = iprot.readI32(); _val17 = new PartitionMetadata(); _val17.read(iprot); struct.partitions.put(_key16, _val17); } } struct.set_partitions_isSet(true); struct.defunct = iprot.readBool(); struct.set_defunct_isSet(true); struct.closed_at = iprot.readI64(); struct.set_closed_at_isSet(true); BitSet incoming = iprot.readBitSet(1); if (incoming.get(0)) { struct.properties = iprot.readBinary(); struct.set_properties_isSet(true); } } }
public static long getTotalNumBytes(DomainVersion domainVersion) throws IOException { long total = 0; for (PartitionMetadata pm : domainVersion.getPartitionsMetadata()) { total += pm.get_num_bytes(); } return total; }
public static long getTotalNumRecords(DomainVersion domainVersion) throws IOException { long total = 0; for (PartitionMetadata pm : domainVersion.getPartitionsMetadata()) { total += pm.get_num_records(); } return total; } }
public PartitionMetadata set_num_bytes(long num_bytes) { this.num_bytes = num_bytes; set_num_bytes_isSet(true); return this; }
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { try { // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor. __isset_bitfield = 0; read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); } catch (org.apache.thrift.TException te) { throw new java.io.IOException(te); } }
@Override public void clear() { set_num_bytes_isSet(false); this.num_bytes = 0; set_num_records_isSet(false); this.num_records = 0; }
public int compareTo(PartitionMetadata other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; PartitionMetadata typedOther = (PartitionMetadata)other; lastComparison = Boolean.valueOf(is_set_num_bytes()).compareTo(typedOther.is_set_num_bytes()); if (lastComparison != 0) { return lastComparison; } if (is_set_num_bytes()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.num_bytes, typedOther.num_bytes); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(is_set_num_records()).compareTo(typedOther.is_set_num_records()); if (lastComparison != 0) { return lastComparison; } if (is_set_num_records()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.num_records, typedOther.num_records); if (lastComparison != 0) { return lastComparison; } } return 0; }
_val11 = new PartitionMetadata(); _val11.read(iprot); struct.partitions.put(_key10, _val11);
@Test public void testPartitionMetadata() throws Exception { final DomainVersion dv = ZkDomainVersion.create(getZk(), getRoot(), 1, null, null); final DomainVersion dv2 = new ZkDomainVersion(getZk(), ZkPath.append(getRoot(), "v/1"), null); assertTrue(dv.getPartitionsMetadata().isEmpty()); assertTrue(dv2.getPartitionsMetadata().isEmpty()); dv.addPartitionProperties(1, 2, 3); WaitUntil.orDie(() -> { try { return dv.getPartitionsMetadata().size() == 1 && dv2.getPartitionsMetadata().size() == 1; } catch (IOException e) { throw new RuntimeException(e); } }); assertEquals(1, dv.getPartitionsMetadata().size()); assertEquals(1, dv2.getPartitionsMetadata().size()); PartitionMetadata metadata = dv.getPartitionsMetadata().iterator().next(); assertEquals(2, metadata.get_num_bytes()); assertEquals(3, metadata.get_num_records()); }
@Override public void read(org.apache.thrift.protocol.TProtocol prot, PartitionMetadata struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; struct.num_bytes = iprot.readI64(); struct.set_num_bytes_isSet(true); struct.num_records = iprot.readI64(); struct.set_num_records_isSet(true); } }
/** * Performs a deep copy on <i>other</i>. */ public DomainVersionMetadata(DomainVersionMetadata other) { __isset_bitfield = other.__isset_bitfield; if (other.is_set_properties()) { this.properties = org.apache.thrift.TBaseHelper.copyBinary(other.properties); ; } if (other.is_set_partitions()) { Map<Integer,PartitionMetadata> __this__partitions = new HashMap<Integer,PartitionMetadata>(); for (Map.Entry<Integer, PartitionMetadata> other_element : other.partitions.entrySet()) { Integer other_element_key = other_element.getKey(); PartitionMetadata other_element_value = other_element.getValue(); Integer __this__partitions_copy_key = other_element_key; PartitionMetadata __this__partitions_copy_value = new PartitionMetadata(other_element_value); __this__partitions.put(__this__partitions_copy_key, __this__partitions_copy_value); } this.partitions = __this__partitions; } this.defunct = other.defunct; this.closed_at = other.closed_at; }