HBASE-882 The BatchUpdate class provides, put(col, cell) and delete(col) but no get() (Ryan Smith via Stack and Jim Kellerman)
git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@694352 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
8aaf774c9d
commit
62c4e4b5b4
|
@ -64,8 +64,6 @@ Release 0.18.0 - Unreleased
|
||||||
splits (Jonathan Gray via Stack)
|
splits (Jonathan Gray via Stack)
|
||||||
HBASE-877 HCM is unable to find table with multiple regions which contains
|
HBASE-877 HCM is unable to find table with multiple regions which contains
|
||||||
binary (Jonathan Gray via Stack)
|
binary (Jonathan Gray via Stack)
|
||||||
HBASE-822 The BatchUpdate class provides, put(col, cell) and delete(col)
|
|
||||||
but no get() (Ryan Smith via Stack)
|
|
||||||
|
|
||||||
IMPROVEMENTS
|
IMPROVEMENTS
|
||||||
HBASE-801 When a table haven't disable, shell could response in a "user
|
HBASE-801 When a table haven't disable, shell could response in a "user
|
||||||
|
@ -89,6 +87,8 @@ Release 0.18.0 - Unreleased
|
||||||
HBASE-871 Major compaction periodicity should be specifyable at the column
|
HBASE-871 Major compaction periodicity should be specifyable at the column
|
||||||
family level, not cluster wide (Jonathan Gray via Stack)
|
family level, not cluster wide (Jonathan Gray via Stack)
|
||||||
HBASE-465 Fix javadoc for all public declarations
|
HBASE-465 Fix javadoc for all public declarations
|
||||||
|
HBASE-882 The BatchUpdate class provides, put(col, cell) and delete(col)
|
||||||
|
but no get() (Ryan Smith via Stack and Jim Kellerman)
|
||||||
|
|
||||||
NEW FEATURES
|
NEW FEATURES
|
||||||
HBASE-787 Postgresql to HBase table replication example (Tim Sell via Stack)
|
HBASE-787 Postgresql to HBase table replication example (Tim Sell via Stack)
|
||||||
|
|
|
@ -143,6 +143,43 @@ public class BatchUpdate implements Writable, Iterable<BatchOperation> {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the current columns
|
||||||
|
*
|
||||||
|
* @return byte[][] an array of byte[] columns
|
||||||
|
*/
|
||||||
|
public synchronized byte[][] getColumns() {
|
||||||
|
byte[][] columns = new byte[operations.size()][];
|
||||||
|
for (int i = 0; i < operations.size(); i++) {
|
||||||
|
columns[i] = operations.get(i).getColumn();
|
||||||
|
}
|
||||||
|
return columns;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if the specified column is currently assigned a value
|
||||||
|
*
|
||||||
|
* @param column column to check for
|
||||||
|
* @return boolean true if the given column exists
|
||||||
|
*/
|
||||||
|
public synchronized boolean hasColumn(String column) {
|
||||||
|
return hasColumn(Bytes.toBytes(column));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if the specified column is currently assigned a value
|
||||||
|
*
|
||||||
|
* @param column column to check for
|
||||||
|
* @return boolean true if the given column exists
|
||||||
|
*/
|
||||||
|
public synchronized boolean hasColumn(byte[] column) {
|
||||||
|
byte[] getColumn = get(column);
|
||||||
|
if (getColumn == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change a value for the specified column
|
* Change a value for the specified column
|
||||||
*
|
*
|
||||||
|
|
|
@ -86,7 +86,12 @@ public class TestBatchUpdate extends HBaseClusterTestCase {
|
||||||
|
|
||||||
bu = new BatchUpdate("row2");
|
bu = new BatchUpdate("row2");
|
||||||
bu.put(CONTENTS, value);
|
bu.put(CONTENTS, value);
|
||||||
byte[] getValue = bu.get(CONTENTS);
|
byte[][] getColumns = bu.getColumns();
|
||||||
|
assertEquals(getColumns.length, 1);
|
||||||
|
assertTrue(Arrays.equals(getColumns[0], CONTENTS));
|
||||||
|
assertTrue(bu.hasColumn(CONTENTS));
|
||||||
|
assertFalse(bu.hasColumn(new byte[] {}));
|
||||||
|
byte[] getValue = bu.get(getColumns[0]);
|
||||||
assertTrue(Arrays.equals(getValue, value));
|
assertTrue(Arrays.equals(getValue, value));
|
||||||
table.commit(bu);
|
table.commit(bu);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue