Search in sources :

Example 1 with InvalidHoodiePathException

use of org.apache.hudi.exception.InvalidHoodiePathException in project hudi by apache.

the class FSUtils method getTaskPartitionIdFromLogPath.

/**
 * Get TaskPartitionId used in log-path.
 */
public static Integer getTaskPartitionIdFromLogPath(Path path) {
    Matcher matcher = LOG_FILE_PATTERN.matcher(path.getName());
    if (!matcher.find()) {
        throw new InvalidHoodiePathException(path, "LogFile");
    }
    String val = matcher.group(7);
    return val == null ? null : Integer.parseInt(val);
}
Also used : Matcher(java.util.regex.Matcher) InvalidHoodiePathException(org.apache.hudi.exception.InvalidHoodiePathException)

Example 2 with InvalidHoodiePathException

use of org.apache.hudi.exception.InvalidHoodiePathException in project hudi by apache.

the class FSUtils method getTaskAttemptIdFromLogPath.

/**
 * Get Task Attempt Id used in log-path.
 */
public static Integer getTaskAttemptIdFromLogPath(Path path) {
    Matcher matcher = LOG_FILE_PATTERN.matcher(path.getName());
    if (!matcher.find()) {
        throw new InvalidHoodiePathException(path, "LogFile");
    }
    String val = matcher.group(9);
    return val == null ? null : Integer.parseInt(val);
}
Also used : Matcher(java.util.regex.Matcher) InvalidHoodiePathException(org.apache.hudi.exception.InvalidHoodiePathException)

Example 3 with InvalidHoodiePathException

use of org.apache.hudi.exception.InvalidHoodiePathException in project hudi by apache.

the class FSUtils method getStageIdFromLogPath.

/**
 * Get StageId used in log-path.
 */
public static Integer getStageIdFromLogPath(Path path) {
    Matcher matcher = LOG_FILE_PATTERN.matcher(path.getName());
    if (!matcher.find()) {
        throw new InvalidHoodiePathException(path, "LogFile");
    }
    String val = matcher.group(8);
    return val == null ? null : Integer.parseInt(val);
}
Also used : Matcher(java.util.regex.Matcher) InvalidHoodiePathException(org.apache.hudi.exception.InvalidHoodiePathException)

Aggregations

Matcher (java.util.regex.Matcher)3 InvalidHoodiePathException (org.apache.hudi.exception.InvalidHoodiePathException)3