类org.apache.hadoop.fs.GlobPattern源码实例Demo

下面列出了怎么用org.apache.hadoop.fs.GlobPattern的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: hadoop   文件: Name.java
@Override
public void prepare() throws IOException {
  String argPattern = getArgument(1);
  if (!caseSensitive) {
    argPattern = StringUtils.toLowerCase(argPattern);
  }
  globPattern = new GlobPattern(argPattern);
}
 
源代码2 项目: big-c   文件: Name.java
@Override
public void prepare() throws IOException {
  String argPattern = getArgument(1);
  if (!caseSensitive) {
    argPattern = StringUtils.toLowerCase(argPattern);
  }
  globPattern = new GlobPattern(argPattern);
}
 
源代码3 项目: Cubert   文件: FileSystemUtils.java
public static Path getFirstMatch(FileSystem fs, Path path, String globPatternStr, boolean recursive)
    throws IOException
{
    RemoteIterator<LocatedFileStatus> files = fs.listFiles(path, recursive);
    GlobPattern globPattern = new GlobPattern(globPatternStr);

    while (files.hasNext())
    {
        Path aFile = files.next().getPath();
        if(globPattern.matches(aFile.getName()))
            return aFile;
    }

    return null;
}
 
源代码4 项目: incubator-gobblin   文件: FSDatasetDescriptor.java
/**
 * A helper to determine if the path description of this {@link DatasetDescriptor} is a superset of paths
 * accepted by the other {@link DatasetDescriptor}. If the path description of the other {@link DatasetDescriptor}
 * is a glob pattern, we return false.
 *
 * @param otherPath a glob pattern that describes a set of paths.
 * @return true if the glob pattern described by the otherPath matches the path in this {@link DatasetDescriptor}.
 */
private boolean isPathContaining(String otherPath) {
  if (otherPath == null) {
    return false;
  }
  if (DatasetDescriptorConfigKeys.DATASET_DESCRIPTOR_CONFIG_ANY.equals(this.getPath())) {
    return true;
  }
  if (PathUtils.isGlob(new Path(otherPath))) {
    return false;
  }
  GlobPattern globPattern = new GlobPattern(this.getPath());
  return globPattern.matches(otherPath);
}
 
源代码5 项目: incubator-gobblin   文件: HiveDatasetDescriptor.java
String createHiveDatasetWhitelist() {
  if (new GlobPattern(this.databaseName).hasWildcard()) {
    return this.databaseName + ".*";
  } else {
    return this.databaseName + "." + this.tableName.replace(',', '|');
  }
}
 
源代码6 项目: examples   文件: Name.java
/** {@inheritDoc} */
@Override
public void initialise(FindOptions options) {
  String argPattern = getArguments().get(0);
  if(!caseSensitive) {
    argPattern = argPattern.toLowerCase();
  }
  globPattern = new GlobPattern(argPattern);
}
 
/**
 * Determines based on suitability of {@code fixedPath} whether to use flat globbing logic where
 * we use a single large listing during globStatus to then perform the core globbing logic
 * in-memory.
 */
@VisibleForTesting
boolean couldUseFlatGlob(Path fixedPath) {
  // Only works for filesystems where the base Hadoop Path scheme matches the underlying URI
  // scheme for GCS.
  if (!getUri().getScheme().equals(GoogleCloudStorageFileSystem.SCHEME)) {
    logger.atFinest().log(
        "Flat glob is on, but doesn't work for scheme '%s', using default behavior.",
        getUri().getScheme());
    return false;
  }

  // The full pattern should have a wildcard, otherwise there's no point doing the flat glob.
  GlobPattern fullPattern = new GlobPattern(fixedPath.toString());
  if (!fullPattern.hasWildcard()) {
    logger.atFinest().log(
        "Flat glob is on, but Path '%s' has no wildcard, using default behavior.", fixedPath);
    return false;
  }

  // To use a flat glob, there must be an authority defined.
  if (isNullOrEmpty(fixedPath.toUri().getAuthority())) {
    logger.atFinest().log(
        "Flat glob is on, but Path '%s' has a empty authority, using default behavior.",
        fixedPath);
    return false;
  }

  // And the authority must not contain a wildcard.
  GlobPattern authorityPattern = new GlobPattern(fixedPath.toUri().getAuthority());
  if (authorityPattern.hasWildcard()) {
    logger.atFinest().log(
        "Flat glob is on, but Path '%s' has a wildcard authority, using default behavior.",
        fixedPath);
    return false;
  }

  return true;
}
 
源代码8 项目: hadoop   文件: GlobFilter.java
@Override
protected Pattern compile(String s) {
  return GlobPattern.compile(s);
}
 
源代码9 项目: big-c   文件: GlobFilter.java
@Override
protected Pattern compile(String s) {
  return GlobPattern.compile(s);
}
 
源代码10 项目: parquet-mr   文件: PathGlobPattern.java
/**
 * Compile glob pattern string
 *
 * @param globPattern the glob pattern
 * @return the pattern object
 */
public static Pattern compile(String globPattern) {
  return new GlobPattern(globPattern).compiled();
}
 
 类所在包
 类方法
 同包方法