本文整理匯總了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);
}