public TIncrement deepCopy() { return new TIncrement(this); }
@Override public boolean equals(java.lang.Object that) { if (that == null) return false; if (that instanceof TIncrement) return this.equals((TIncrement)that); return false; }
@org.apache.thrift.annotation.Nullable public java.lang.Object getFieldValue(_Fields field) { switch (field) { case TABLE: return getTable(); case ROW: return getRow(); case COLUMN: return getColumn(); case AMMOUNT: return getAmmount(); } throw new java.lang.IllegalStateException(); }
/** 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 java.lang.IllegalArgumentException(); } switch (field) { case TABLE: return isSetTable(); case ROW: return isSetRow(); case COLUMN: return isSetColumn(); case AMMOUNT: return isSetAmmount(); } throw new java.lang.IllegalStateException(); }
@Override public int hashCode() { int hashCode = 1; hashCode = hashCode * 8191 + ((isSetTable()) ? 131071 : 524287); if (isSetTable()) hashCode = hashCode * 8191 + table.hashCode(); hashCode = hashCode * 8191 + ((isSetRow()) ? 131071 : 524287); if (isSetRow()) hashCode = hashCode * 8191 + row.hashCode(); hashCode = hashCode * 8191 + ((isSetColumn()) ? 131071 : 524287); if (isSetColumn()) hashCode = hashCode * 8191 + column.hashCode(); hashCode = hashCode * 8191 + org.apache.thrift.TBaseHelper.hashCode(ammount); return hashCode; }
/** * From a {@link TIncrement} create an {@link Increment}. * @param tincrement the Thrift version of an increment * @return an increment that the {@link TIncrement} represented. */ public static Increment incrementFromThrift(TIncrement tincrement) { Increment inc = new Increment(tincrement.getRow()); byte[][] famAndQf = CellUtil.parseColumn(tincrement.getColumn()); if (famAndQf.length != 2) { return null; } inc.addColumn(famAndQf[0], famAndQf[1], tincrement.getAmmount()); return inc; }
@Override public void increment(TIncrement tincrement) throws IOError, TException { if (tincrement.getRow().length == 0 || tincrement.getTable().length == 0) { throw new TException("Must supply a table and a row key; can't increment"); } if (conf.getBoolean(COALESCE_INC_KEY, false)) { this.coalescer.queueIncrement(tincrement); return; } Table table = null; try { table = getTable(tincrement.getTable()); Increment inc = ThriftUtilities.incrementFromThrift(tincrement); table.increment(inc); } catch (IOException e) { LOG.warn(e.getMessage(), e); throw getIOError(e); } finally{ closeTable(table); } }
lastComparison = java.lang.Boolean.valueOf(isSetTable()).compareTo(other.isSetTable()); if (lastComparison != 0) { return lastComparison; if (isSetTable()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.table, other.table); if (lastComparison != 0) { lastComparison = java.lang.Boolean.valueOf(isSetRow()).compareTo(other.isSetRow()); if (lastComparison != 0) { return lastComparison; if (isSetRow()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.row, other.row); if (lastComparison != 0) { lastComparison = java.lang.Boolean.valueOf(isSetColumn()).compareTo(other.isSetColumn()); if (lastComparison != 0) { return lastComparison; if (isSetColumn()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.column, other.column); if (lastComparison != 0) { lastComparison = java.lang.Boolean.valueOf(isSetAmmount()).compareTo(other.isSetAmmount()); if (lastComparison != 0) { return lastComparison; if (isSetAmmount()) {
return true; boolean this_present_table = true && this.isSetTable(); boolean that_present_table = true && that.isSetTable(); if (this_present_table || that_present_table) { if (!(this_present_table && that_present_table)) boolean this_present_row = true && this.isSetRow(); boolean that_present_row = true && that.isSetRow(); if (this_present_row || that_present_row) { if (!(this_present_row && that_present_row)) boolean this_present_column = true && this.isSetColumn(); boolean that_present_column = true && that.isSetColumn(); if (this_present_column || that_present_column) { if (!(this_present_column && that_present_column))
/** * From a {@link TIncrement} create an {@link Increment}. * @param tincrement the Thrift version of an increment * @return an increment that the {@link TIncrement} represented. */ public static Increment incrementFromThrift(TIncrement tincrement) { Increment inc = new Increment(tincrement.getRow()); byte[][] famAndQf = CellUtil.parseColumn(tincrement.getColumn()); if (famAndQf.length != 2) return null; inc.addColumn(famAndQf[0], famAndQf[1], tincrement.getAmmount()); return inc; }
@Override public void increment(TIncrement tincrement) throws IOError, TException { if (tincrement.getRow().length == 0 || tincrement.getTable().length == 0) { throw new TException("Must supply a table and a row key; can't increment"); } if (conf.getBoolean(COALESCE_INC_KEY, false)) { this.coalescer.queueIncrement(tincrement); return; } try { HTable table = getTable(tincrement.getTable()); Increment inc = ThriftUtilities.incrementFromThrift(tincrement); table.increment(inc); } catch (IOException e) { LOG.warn(e.getMessage(), e); throw new IOError(e.getMessage()); } }
@Override public void write(org.apache.thrift.protocol.TProtocol prot, TIncrement struct) throws org.apache.thrift.TException { org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot; java.util.BitSet optionals = new java.util.BitSet(); if (struct.isSetTable()) { optionals.set(0); } if (struct.isSetRow()) { optionals.set(1); } if (struct.isSetColumn()) { optionals.set(2); } if (struct.isSetAmmount()) { optionals.set(3); } oprot.writeBitSet(optionals, 4); if (struct.isSetTable()) { oprot.writeBinary(struct.table); } if (struct.isSetRow()) { oprot.writeBinary(struct.row); } if (struct.isSetColumn()) { oprot.writeBinary(struct.column); } if (struct.isSetAmmount()) { oprot.writeI64(struct.ammount); } }
private boolean internalQueueTincrement(TIncrement inc) throws TException { byte[][] famAndQf = CellUtil.parseColumn(inc.getColumn()); if (famAndQf.length != 2) { return false; } return internalQueueIncrement(inc.getTable(), inc.getRow(), famAndQf[0], famAndQf[1], inc.getAmmount()); }
/** * Performs a deep copy on <i>other</i>. */ public TIncrement(TIncrement other) { __isset_bitfield = other.__isset_bitfield; if (other.isSetTable()) { this.table = org.apache.thrift.TBaseHelper.copyBinary(other.table); } if (other.isSetRow()) { this.row = org.apache.thrift.TBaseHelper.copyBinary(other.row); } if (other.isSetColumn()) { this.column = org.apache.thrift.TBaseHelper.copyBinary(other.column); } this.ammount = other.ammount; }
/** * From a {@link TIncrement} create an {@link Increment}. * @param tincrement the Thrift version of an increment * @return an increment that the {@link TIncrement} represented. */ public static Increment incrementFromThrift(TIncrement tincrement) { Increment inc = new Increment(tincrement.getRow()); byte[][] famAndQf = CellUtil.parseColumn(tincrement.getColumn()); if (famAndQf.length != 2) return null; inc.addColumn(famAndQf[0], famAndQf[1], tincrement.getAmmount()); return inc; }
public static void doTestIncrements(ThriftHBaseServiceHandler handler) throws Exception { List<Mutation> mutations = new ArrayList<>(1); mutations.add(new Mutation(false, columnAAname, valueEname, true)); mutations.add(new Mutation(false, columnAname, valueEname, true)); handler.mutateRow(tableAname, rowAname, mutations, null); handler.mutateRow(tableAname, rowBname, mutations, null); List<TIncrement> increments = new ArrayList<>(3); increments.add(new TIncrement(tableAname, rowBname, columnAAname, 7)); increments.add(new TIncrement(tableAname, rowBname, columnAAname, 7)); increments.add(new TIncrement(tableAname, rowBname, columnAAname, 7)); int numIncrements = 60000; for (int i = 0; i < numIncrements; i++) { handler.increment(new TIncrement(tableAname, rowAname, columnAname, 2)); handler.incrementRows(increments); } Thread.sleep(1000); long lv = handler.get(tableAname, rowAname, columnAname, null).get(0).value.getLong(); // Wait on all increments being flushed while (handler.coalescer.getQueueSize() != 0) { Threads.sleep(10); } assertEquals((100 + (2 * numIncrements)), lv); lv = handler.get(tableAname, rowBname, columnAAname, null).get(0).value.getLong(); assertEquals((100 + (3 * 7 * numIncrements)), lv); assertTrue(handler.coalescer.getSuccessfulCoalescings() > 0); }
@Override public void increment(TIncrement tincrement) throws IOError, TException { if (tincrement.getRow().length == 0 || tincrement.getTable().length == 0) { throw new TException("Must supply a table and a row key; can't increment"); } if (conf.getBoolean(COALESCE_INC_KEY, false)) { this.coalescer.queueIncrement(tincrement); return; } Table table = null; try { table = getTable(tincrement.getTable()); Increment inc = ThriftUtilities.incrementFromThrift(tincrement); table.increment(inc); } catch (IOException e) { LOG.warn(e.getMessage(), e); throw getIOError(e); } finally{ closeTable(table); } }
@Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof TIncrement) return this.equals((TIncrement)that); return false; }
/** 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 TABLE: return isSetTable(); case ROW: return isSetRow(); case COLUMN: return isSetColumn(); case AMMOUNT: return isSetAmmount(); } throw new IllegalStateException(); }
public Object getFieldValue(_Fields field) { switch (field) { case TABLE: return getTable(); case ROW: return getRow(); case COLUMN: return getColumn(); case AMMOUNT: return Long.valueOf(getAmmount()); } throw new IllegalStateException(); }