本文整理汇总了Java中org.apache.hadoop.fs.Path.getPathWithoutSchemeAndAuthority方法的典型用法代码示例。如果您正苦于以下问题:Java Path.getPathWithoutSchemeAndAuthority方法的具体用法?Java Path.getPathWithoutSchemeAndAuthority怎么用?Java Path.getPathWithoutSchemeAndAuthority使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.hadoop.fs.Path
的用法示例。
在下文中一共展示了Path.getPathWithoutSchemeAndAuthority方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: expandSelection
import org.apache.hadoop.fs.Path; //导入方法依赖的package包/类
private FileSelection expandSelection(DrillFileSystem fs, FileSelection selection) throws IOException {
if (metaDataFileExists(fs, selection.getFirstPath(fs))) {
FileStatus metaRootDir = selection.getFirstPath(fs);
Path metaFilePath = getMetadataPath(metaRootDir);
// get the metadata for the directory by reading the metadata file
ParquetTableMetadata_v1 metadata = Metadata.readBlockMeta(fs, metaFilePath.toString());
List<String> fileNames = Lists.newArrayList();
for (ParquetFileMetadata file : metadata.files) {
fileNames.add(file.path);
}
// when creating the file selection, set the selection root in the form /a/b instead of
// file:/a/b. The reason is that the file names above have been created in the form
// /a/b/c.parquet and the format of the selection root must match that of the file names
// otherwise downstream operations such as partition pruning can break.
Path metaRootPath = Path.getPathWithoutSchemeAndAuthority(metaRootDir.getPath());
return new FileSelection(fileNames, metaRootPath.toString(), metadata /* save metadata for future use */);
} else {
// don't expand yet; ParquetGroupScan's metadata gathering operation
// does that.
return selection;
}
}
示例2: fixFileStatus
import org.apache.hadoop.fs.Path; //导入方法依赖的package包/类
private FileStatus fixFileStatus(String endpoint, FileStatus status) throws IOException {
final Path remotePath = Path.getPathWithoutSchemeAndAuthority(status.getPath());
if (status.isDirectory()) {
return new PDFSFileStatus(makeQualified(remotePath), status);
}
String basename = remotePath.getName();
boolean hidden = isHidden(basename);
StringBuilder sb = new StringBuilder();
if (hidden) {
sb.append(basename.charAt(0));
}
sb.append(endpoint).append('@');
sb.append(hidden ? basename.substring(1) : basename);
return new PDFSFileStatus(makeQualified(new Path(remotePath.getParent(), sb.toString())), status);
}
示例3: testCreateSnapshot
import org.apache.hadoop.fs.Path; //导入方法依赖的package包/类
@Test(timeout = 30000)
public void testCreateSnapshot() throws Exception {
Path snapRootPath = new Path("/snapPath");
Path chRootedSnapRootPath = new Path(
Path.getPathWithoutSchemeAndAuthority(chrootedTo), "snapPath");
AbstractFileSystem baseFs = Mockito.spy(fc.getDefaultFileSystem());
ChRootedFs chRootedFs = new ChRootedFs(baseFs, chrootedTo);
Mockito.doReturn(snapRootPath).when(baseFs)
.createSnapshot(chRootedSnapRootPath, "snap1");
Assert.assertEquals(snapRootPath,
chRootedFs.createSnapshot(snapRootPath, "snap1"));
Mockito.verify(baseFs).createSnapshot(chRootedSnapRootPath, "snap1");
}
示例4: testDeleteSnapshot
import org.apache.hadoop.fs.Path; //导入方法依赖的package包/类
@Test(timeout = 30000)
public void testDeleteSnapshot() throws Exception {
Path snapRootPath = new Path("/snapPath");
Path chRootedSnapRootPath = new Path(
Path.getPathWithoutSchemeAndAuthority(chrootedTo), "snapPath");
AbstractFileSystem baseFs = Mockito.spy(fc.getDefaultFileSystem());
ChRootedFs chRootedFs = new ChRootedFs(baseFs, chrootedTo);
Mockito.doNothing().when(baseFs)
.deleteSnapshot(chRootedSnapRootPath, "snap1");
chRootedFs.deleteSnapshot(snapRootPath, "snap1");
Mockito.verify(baseFs).deleteSnapshot(chRootedSnapRootPath, "snap1");
}
示例5: testRenameSnapshot
import org.apache.hadoop.fs.Path; //导入方法依赖的package包/类
@Test(timeout = 30000)
public void testRenameSnapshot() throws Exception {
Path snapRootPath = new Path("/snapPath");
Path chRootedSnapRootPath = new Path(
Path.getPathWithoutSchemeAndAuthority(chrootedTo), "snapPath");
AbstractFileSystem baseFs = Mockito.spy(fc.getDefaultFileSystem());
ChRootedFs chRootedFs = new ChRootedFs(baseFs, chrootedTo);
Mockito.doNothing().when(baseFs)
.renameSnapshot(chRootedSnapRootPath, "snapOldName", "snapNewName");
chRootedFs.renameSnapshot(snapRootPath, "snapOldName", "snapNewName");
Mockito.verify(baseFs).renameSnapshot(chRootedSnapRootPath, "snapOldName",
"snapNewName");
}
示例6: getFiles
import org.apache.hadoop.fs.Path; //导入方法依赖的package包/类
private void getFiles(String path, List<FileStatus> fileStatuses) throws IOException {
Path p = Path.getPathWithoutSchemeAndAuthority(new Path(path));
FileStatus fileStatus = fs.getFileStatus(p);
if (fileStatus.isDirectory()) {
for (FileStatus f : fs.listStatus(p, new DrillPathFilter())) {
getFiles(f.getPath().toString(), fileStatuses);
}
} else {
fileStatuses.add(fileStatus);
}
}
示例7: transition
import org.apache.hadoop.fs.Path; //导入方法依赖的package包/类
@Override
public void transition(LocalizedResource rsrc, ResourceEvent event) {
ResourceLocalizedEvent locEvent = (ResourceLocalizedEvent) event;
rsrc.localPath =
Path.getPathWithoutSchemeAndAuthority(locEvent.getLocation());
rsrc.size = locEvent.getSize();
for (ContainerId container : rsrc.ref) {
rsrc.dispatcher.getEventHandler().handle(
new ContainerResourceLocalizedEvent(
container, rsrc.rsrc, rsrc.localPath));
}
}
示例8: getRemotePath
import org.apache.hadoop.fs.Path; //导入方法依赖的package包/类
public static RemotePath getRemotePath(Path path) throws IOException {
final String basename = path.getName();
boolean hidden = isHidden(basename);
Matcher matcher = BASENAME_SPLIT_PATTERN.matcher(hidden ? basename.substring(1) : basename);
if (!matcher.matches()) {
throw new IllegalArgumentException("Cannot parse basename for path " + path);
}
final String remoteBasename = matcher.group(2);
return new RemotePath(
matcher.group(1),
new Path(Path.getPathWithoutSchemeAndAuthority(path.getParent()), hidden ? basename.charAt(0) + remoteBasename : remoteBasename));
}
示例9: setLocalPath
import org.apache.hadoop.fs.Path; //导入方法依赖的package包/类
public void setLocalPath(Path localPath) {
this.localPath = Path.getPathWithoutSchemeAndAuthority(localPath);
}
示例10: localize
import org.apache.hadoop.fs.Path; //导入方法依赖的package包/类
private static Path localize(Path path) {
return Path.getPathWithoutSchemeAndAuthority(path);
}
示例11: PDFSDistributedTask
import org.apache.hadoop.fs.Path; //导入方法依赖的package包/类
protected PDFSDistributedTask(Path path) {
this.path = Path.getPathWithoutSchemeAndAuthority(path);
}