util.HBaseHelper.fillTable()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(11.7k)|赞(0)|评价(0)|浏览(75)

本文整理了Java中util.HBaseHelper.fillTable()方法的一些代码示例,展示了HBaseHelper.fillTable()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HBaseHelper.fillTable()方法的具体详情如下:
包路径:util.HBaseHelper
类名称:HBaseHelper
方法名:fillTable

HBaseHelper.fillTable介绍

暂无

代码示例

代码示例来源:origin: larsgeorge/hbase-book

public void fillTable(TableName table, int startRow, int endRow, int numCols,
           String... colfams)
throws IOException {
 fillTable(table, startRow, endRow, numCols, -1, false, colfams);
}

代码示例来源:origin: larsgeorge/hbase-book

public void fillTable(TableName table, int startRow, int endRow, int numCols,
           boolean setTimestamp, String... colfams)
throws IOException {
 fillTable(table, startRow, endRow, numCols, -1, setTimestamp, colfams);
}

代码示例来源:origin: larsgeorge/hbase-book

public void fillTable(TableName table, int startRow, int endRow, int numCols,
           int pad, boolean setTimestamp, String... colfams)
throws IOException {
 fillTable(table, startRow, endRow, numCols, pad, setTimestamp, false,
  colfams);
}

代码示例来源:origin: larsgeorge/hbase-book

public void fillTable(String table, int startRow, int endRow, int numCols,
           boolean setTimestamp, String... colfams)
throws IOException {
 fillTable(TableName.valueOf(table), startRow, endRow, numCols, -1,
  setTimestamp, colfams);
}

代码示例来源:origin: larsgeorge/hbase-book

public void fillTable(String table, int startRow, int endRow, int numCols,
           String... colfams)
throws IOException {
 fillTable(TableName.valueOf(table), startRow,endRow, numCols, colfams);
}

代码示例来源:origin: larsgeorge/hbase-book

public void fillTable(String table, int startRow, int endRow, int numCols,
           int pad, boolean setTimestamp, boolean random,
           String... colfams)
throws IOException {
 fillTable(TableName.valueOf(table), startRow, endRow, numCols, pad,
  setTimestamp, random, colfams);
}

代码示例来源:origin: larsgeorge/hbase-book

public void fillTable(String table, int startRow, int endRow, int numCols,
           int pad, boolean setTimestamp, String... colfams)
throws IOException {
 fillTable(TableName.valueOf(table), startRow, endRow, numCols, pad,
  setTimestamp, false, colfams);
}

代码示例来源:origin: larsgeorge/hbase-book

@Override
 public Void run() throws Exception {
  Configuration conf = superuser.getConfiguration();
  HBaseHelper helper = HBaseHelper.getHelper(conf);
  helper.dropTable("testtable");
  helper.createTable("testtable", "colfam1");
  System.out.println("Superuser: Adding rows to table...");
  helper.fillTable("testtable", 1, 2, 2, "colfam1");
  helper.close();
  return null;
 }
});

代码示例来源:origin: larsgeorge/hbase-book

@Override
 public Void run() throws Exception {
  Configuration conf = superuser.getConfiguration();
  HBaseHelper helper = HBaseHelper.getHelper(conf);
  helper.dropTable("testtable");
  helper.createTable("testtable", "colfam1", "colfam2");
  System.out.println("Adding rows to table...");
  helper.fillTable("testtable", 1, 100, 100, "colfam1", "colfam2");
  helper.close();
  return null;
 }
});

代码示例来源:origin: larsgeorge/hbase-book

public static void main(String[] args) throws IOException {
  Configuration conf = HBaseConfiguration.create();

  HBaseHelper helper = HBaseHelper.getHelper(conf);
  helper.dropTable("testtable");
  helper.createTable("testtable", "colfam1");
  System.out.println("Adding rows to table...");
  helper.fillTable("testtable", 1, 100, 1, "colfam1");

  Connection connection = ConnectionFactory.createConnection(conf);
  Table table = connection.getTable(TableName.valueOf("testtable"));
  // vv InclusiveStopFilterExample
  Filter filter = new InclusiveStopFilter(Bytes.toBytes("row-5"));

  Scan scan = new Scan();
  scan.setStartRow(Bytes.toBytes("row-3"));
  scan.setFilter(filter);
  ResultScanner scanner = table.getScanner(scan);
  // ^^ InclusiveStopFilterExample
  System.out.println("Results of scan:");
  // vv InclusiveStopFilterExample
  for (Result result : scanner) {
   System.out.println(result);
  }
  scanner.close();
  // ^^ InclusiveStopFilterExample
 }
}

