HBASE-889 The current Thrift API does not allow a new scanner to be created without supplying a column list unlike the other APIs.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@771545 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
31cd01f656
commit
08de99e307
|
@ -193,6 +193,9 @@ Release 0.20.0 - Unreleased
|
||||||
(Evgeny Ryabitskiy via Stack)
|
(Evgeny Ryabitskiy via Stack)
|
||||||
HBASE-1112 we will lose data if the table name happens to be the logs' dir
|
HBASE-1112 we will lose data if the table name happens to be the logs' dir
|
||||||
name (Samuel Guo via Stack)
|
name (Samuel Guo via Stack)
|
||||||
|
HBASE-889 The current Thrift API does not allow a new scanner to be
|
||||||
|
created without supplying a column list unlike the other APIs.
|
||||||
|
(Tim Sell via Stack)
|
||||||
|
|
||||||
Release 0.19.0 - 01/21/2009
|
Release 0.19.0 - 01/21/2009
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
|
|
@ -80,6 +80,22 @@ public class ThriftServer {
|
||||||
protected int nextScannerId = 0;
|
protected int nextScannerId = 0;
|
||||||
protected HashMap<Integer, Scanner> scannerMap = null;
|
protected HashMap<Integer, Scanner> scannerMap = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a list of all the column families for a given htable.
|
||||||
|
*
|
||||||
|
* @param table
|
||||||
|
* @return
|
||||||
|
* @throws IOException
|
||||||
|
*/
|
||||||
|
byte[][] getAllColumns(HTable table) throws IOException {
|
||||||
|
HColumnDescriptor[] cds = table.getTableDescriptor().getColumnFamilies();
|
||||||
|
byte[][] columns = new byte[cds.length][];
|
||||||
|
for (int i = 0; i < cds.length; i++) {
|
||||||
|
columns[i] = cds[i].getNameWithColon();
|
||||||
|
}
|
||||||
|
return columns;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates and returns an HTable instance from a given table name.
|
* Creates and returns an HTable instance from a given table name.
|
||||||
*
|
*
|
||||||
|
@ -468,9 +484,13 @@ public class ThriftServer {
|
||||||
List<byte[]> columns) throws IOError {
|
List<byte[]> columns) throws IOError {
|
||||||
try {
|
try {
|
||||||
HTable table = getTable(tableName);
|
HTable table = getTable(tableName);
|
||||||
Scanner scanner = table.getScanner(columns.toArray(new byte[0][]),
|
byte[][] columnsArray = null;
|
||||||
startRow);
|
if ((columns == null) || (columns.size() == 0)) {
|
||||||
return addScanner(scanner);
|
columnsArray = getAllColumns(table);
|
||||||
|
} else {
|
||||||
|
columnsArray = columns.toArray(new byte[0][]);
|
||||||
|
}
|
||||||
|
return addScanner(table.getScanner(columnsArray, startRow));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new IOError(e.getMessage());
|
throw new IOError(e.getMessage());
|
||||||
}
|
}
|
||||||
|
@ -480,9 +500,13 @@ public class ThriftServer {
|
||||||
byte[] stopRow, List<byte[]> columns) throws IOError, TException {
|
byte[] stopRow, List<byte[]> columns) throws IOError, TException {
|
||||||
try {
|
try {
|
||||||
HTable table = getTable(tableName);
|
HTable table = getTable(tableName);
|
||||||
Scanner scanner = table.getScanner(columns.toArray(new byte[0][]),
|
byte[][] columnsArray = null;
|
||||||
startRow, stopRow);
|
if ((columns == null) || (columns.size() == 0)) {
|
||||||
return addScanner(scanner);
|
columnsArray = getAllColumns(table);
|
||||||
|
} else {
|
||||||
|
columnsArray = columns.toArray(new byte[0][]);
|
||||||
|
}
|
||||||
|
return addScanner(table.getScanner(columnsArray, startRow, stopRow));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new IOError(e.getMessage());
|
throw new IOError(e.getMessage());
|
||||||
}
|
}
|
||||||
|
@ -492,9 +516,13 @@ public class ThriftServer {
|
||||||
List<byte[]> columns, long timestamp) throws IOError, TException {
|
List<byte[]> columns, long timestamp) throws IOError, TException {
|
||||||
try {
|
try {
|
||||||
HTable table = getTable(tableName);
|
HTable table = getTable(tableName);
|
||||||
Scanner scanner = table.getScanner(columns.toArray(new byte[0][]),
|
byte[][] columnsArray = null;
|
||||||
startRow, timestamp);
|
if ((columns == null) || (columns.size() == 0)) {
|
||||||
return addScanner(scanner);
|
columnsArray = getAllColumns(table);
|
||||||
|
} else {
|
||||||
|
columnsArray = columns.toArray(new byte[0][]);
|
||||||
|
}
|
||||||
|
return addScanner(table.getScanner(columnsArray, startRow, timestamp));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new IOError(e.getMessage());
|
throw new IOError(e.getMessage());
|
||||||
}
|
}
|
||||||
|
@ -505,9 +533,14 @@ public class ThriftServer {
|
||||||
throws IOError, TException {
|
throws IOError, TException {
|
||||||
try {
|
try {
|
||||||
HTable table = getTable(tableName);
|
HTable table = getTable(tableName);
|
||||||
Scanner scanner = table.getScanner(columns.toArray(new byte[0][]),
|
byte[][] columnsArray = null;
|
||||||
startRow, stopRow, timestamp);
|
if ((columns == null) || (columns.size() == 0)) {
|
||||||
return addScanner(scanner);
|
columnsArray = getAllColumns(table);
|
||||||
|
} else {
|
||||||
|
columnsArray = columns.toArray(new byte[0][]);
|
||||||
|
}
|
||||||
|
return addScanner(table.getScanner(columnsArray, startRow, stopRow,
|
||||||
|
timestamp));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new IOError(e.getMessage());
|
throw new IOError(e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue