org.apache.hadoop.hive.common.FileUtils.distCp()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(3.1k)|赞(0)|评价(0)|浏览(136)

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

FileUtils.distCp介绍

暂无

代码示例

代码示例来源:origin: apache/hive

private void doDistCpCopyOnce(FileSystem sourceFs, List<Path> srcList, Path destination,
  boolean usePrivilegedUser) throws IOException {
 if (hiveConf.getBoolVar(HiveConf.ConfVars.REPL_ADD_RAW_RESERVED_NAMESPACE)) {
  srcList = srcList.stream().map(path -> {
   URI uri = path.toUri();
   return new Path(uri.getScheme(), uri.getAuthority(),
     RAW_RESERVED_VIRTUAL_PATH + uri.getPath());
  }).collect(Collectors.toList());
  URI destinationUri = destination.toUri();
  destination = new Path(destinationUri.getScheme(), destinationUri.getAuthority(),
    RAW_RESERVED_VIRTUAL_PATH + destinationUri.getPath());
 }
 if (!FileUtils.distCp(
   sourceFs, // source file system
   srcList,  // list of source paths
   destination,
   false,
   usePrivilegedUser ? copyAsUser : null,
   hiveConf,
   ShimLoader.getHadoopShims())) {
  LOG.error("Distcp failed to copy files: " + srcList + " to destination: " + destination);
  throw new IOException("Distcp operation failed.");
 }
}

代码示例来源:origin: apache/hive

FileUtils.distCp(

代码示例来源:origin: apache/hive

LOG.info("Launch distributed copy (distcp) job.");
triedDistcp = true;
copied = distCp(srcFS, Collections.singletonList(src), dst, deleteSource, null, conf, shims);

代码示例来源:origin: apache/hive

Assert.assertTrue(FileUtils.distCp(fs, Collections.singletonList(copySrc), copyDst, false, doAsUser, conf, shims));
verify(shims).runDistCpAs(Collections.singletonList(copySrc), copyDst, conf, doAsUser);
Assert.assertFalse(FileUtils.distCp(fs, Collections.singletonList(copySrc), copyDst, true, null, conf, shims));
verify(shims).runDistCp(Collections.singletonList(copySrc), copyDst, conf);
 FileUtils.distCp(fs, Collections.singletonList(copySrc), copyDst, true, doAsUser, conf, shims);
 Assert.assertTrue("Should throw IOException as doAs is called with delete source set to true".equals(""));
} catch (IOException e) {

代码示例来源:origin: apache/hive

@Test(expected = IOException.class)
 public void shouldThrowExceptionOnDistcpFailure() throws Exception {
  Path destination = mock(Path.class);
  Path source = mock(Path.class);
  FileSystem fs = mock(FileSystem.class);
  List<Path> srcPaths = Arrays.asList(source, source);
  HiveConf conf = mock(HiveConf.class);
  CopyUtils copyUtils = Mockito.spy(new CopyUtils(null, conf));

  mockStatic(FileUtils.class);
  mockStatic(Utils.class);
  when(destination.getFileSystem(same(conf))).thenReturn(fs);
  when(source.getFileSystem(same(conf))).thenReturn(fs);
  when(FileUtils.distCp(same(fs), anyListOf(Path.class), same(destination),
             anyBoolean(), eq(null), same(conf),
             same(ShimLoader.getHadoopShims())))
    .thenReturn(false);
  when(Utils.getUGI()).thenReturn(mock(UserGroupInformation.class));
  doReturn(false).when(copyUtils).regularCopy(same(fs), same(fs), anyListOf(ReplChangeManager.FileInfo.class));

  copyUtils.doCopy(destination, srcPaths);
 }
}

代码示例来源:origin: org.apache.hive/hive-common

LOG.info("Launch distributed copy (distcp) job.");
triedDistcp = true;
copied = distCp(srcFS, Collections.singletonList(src), dst, deleteSource, null, conf, shims);

相关文章