HBASE-1808 [stargate] fix how columns are specified for scanners
git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@814087 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
69bd17fe1b
commit
6383b93ea7
@ -272,9 +272,17 @@ public class RowResource implements Constants {
|
||||
for (byte[] column: rowspec.getColumns()) {
|
||||
byte[][] split = KeyValue.parseColumn(column);
|
||||
if (rowspec.hasTimestamp()) {
|
||||
delete.deleteColumns(split[0], split[1], rowspec.getTimestamp());
|
||||
if (split[1] != null) {
|
||||
delete.deleteColumns(split[0], split[1], rowspec.getTimestamp());
|
||||
} else {
|
||||
delete.deleteFamily(split[0], rowspec.getTimestamp());
|
||||
}
|
||||
} else {
|
||||
delete.deleteColumns(split[0], split[1]);
|
||||
if (split[1] != null) {
|
||||
delete.deleteColumns(split[0], split[1]);
|
||||
} else {
|
||||
delete.deleteFamily(split[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
HTablePool pool;
|
||||
|
@ -56,7 +56,15 @@ public class ScannerResultGenerator extends ResultGenerator {
|
||||
scan = new Scan(rowspec.getStartRow());
|
||||
}
|
||||
if (rowspec.hasColumns()) {
|
||||
scan.addColumns(rowspec.getColumns());
|
||||
byte[][] columns = rowspec.getColumns();
|
||||
for (byte[] column: columns) {
|
||||
byte[][] split = KeyValue.parseColumn(column);
|
||||
if (split[1] != null) {
|
||||
scan.addColumn(split[0], split[1]);
|
||||
} else {
|
||||
scan.addFamily(split[0]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (HColumnDescriptor family:
|
||||
table.getTableDescriptor().getFamilies()) {
|
||||
|
@ -84,9 +84,11 @@
|
||||
<element name="Scanner" type="tns:Scanner"></element>
|
||||
|
||||
<complexType name="Scanner">
|
||||
<sequence>
|
||||
<element name="column" type="base64Binary" minOccurs="0" maxOccurs="unbounded"></element>
|
||||
</sequence>
|
||||
<attribute name="startRow" type="base64Binary"></attribute>
|
||||
<attribute name="endRow" type="base64Binary"></attribute>
|
||||
<attribute name="columns" type="base64Binary"></attribute>
|
||||
<attribute name="batch" type="int"></attribute>
|
||||
<attribute name="startTime" type="int"></attribute>
|
||||
<attribute name="endTime" type="int"></attribute>
|
||||
|
@ -26,6 +26,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import org.apache.hadoop.hbase.HConstants;
|
||||
@ -40,9 +41,11 @@ import com.google.protobuf.ByteString;
|
||||
*
|
||||
* <pre>
|
||||
* <complexType name="Scanner">
|
||||
* <sequence>
|
||||
* <element name="column" type="base64Binary" minOccurs="0" maxOccurs="unbounded"/>
|
||||
* </sequence>
|
||||
* <attribute name="startRow" type="base64Binary"></attribute>
|
||||
* <attribute name="endRow" type="base64Binary"></attribute>
|
||||
* <attribute name="columns" type="base64Binary"></attribute>
|
||||
* <attribute name="batch" type="int"></attribute>
|
||||
* <attribute name="startTime" type="int"></attribute>
|
||||
* <attribute name="endTime" type="int"></attribute>
|
||||
@ -145,9 +148,9 @@ public class ScannerModel implements ProtobufMessageHandler, Serializable {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list of columns of interest, or empty for all
|
||||
* @return list of columns of interest in column:qualifier format, or empty for all
|
||||
*/
|
||||
@XmlAttribute(name="column")
|
||||
@XmlElement(name="column")
|
||||
public List<byte[]> getColumns() {
|
||||
return columns;
|
||||
}
|
||||
@ -190,6 +193,13 @@ public class ScannerModel implements ProtobufMessageHandler, Serializable {
|
||||
this.endRow = endRow;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param columns list of columns of interest in column:qualifier format, or empty for all
|
||||
*/
|
||||
public void setColumns(List<byte[]> columns) {
|
||||
this.columns = columns;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param batch the number of cells to return in batch
|
||||
*/
|
||||
|
@ -46,8 +46,10 @@ public class TestScannerModel extends TestCase {
|
||||
" startRow=\"YWJyYWNhZGFicmE=\"" +
|
||||
" endTime=\"1245393318192\"" +
|
||||
" endRow=\"enp5eng=\"" +
|
||||
" column=\"Y29sdW1uMQ== Y29sdW1uMjpmb28=\"" +
|
||||
" batch=\"100\"/>";
|
||||
" batch=\"100\">" +
|
||||
"<column>Y29sdW1uMQ==</column>" +
|
||||
"<column>Y29sdW1uMjpmb28=</column>" +
|
||||
"</Scanner>";
|
||||
|
||||
private static final String AS_PB =
|
||||
"CgthYnJhY2FkYWJyYRIFenp5engaB2NvbHVtbjEaC2NvbHVtbjI6Zm9vIGQo47qL554kMLDi57mf" +
|
||||
|
Loading…
x
Reference in New Issue
Block a user