@@ -752,6 +752,13 @@ public void testFilter() throws Exception {
752
752
Assert .assertEquals (res_count , 1 );
753
753
scanner .close ();
754
754
755
+ Delete deleteKey3Family = new Delete (toBytes ("getKey3" ));
756
+ deleteKey3Family .deleteFamily (toBytes (family ));
757
+ Delete deleteKey4Family = new Delete (toBytes ("getKey4" ));
758
+ deleteKey4Family .deleteFamily (toBytes (family ));
759
+ hTable .delete (deleteKey3Family );
760
+ hTable .delete (deleteKey4Family );
761
+
755
762
Put putKey3Column3Value1 = new Put (toBytes ("getKey3" ));
756
763
putKey3Column3Value1 .add (toBytes (family ), toBytes (column1 ), toBytes (value1 ));
757
764
tryPut (hTable , putKey3Column3Value1 );
@@ -772,7 +779,7 @@ public void testFilter() throws Exception {
772
779
res_count += 1 ;
773
780
}
774
781
}
775
- Assert .assertEquals (res_count , 30 );
782
+ Assert .assertEquals (res_count , 12 );
776
783
scanner .close ();
777
784
778
785
scan = new Scan ();
@@ -808,7 +815,7 @@ public void testFilter() throws Exception {
808
815
res_count += 1 ;
809
816
}
810
817
}
811
- Assert .assertEquals (res_count , 30 );
818
+ Assert .assertEquals (res_count , 12 );
812
819
scanner .close ();
813
820
}
814
821
@@ -1117,58 +1124,6 @@ public void testFilter2() throws Exception {
1117
1124
scanner .close ();
1118
1125
}
1119
1126
1120
- @ Test
1121
- public void debugtest () throws Exception {
1122
- String key1 = "getKey1" ;
1123
- String key2 = "getKey2" ;
1124
- String column1 = "abc" ;
1125
- String column2 = "def" ;
1126
- String value1 = "value1" ;
1127
- String value2 = "value2" ;
1128
- String value3 = "value3" ;
1129
- String family = "family1" ;
1130
- long ts ;
1131
- Delete deleteKey1Family = new Delete (toBytes (key1 ));
1132
- deleteKey1Family .deleteFamily (toBytes (family ));
1133
-
1134
- Delete deleteKey2Family = new Delete (toBytes (key2 ));
1135
- deleteKey2Family .deleteFamily (toBytes (family ));
1136
-
1137
- hTable .delete (deleteKey1Family );
1138
- hTable .delete (deleteKey2Family );
1139
-
1140
- Put putKey1Column1Value1 = new Put (toBytes (key1 ));
1141
- putKey1Column1Value1 .add (toBytes (family ), toBytes (column1 ), toBytes (value1 ));
1142
- tryPut (hTable , putKey1Column1Value1 );
1143
-
1144
- Scan scan = new Scan ();
1145
- scan .addFamily (family .getBytes ());
1146
- scan .setStartRow ("getKey1" .getBytes ());
1147
- scan .setStopRow ("getKey3" .getBytes ());
1148
- scan .setMaxVersions (10 );
1149
- KeyOnlyFilter kFilter = new KeyOnlyFilter (true );
1150
- scan .setFilter (kFilter );
1151
- ResultScanner scanner = hTable .getScanner (scan );
1152
-
1153
- int res_count = 0 ;
1154
- for (Result result : scanner ) {
1155
- for (Cell cell : result .rawCells ()) {
1156
- if (res_count < 8 ) {
1157
- Assert .assertArrayEquals (key1 .getBytes (), cell .getRow ());
1158
- } else {
1159
- Assert .assertArrayEquals (key2 .getBytes (), cell .getRow ());
1160
- }
1161
- int offset = cell .getValueOffset ();
1162
- System .out .println (Arrays .toString (CellUtil .cloneValue (cell )));
1163
- Assert .assertEquals (4 , cell .getValueLength ());
1164
- Assert .assertEquals (6 , Bytes .toInt (CellUtil .cloneValue (cell )));
1165
- res_count += 1 ;
1166
- }
1167
- }
1168
- Assert .assertEquals (res_count , 2 );
1169
- scanner .close ();
1170
- }
1171
-
1172
1127
@ Test
1173
1128
public void testGetFilter () throws Exception {
1174
1129
String key1 = "getKey1" ;
0 commit comments