hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apurt...@apache.org
Subject svn commit: r814087 - in /hadoop/hbase/trunk/src/contrib/stargate/src: java/org/apache/hadoop/hbase/stargate/ java/org/apache/hadoop/hbase/stargate/model/ test/org/apache/hadoop/hbase/stargate/model/
Date Fri, 11 Sep 2009 23:55:54 GMT
Author: apurtell
Date: Fri Sep 11 23:55:54 2009
New Revision: 814087

URL: http://svn.apache.org/viewvc?rev=814087&view=rev
Log:
HBASE-1808 [stargate] fix how columns are specified for scanners

Modified:
    hadoop/hbase/trunk/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/RowResource.java
    hadoop/hbase/trunk/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/ScannerResultGenerator.java
    hadoop/hbase/trunk/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/model/ModelSchema.xsd
    hadoop/hbase/trunk/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/model/ScannerModel.java
    hadoop/hbase/trunk/src/contrib/stargate/src/test/org/apache/hadoop/hbase/stargate/model/TestScannerModel.java

Modified: hadoop/hbase/trunk/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/RowResource.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/RowResource.java?rev=814087&r1=814086&r2=814087&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/RowResource.java
(original)
+++ hadoop/hbase/trunk/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/RowResource.java
Fri Sep 11 23:55:54 2009
@@ -272,9 +272,17 @@
     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;

Modified: hadoop/hbase/trunk/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/ScannerResultGenerator.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/ScannerResultGenerator.java?rev=814087&r1=814086&r2=814087&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/ScannerResultGenerator.java
(original)
+++ hadoop/hbase/trunk/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/ScannerResultGenerator.java
Fri Sep 11 23:55:54 2009
@@ -56,7 +56,15 @@
         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()) {

Modified: hadoop/hbase/trunk/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/model/ModelSchema.xsd
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/model/ModelSchema.xsd?rev=814087&r1=814086&r2=814087&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/model/ModelSchema.xsd
(original)
+++ hadoop/hbase/trunk/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/model/ModelSchema.xsd
Fri Sep 11 23:55:54 2009
@@ -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>

Modified: hadoop/hbase/trunk/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/model/ScannerModel.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/model/ScannerModel.java?rev=814087&r1=814086&r2=814087&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/model/ScannerModel.java
(original)
+++ hadoop/hbase/trunk/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/model/ScannerModel.java
Fri Sep 11 23:55:54 2009
@@ -26,6 +26,7 @@
 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 @@
  * 
  * <pre>
  * &lt;complexType name="Scanner"&gt;
+ *   &lt;sequence>
+ *     &lt;element name="column" type="base64Binary" minOccurs="0" maxOccurs="unbounded"/&gt;
+ *   &lt;/sequence&gt;
  *   &lt;attribute name="startRow" type="base64Binary"&gt;&lt;/attribute&gt;
  *   &lt;attribute name="endRow" type="base64Binary"&gt;&lt;/attribute&gt;
- *   &lt;attribute name="columns" type="base64Binary"&gt;&lt;/attribute&gt;
  *   &lt;attribute name="batch" type="int"&gt;&lt;/attribute&gt;
  *   &lt;attribute name="startTime" type="int"&gt;&lt;/attribute&gt;
  *   &lt;attribute name="endTime" type="int"&gt;&lt;/attribute&gt;
@@ -145,9 +148,9 @@
   }
 
   /**
-   * @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;
   }
@@ -191,6 +194,13 @@
   }
 
   /**
+   * @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
    */
   public void setBatch(int batch) {

Modified: hadoop/hbase/trunk/src/contrib/stargate/src/test/org/apache/hadoop/hbase/stargate/model/TestScannerModel.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/contrib/stargate/src/test/org/apache/hadoop/hbase/stargate/model/TestScannerModel.java?rev=814087&r1=814086&r2=814087&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/contrib/stargate/src/test/org/apache/hadoop/hbase/stargate/model/TestScannerModel.java
(original)
+++ hadoop/hbase/trunk/src/contrib/stargate/src/test/org/apache/hadoop/hbase/stargate/model/TestScannerModel.java
Fri Sep 11 23:55:54 2009
@@ -46,8 +46,10 @@
       " 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" +



Mime
View raw message