Scan scan = new Scan(); ColumnPrefixFilter columnPrefixFilter = new
hbase(main):016:0> scan 't4' ROW COLUMN+CELL 1223434 column=info:age, timestamp=1498891615751, value=25 1223434 column=info:gender, timestamp=1498891615751, value=1 1223434 column=info:name, timestamp=1498892027083, value=lisi1234 1223434 column=info:password, timestamp=1498892027083, value=x00x12xD5. 1234 column=info:name, timestamp=1498892427671, value=lisi1234 1234 column=info:password, timestamp=1498892427671, value=x00x12xD5. 12341 column=info:name, timestamp=1498894169373, value=sudan 12341 column=info:password, timestamp=1498894169373, value=x00x00x00x17 12342 column=info:name, timestamp=1498894341082, value=hanmei 12342 column=info:password, timestamp=1498894341082, value=x00x00x04xD2 123422 column=info:name, timestamp=1498894389540, value=xE9x83xADxE5xBExB7xE7xBAxB2 123422 column=info:password, timestamp=1498894389540, value=x00x00x04xD2 12343 column=info:name, timestamp=1498894341091, value=sunwukong 12343 column=info:password, timestamp=1498894341091, value=x00x00x04xD2 123432 column=info:name, timestamp=1498894389549, value=xE6xB2x99xE6xB2xB3xE4xB8x8A 123432 column=info:password, timestamp=1498894389549, value=x00x00x04xD2 12344 column=info:name, timestamp=1498894341093, value=xE7x8CxAAxE5x85xABxE6x88x92 12344 column=info:password, timestamp=1498894341093, value=x00x00x04xD2 123442 column=info:name, timestamp=1498894389551, value=xE7x8CxAAxE5x85xABxE6x88x92 123442 column=info:password, timestamp=1498894389551, value=x00x00x04xD2 223422 column=info:name, timestamp=1498894677209, value=xE9x83xADxE5xBExB7xE7xBAxB2 223422 column=info:password, timestamp=1498894677209, value=x00x00x04xD2 223432 column=info:name, timestamp=1498894677222, value=xE6xB2x99xE6xB2xB3xE4xB8x8A 223432 column=info:password, timestamp=1498894677222, value=x00x00x04xD2 223442 column=info:name, timestamp=1498894677225, value=xE7x8CxAAxE5x85xABxE6x88x92 223442 column=info:password, timestamp=1498894677225, value=x00x00x04xD2 323422 column=info:name, timestamp=1498894726797, value=xE9x83xADxE5xBExB7xE7xBAxB2 323422 column=info:name_A, timestamp=1498896667538, value=xE9x83xADxE5xBExB7xE7xBAxB2 323422 column=info:name_B, timestamp=1498896689859, value=xE9x83xADxE5xBExB7xE7xBAxB2 323422 column=info:password, timestamp=1498894726797, value=x00x00x04xD2 323422 column=info:password_A, timestamp=1498896689859, value=x00x00x04xD2 323432 column=info:name, timestamp=1498894726809, value=xE6xB2x99xE6xB2xB3xE4xB8x8A 323432 column=info:name_A, timestamp=1498896667547, value=xE6xB2x99xE6xB2xB3xE4xB8x8A 323432 column=info:name_B, timestamp=1498896689870, value=xE6xB2x99xE6xB2xB3xE4xB8x8A 323432 column=info:password, timestamp=1498894726809, value=x00x00x04xD2 323432 column=info:password_A, timestamp=1498896667547, value=x00x00x04xD2 323432 column=info:password_B, timestamp=1498896689870, value=x00x00x04xD2 323442 column=info:name, timestamp=1498894726811, value=xE7x8CxAAxE5x85xABxE6x88x92 323442 column=info:name_A, timestamp=1498896667549, value=xE7x8CxAAxE5x85xABxE6x88x92 323442 column=info:name_B, timestamp=1498896689872, value=xE7x8CxAAxE5x85xABxE6x88x92 323442 column=info:password, timestamp=1498894726811, value=x00x00x04xD2 323442 column=info:password_A, timestamp=1498896667549, value=x00x00x04xD2 323442 column=info:password_B, timestamp=1498896689872, value=x00x00x04xD2 15 row(s) in 0.0790 seconds hbase(main):017:0>
(Bytes.toBytes("n")); //scan.addFamily(Bytes.toBytes("info")); scan.setFilter(columnPrefixFilter); ResultScanner scanner = table.getScanner(scan); printScanner(scanner);
private void printScanner(ResultScanner scanner ){ for(Result result : scanner){ System.out.print(Bytes.toString(result.getRow())+";");//rowkey System.out.print(Bytes.toString(result.getValue(Bytes.toBytes("info"), Bytes.toBytes("name")))+";"); System.out.print(Bytes.toInt(result.getValue(Bytes.toBytes("info"), Bytes.toBytes("password")))+";"); System.out.println(); } }
有很多条却只能查出来一条
1223434;lisi1234;