代码示例来源:origin: larsgeorge/hbase-book

public static void main(String[] args) throws IOException {
  Configuration conf = HBaseConfiguration.create();

  HBaseHelper helper = HBaseHelper.getHelper(conf);
  helper.dropTable("testtable");
  helper.createTable("testtable", "colfam1");
  System.out.println("Adding rows to table...");
  helper.fillTable("testtable", 1, 10, 30, 0, true, "colfam1");

  Connection connection = ConnectionFactory.createConnection(conf);
  Table table = connection.getTable(TableName.valueOf("testtable"));
  // vv RandomRowFilterExample
  Filter filter = new RandomRowFilter(0.5f);

  for (int loop = 1; loop <= 3; loop++) {
   Scan scan = new Scan();
   scan.setFilter(filter);
   ResultScanner scanner = table.getScanner(scan);
   // ^^ RandomRowFilterExample
   System.out.println("Results of scan for loop: " + loop);
   // vv RandomRowFilterExample
   for (Result result : scanner) {
    System.out.println(Bytes.toString(result.getRow()));
   }
   scanner.close();
  }
  // ^^ RandomRowFilterExample
 }
}

代码示例来源:origin: larsgeorge/hbase-book

helper.createTable("testtable", "colfam1");
System.out.println("Adding rows to table...");
helper.fillTable("testtable", 1, 20, 10, 2, true, "colfam1");

代码示例来源:origin: larsgeorge/hbase-book

helper.createTable("testtable", "colfam1");
System.out.println("Adding rows to table...");
helper.fillTable("testtable", 1, 30, 50, 0, true, "colfam1");

代码示例来源:origin: larsgeorge/hbase-book

public static void main(String[] args) throws IOException {
  Configuration conf = HBaseConfiguration.create();

  HBaseHelper helper = HBaseHelper.getHelper(conf);
  helper.dropTable("testtable");
  helper.createTable("testtable", "colfam1");
  System.out.println("Adding rows to table...");
  helper.fillTable("testtable", 1, 10, 30, 0, true, "colfam1");

  Connection connection = ConnectionFactory.createConnection(conf);
  Table table = connection.getTable(TableName.valueOf("testtable"));
  // vv ColumnPrefixFilterExample
  Filter filter = new ColumnPrefixFilter(Bytes.toBytes("col-1"));

  Scan scan = new Scan();
  scan.setFilter(filter);
  ResultScanner scanner = table.getScanner(scan);
  // ^^ ColumnPrefixFilterExample
  System.out.println("Results of scan:");
  // vv ColumnPrefixFilterExample
  for (Result result : scanner) {
   System.out.println(result);
  }
  scanner.close();
  // ^^ ColumnPrefixFilterExample
 }
}

代码示例来源:origin: larsgeorge/hbase-book

public static void main(String[] args) throws IOException {
  Configuration conf = HBaseConfiguration.create();

  HBaseHelper helper = HBaseHelper.getHelper(conf);
  helper.dropTable("testtable");
  helper.createTable("testtable", "colfam1");
  System.out.println("Adding rows to table...");
  helper.fillTable("testtable", 1, 10, 30, 2, true, "colfam1");

  Connection connection = ConnectionFactory.createConnection(conf);
  Table table = connection.getTable(TableName.valueOf("testtable"));
  // vv ColumnRangeFilterExample
  Filter filter = new ColumnRangeFilter(Bytes.toBytes("col-05"), true,
   Bytes.toBytes("col-11"), false);

  Scan scan = new Scan()
   .setStartRow(Bytes.toBytes("row-03"))
   .setStopRow(Bytes.toBytes("row-05"))
   .setFilter(filter);
  ResultScanner scanner = table.getScanner(scan);
  // ^^ ColumnRangeFilterExample
  System.out.println("Results of scan:");
  // vv ColumnRangeFilterExample
  for (Result result : scanner) {
   System.out.println(result);
  }
  scanner.close();
  // ^^ ColumnRangeFilterExample
 }
}

代码示例来源:origin: larsgeorge/hbase-book

public static void main(String[] args) throws IOException {
  Configuration conf = HBaseConfiguration.create();

  HBaseHelper helper = HBaseHelper.getHelper(conf);
  helper.dropTable("testtable");
  helper.createTable("testtable", "colfam1");
  System.out.println("Adding rows to table...");
  helper.fillTable("testtable", 1, 10, 30, 2, true, "colfam1");

  Connection connection = ConnectionFactory.createConnection(conf);
  Table table = connection.getTable(TableName.valueOf("testtable"));
  // vv ColumnPaginationFilterExample
  Filter filter = new ColumnPaginationFilter(5, 15);

  Scan scan = new Scan();
  scan.setFilter(filter);
  ResultScanner scanner = table.getScanner(scan);
  // ^^ ColumnPaginationFilterExample
  System.out.println("Results of scan:");
  // vv ColumnPaginationFilterExample
  for (Result result : scanner) {
   System.out.println(result);
  }
  scanner.close();
  // ^^ ColumnPaginationFilterExample
 }
}

