public TAppend deepCopy() { return new TAppend(this); }
@Override public boolean equals(java.lang.Object that) { if (that == null) return false; if (that instanceof TAppend) return this.equals((TAppend)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 COLUMNS: return getColumns(); case VALUES: return getValues(); } 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 + ((isSetColumns()) ? 131071 : 524287); if (isSetColumns()) hashCode = hashCode * 8191 + columns.hashCode(); hashCode = hashCode * 8191 + ((isSetValues()) ? 131071 : 524287); if (isSetValues()) hashCode = hashCode * 8191 + values.hashCode(); return hashCode; }
/** * From a {@link TAppend} create an {@link Append}. * @param tappend the Thrift version of an append. * @return an increment that the {@link TAppend} represented. */ public static Append appendFromThrift(TAppend tappend) { Append append = new Append(tappend.getRow()); List<ByteBuffer> columns = tappend.getColumns(); List<ByteBuffer> values = tappend.getValues(); if (columns.size() != values.size()) { throw new IllegalArgumentException( "Sizes of columns and values in tappend object are not matching"); } int length = columns.size(); for (int i = 0; i < length; i++) { byte[][] famAndQf = CellUtil.parseColumn(getBytes(columns.get(i))); append.addColumn(famAndQf[0], famAndQf[1], getBytes(values.get(i))); } return append; } }
@Override public List<TCell> append(TAppend tappend) throws IOError, TException { if (tappend.getRow().length == 0 || tappend.getTable().length == 0) { throw new TException("Must supply a table and a row key; can't append"); } Table table = null; try { table = getTable(tappend.getTable()); Append append = ThriftUtilities.appendFromThrift(tappend); Result result = table.append(append); return ThriftUtilities.cellFromHBase(result.rawCells()); } catch (IOException e) { LOG.warn(e.getMessage(), e); throw getIOError(e); } finally{ closeTable(table); } }
/** 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 COLUMNS: return isSetColumns(); case VALUES: return isSetValues(); } throw new java.lang.IllegalStateException(); }
/** * From a {@link TAppend} create an {@link Append}. * @param tappend the Thrift version of an append. * @return an increment that the {@link TAppend} represented. */ public static Append appendFromThrift(TAppend tappend) { Append append = new Append(tappend.getRow()); List<ByteBuffer> columns = tappend.getColumns(); List<ByteBuffer> values = tappend.getValues(); if (columns.size() != values.size()) { throw new IllegalArgumentException( "Sizes of columns and values in tappend object are not matching"); } int length = columns.size(); for (int i = 0; i < length; i++) { byte[][] famAndQf = CellUtil.parseColumn(getBytes(columns.get(i))); append.addColumn(famAndQf[0], famAndQf[1], getBytes(values.get(i))); } return append; } }
@Override public List<TCell> append(TAppend tappend) throws IOError, TException { if (tappend.getRow().length == 0 || tappend.getTable().length == 0) { throw new TException("Must supply a table and a row key; can't append"); } Table table = null; try { table = getTable(tappend.getTable()); Append append = ThriftUtilities.appendFromThrift(tappend); Result result = table.append(append); return ThriftUtilities.cellFromHBase(result.rawCells()); } catch (IOException e) { LOG.warn(e.getMessage(), e); throw getIOError(e); } finally{ closeTable(table); } }
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_columns = true && this.isSetColumns(); boolean that_present_columns = true && that.isSetColumns(); if (this_present_columns || that_present_columns) { if (!(this_present_columns && that_present_columns)) boolean this_present_values = true && this.isSetValues(); boolean that_present_values = true && that.isSetValues(); if (this_present_values || that_present_values) { if (!(this_present_values && that_present_values))
public Object getFieldValue(_Fields field) { switch (field) { case TABLE: return getTable(); case ROW: return getRow(); case COLUMNS: return getColumns(); case VALUES: return getValues(); } throw new IllegalStateException(); }
/** * From a {@link TAppend} create an {@link Append}. * @param tappend the Thrift version of an append. * @return an increment that the {@link TAppend} represented. */ public static Append appendFromThrift(TAppend tappend) { Append append = new Append(tappend.getRow()); List<ByteBuffer> columns = tappend.getColumns(); List<ByteBuffer> values = tappend.getValues(); if (columns.size() != values.size()) { throw new IllegalArgumentException( "Sizes of columns and values in tappend object are not matching"); } int length = columns.size(); for (int i = 0; i < length; i++) { byte[][] famAndQf = CellUtil.parseColumn(getBytes(columns.get(i))); append.addColumn(famAndQf[0], famAndQf[1], getBytes(values.get(i))); } return append; } }
/** * Appends the value to a cell and checks that the cell value is updated properly. */ public static void doTestAppend() throws Exception { ThriftHBaseServiceHandler handler = new ThriftHBaseServiceHandler(UTIL.getConfiguration(), UserProvider.instantiate(UTIL.getConfiguration())); handler.createTable(tableAname, getColumnDescriptors()); try { List<Mutation> mutations = new ArrayList<>(1); mutations.add(new Mutation(false, columnAname, valueAname, true)); handler.mutateRow(tableAname, rowAname, mutations, null); List<ByteBuffer> columnList = new ArrayList<>(1); columnList.add(columnAname); List<ByteBuffer> valueList = new ArrayList<>(1); valueList.add(valueBname); TAppend append = new TAppend(tableAname, rowAname, columnList, valueList); handler.append(append); TRowResult rowResult = handler.getRow(tableAname, rowAname, null).get(0); assertEquals(rowAname, rowResult.row); assertArrayEquals(Bytes.add(valueAname.array(), valueBname.array()), rowResult.columns.get(columnAname).value.array()); } finally { handler.disableTable(tableAname); handler.deleteTable(tableAname); } }
@Override public List<TCell> append(TAppend tappend) throws IOError, TException { if (tappend.getRow().length == 0 || tappend.getTable().length == 0) { throw new TException("Must supply a table and a row key; can't append"); } Table table = null; try { table = getTable(tappend.getTable()); Append append = ThriftUtilities.appendFromThrift(tappend); Result result = table.append(append); return ThriftUtilities.cellFromHBase(result.rawCells()); } 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 TAppend) return this.equals((TAppend)that); return false; }
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(isSetColumns()).compareTo(other.isSetColumns()); if (lastComparison != 0) { return lastComparison; if (isSetColumns()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.columns, other.columns); if (lastComparison != 0) { lastComparison = java.lang.Boolean.valueOf(isSetValues()).compareTo(other.isSetValues()); if (lastComparison != 0) { return lastComparison; if (isSetValues()) {
public Object getFieldValue(_Fields field) { switch (field) { case TABLE: return getTable(); case ROW: return getRow(); case COLUMNS: return getColumns(); case VALUES: return getValues(); } throw new IllegalStateException(); }
public TAppend deepCopy() { return new TAppend(this); }
@Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof TAppend) return this.equals((TAppend)that); return false; }
/** * Performs a deep copy on <i>other</i>. */ public TAppend(TAppend other) { 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.isSetColumns()) { java.util.List<java.nio.ByteBuffer> __this__columns = new java.util.ArrayList<java.nio.ByteBuffer>(other.columns.size()); for (java.nio.ByteBuffer other_element : other.columns) { __this__columns.add(org.apache.thrift.TBaseHelper.copyBinary(other_element)); } this.columns = __this__columns; } if (other.isSetValues()) { java.util.List<java.nio.ByteBuffer> __this__values = new java.util.ArrayList<java.nio.ByteBuffer>(other.values.size()); for (java.nio.ByteBuffer other_element : other.values) { __this__values.add(org.apache.thrift.TBaseHelper.copyBinary(other_element)); } this.values = __this__values; } }