當前位置: 首頁>>代碼示例>>Java>>正文


Java Export類代碼示例

本文整理匯總了Java中org.apache.hadoop.hbase.mapreduce.Export的典型用法代碼示例。如果您正苦於以下問題:Java Export類的具體用法?Java Export怎麽用?Java Export使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Export類屬於org.apache.hadoop.hbase.mapreduce包,在下文中一共展示了Export類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: main

import org.apache.hadoop.hbase.mapreduce.Export; //導入依賴的package包/類
public static void main(String[] args) {
  ProgramDriver programDriver = new ProgramDriver();
  int exitCode = -1;
  try {
    programDriver.addClass("wordcount-hbase", WordCountHBase.class,
        "A map/reduce program that counts the words in the input files.");
    programDriver.addClass("export-table", Export.class,
        "A map/reduce program that exports a table to a file.");
    //programDriver.addClass("cellcounter", CellCounter.class, "Count them cells!");
    programDriver.driver(args);
    exitCode = programDriver.run(args);
  } catch (Throwable e) {
    e.printStackTrace();
  }
  System.exit(exitCode);
}
 
開發者ID:GoogleCloudPlatform,項目名稱:cloud-bigtable-examples,代碼行數:17,代碼來源:WordCountDriver.java

示例2: main

import org.apache.hadoop.hbase.mapreduce.Export; //導入依賴的package包/類
public static void main(String[] args) {
  ProgramDriver programDriver = new ProgramDriver();
  int exitCode = -1;
  try {
    programDriver.addClass("export-table", Export.class,
        "A map/reduce program that exports a table to a file.");
    programDriver.addClass("import-table", Import.class,
        "A map/reduce program that imports a table to a file.");
    programDriver.driver(args);
    exitCode = programDriver.run(args);
  } catch (Throwable e) {
    e.printStackTrace();
  }
  System.exit(exitCode);
}
 
開發者ID:dmmcerlean,項目名稱:cloud-bigtable-client,代碼行數:16,代碼來源:Driver.java

示例3: testMapReduce

import org.apache.hadoop.hbase.mapreduce.Export; //導入依賴的package包/類
@Test
@Category(KnownGap.class)
public void testMapReduce() throws IOException, ClassNotFoundException, InterruptedException {
  Table oldTable = getConnection().getTable(TABLE_NAME);

  // Put a value.
  byte[] rowKey = dataHelper.randomData("testrow-");
  byte[] qual = dataHelper.randomData("testQualifier-");
  byte[] value = dataHelper.randomData("testValue-");
  Put put = new Put(rowKey);
  put.addColumn(COLUMN_FAMILY, qual, value);
  oldTable.put(put);

  // Assert the value is there.
  Get get = new Get(rowKey);
  Result result = oldTable.get(get);
  List<Cell> cells = result.listCells();
  Assert.assertEquals(1, cells.size());
  Assert.assertArrayEquals(CellUtil.cloneValue(cells.get(0)), value);

  // Run the export.
  Configuration conf = getConnection().getConfiguration();

  //conf.set("fs.defaultFS", "file:///");
  FileSystem dfs = IntegrationTests.getMiniCluster().getFileSystem();
  String tempDir = "hdfs://" + dfs.getCanonicalServiceName() + "/tmp/backup";

  String[] args = new String[]{
      TABLE_NAME.getNameAsString(),
      tempDir
  };
  Job job = Export.createSubmittableJob(conf, args);
  // So it looks for jars in the local FS, not HDFS.
  job.getConfiguration().set("fs.defaultFS", "file:///");
  Assert.assertTrue(job.waitForCompletion(true));

  // Create new table.
  TableName newTableName = IntegrationTests.newTestTableName();
  Table newTable = getConnection().getTable(newTableName);

  // Change for method in IntegrationTests
  Admin admin = getConnection().getAdmin();
  HColumnDescriptor hcd = new HColumnDescriptor(IntegrationTests.COLUMN_FAMILY);
  HTableDescriptor htd = new HTableDescriptor(newTableName);
  htd.addFamily(hcd);
  admin.createTable(htd);

  // Run the import.
  args = new String[]{
      newTableName.getNameAsString(),
      tempDir
  };
  job = Import.createSubmittableJob(conf, args);
  job.getConfiguration().set("fs.defaultFS", "file:///");
  Assert.assertTrue(job.waitForCompletion(true));

  // Assert the value is there.
  get = new Get(rowKey);
  result = newTable.get(get);
  cells = result.listCells();
  Assert.assertEquals(1, cells.size());
  Assert.assertArrayEquals(CellUtil.cloneValue(cells.get(0)), value);
}
 
開發者ID:dmmcerlean,項目名稱:cloud-bigtable-client,代碼行數:64,代碼來源:TestImport.java


注:本文中的org.apache.hadoop.hbase.mapreduce.Export類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。