代码示例来源:origin: larsgeorge/hbase-book

helper.createTable("testtable", "colfam1", "colfam2");
System.out.println("Adding rows to table...");
helper.fillTable("testtable", 1, 10, 10, "colfam1", "colfam2");

代码示例来源:origin: larsgeorge/hbase-book

public static void main(String[] args) throws IOException {
 // ^^ DependentColumnFilterExample
 Configuration conf = HBaseConfiguration.create();
 HBaseHelper helper = HBaseHelper.getHelper(conf);
 helper.dropTable("testtable");
 helper.createTable("testtable", "colfam1", "colfam2");
 System.out.println("Adding rows to table...");
 helper.fillTable("testtable", 1, 10, 10, true, "colfam1", "colfam2");
 Connection connection = ConnectionFactory.createConnection(conf);
 table = connection.getTable(TableName.valueOf("testtable"));
 // vv DependentColumnFilterExample
 filter(true, CompareFilter.CompareOp.NO_OP, null);
 filter(false, CompareFilter.CompareOp.NO_OP, null); // co DependentColumnFilterExample-2-Filter Call filter method with various options.
 filter(true, CompareFilter.CompareOp.EQUAL,
  new BinaryPrefixComparator(Bytes.toBytes("val-5")));
 filter(false, CompareFilter.CompareOp.EQUAL,
  new BinaryPrefixComparator(Bytes.toBytes("val-5")));
 filter(true, CompareFilter.CompareOp.EQUAL,
  new RegexStringComparator(".*\\.5"));
 filter(false, CompareFilter.CompareOp.EQUAL,
  new RegexStringComparator(".*\\.5"));
}
// ^^ DependentColumnFilterExample

代码示例来源:origin: larsgeorge/hbase-book

public static void main(String[] args)
 throws IOException, InterruptedException {
 Configuration conf = HBaseConfiguration.create();
 // ^^ RenameTableExample
 HBaseHelper helper = HBaseHelper.getHelper(conf);
 helper.dropTable("testtable");
 helper.createTable("testtable", "colfam1");
 System.out.println("Adding rows to table...");
 helper.fillTable("testtable", 1, 100, 100, "colfam1");
 // vv RenameTableExample
 Connection connection = ConnectionFactory.createConnection(conf);
 Admin admin = connection.getAdmin();
 TableName name = TableName.valueOf("testtable");
 Table table = connection.getTable(name); // co RenameTableExample-07-Test1 Check the content of the original table. The helper method (see full source code) prints the first value of the first row.
 printFirstValue(table);
 TableName rename = TableName.valueOf("newtesttable");
 renameTable(admin, name, rename); // co RenameTableExample-08-Rename Rename the table calling the above method.
 Table newTable = connection.getTable(rename); // co RenameTableExample-09-Test2 Perform another check on the new table to see if we get the same first value of the first row back.
 printFirstValue(newTable);
 table.close();
 newTable.close();
 admin.close();
 connection.close();
}
// ^^ RenameTableExample

代码示例来源:origin: larsgeorge/hbase-book

public static void main(String[] args) throws IOException {
 // ^^ ScanSlicingExample
 Configuration conf = HBaseConfiguration.create();
 HBaseHelper helper = HBaseHelper.getHelper(conf);
 helper.dropTable("testtable");
 helper.createTable("testtable", "colfam1", "colfam2");
 helper.fillTable("testtable", 1, 10, 10, 2, true, "colfam1", "colfam2");
 Connection connection = ConnectionFactory.createConnection(conf);
 table = connection.getTable(TableName.valueOf("testtable"));
 // vv ScanSlicingExample
 /*...*/
 scan(1, 11, 0, 0, 2, -1, true);
 scan(2, 11, 0, 4, 2, -1, true);
 scan(3, 5, 0, 0, 2, -1, false);
 scan(4, 11, 2, 0, 5, -1, true);
 scan(5, 11, -1, -1, -1, 1, false);
 scan(6, 11, -1, -1, -1, 10000, false);
 /*...*/
 // ^^ ScanSlicingExample
 table.close();
 connection.close();
 helper.close();
 // vv ScanSlicingExample
}
// ^^ ScanSlicingExample

相关文章