查询
1.按RowKey查询
2.按手机号码查询
3.按手机号码的区域查询

 1 //查询手机13450456688的所有上网记录
 2     public static void scan(String tableName) throws IOException{
 3         HTable table = new HTable(getConfiguration(), tableName);
 4         Scan scan = new Scan();
 5         scan.setStartRow(Bytes.toBytes("13450456688:/"));
 6         scan.setStopRow(Bytes.toBytes("13450456688::"));
 7         ResultScanner scanner = table.getScanner(scan);
 8         int i=0;
 9         for (Result result : scanner) {
10             System.out.println("Scan: "+i+++" "+result);
11         }
12     }
 1 //查询134号段的所有上网记录
 2 public static void scanPeriod(String tableName) throws IOException{
 3         HTable table = new HTable(getConfiguration(), tableName);
 4         Scan scan = new Scan();
 5         scan.setStartRow(Bytes.toBytes("134/"));
 6         scan.setStopRow( Bytes.toBytes("134:"));
 7         scan.setMaxVersions(1);
 8         ResultScanner scanner = table.getScanner(scan);
 9         int i=0;
10         for (Result result : scanner) {
11             System.out.println("Scan: "+i+++" "+result);
12         }
13     }

 

相关文章:

  • 2022-03-08
  • 2021-08-30
  • 2022-02-18
  • 2021-06-23
  • 2021-06-13
  • 2021-06-20
  • 2021-12-01
  • 2021-12-06
猜你喜欢
  • 2021-08-29
  • 2022-02-25
  • 2021-09-24
  • 2021-10-25
  • 2021-11-26
  • 2022-01-28
  • 2022-02-20
相关资源
相似解决方案