티스토리 뷰

공부

[HBase] scan

seunggabi 승가비 2021. 5. 25. 22:19
public class ScanTable{

   public static void main(String args[]) throws IOException{

      // Instantiating Configuration class
      Configuration config = HBaseConfiguration.create();

      // Instantiating HTable class
      HTable table = new HTable(config, "emp");

      // Instantiating the Scan class
      Scan scan = new Scan();

      // Scanning the required columns
      scan.addColumn(Bytes.toBytes("personal"), Bytes.toBytes("name"));
      scan.addColumn(Bytes.toBytes("personal"), Bytes.toBytes("city"));

      // Getting the scan result
      ResultScanner scanner = table.getScanner(scan);

      // Reading values from scan result
      for (Result result = scanner.next(); result != null; result = scanner.next())

      System.out.println("Found row : " + result);
      //closing the scanner
      scanner.close();
   }
}

https://www.tutorialspoint.com/hbase/hbase_scan.htm

 

HBase - Scan - Tutorialspoint

HBase - Scan Scaning using HBase Shell The scan command is used to view the data in HTable. Using the scan command, you can get the table data. Its syntax is as follows: scan ‘’ Example The following example shows how to read data from a table using th

www.tutorialspoint.com

 

'공부' 카테고리의 다른 글

[Sh] curl request & response (status code)  (0) 2021.05.25
[Spring] @RequestParam(value="value", required=true) List<String> values  (0) 2021.05.25
[HBase] scan  (0) 2021.05.25
[Sh] exit (0) == success; exist (1) == fail;  (0) 2021.05.25
JUnit In Action  (0) 2021.05.19
Facade Pattern  (0) 2021.05.19
댓글
댓글쓰기 폼