org.apache.hadoop.hive.ql.exec.Utilities.adjustBucketNumLen()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(4.2k)|赞(0)|评价(0)|浏览(70)

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

Utilities.adjustBucketNumLen介绍

[英]Adds 0's to the beginning of bucketNum until bucketNum and taskId are the same length.
[中]将0添加到bucketNum的开头,直到bucketNum和taskId的长度相同。

代码示例

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

/**
 * Returns strBucketNum with enough 0's prefixing the task ID portion of the String to make it
 * equal in length to taskId
 *
 * @param taskId - the taskId used as a template for length
 * @param strBucketNum - the bucket number of the output, may or may not be prefixed
 * @return
 */
private static String replaceTaskId(String taskId, String strBucketNum) {
 Matcher m = PREFIXED_TASK_ID_REGEX.matcher(strBucketNum);
 if (!m.matches()) {
  LOG.warn("Unable to determine bucket number from file ID: {}. Using " +
    "file ID as bucket number.", strBucketNum);
  return adjustBucketNumLen(strBucketNum, taskId);
 } else {
  String adjustedBucketNum = adjustBucketNumLen(m.group(2), taskId);
  return (m.group(1) == null ? StringUtils.EMPTY : m.group(1)) + adjustedBucketNum;
 }
}

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

/**
 * Replace taskId with input bucketNum. For example, if taskId is 000000 and bucketNum is 1,
 * return should be 000001; if taskId is (ds%3D1)000000 and bucketNum is 1, return should be
 * (ds%3D1)000001. This method is different from the replaceTaskId(String, String) method.
 * In this method, the pattern is in taskId.
 * @param taskId
 * @param bucketNum
 * @return
 */
public static String replaceTaskId(String taskId, int bucketNum) {
 String bucketNumStr = String.valueOf(bucketNum);
 Matcher m = PREFIXED_TASK_ID_REGEX.matcher(taskId);
 if (!m.matches()) {
   LOG.warn("Unable to determine bucket number from task id: {}. Using " +
     "task ID as bucket number.", taskId);
   return adjustBucketNumLen(bucketNumStr, taskId);
 } else {
  String adjustedBucketNum = adjustBucketNumLen(bucketNumStr, m.group(2));
  return (m.group(1) == null ? StringUtils.EMPTY : m.group(1)) + adjustedBucketNum;
 }
}

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

/**
 * Returns strBucketNum with enough 0's prefixing the task ID portion of the String to make it
 * equal in length to taskId
 *
 * @param taskId - the taskId used as a template for length
 * @param strBucketNum - the bucket number of the output, may or may not be prefixed
 * @return
 */
private static String replaceTaskId(String taskId, String strBucketNum) {
 Matcher m = PREFIXED_TASK_ID_REGEX.matcher(strBucketNum);
 if (!m.matches()) {
  LOG.warn("Unable to determine bucket number from file ID: " + strBucketNum + ". Using " +
    "file ID as bucket number.");
  return adjustBucketNumLen(strBucketNum, taskId);
 } else {
  String adjustedBucketNum = adjustBucketNumLen(m.group(2), taskId);
  return (m.group(1) == null ? "" : m.group(1)) + adjustedBucketNum;
 }
}

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

/**
 * Replace taskId with input bucketNum. For example, if taskId is 000000 and bucketNum is 1,
 * return should be 000001; if taskId is (ds%3D1)000000 and bucketNum is 1, return should be
 * (ds%3D1)000001. This method is different from the replaceTaskId(String, String) method.
 * In this method, the pattern is in taskId.
 * @param taskId
 * @param bucketNum
 * @return
 */
public static String replaceTaskId(String taskId, int bucketNum) {
 String bucketNumStr = String.valueOf(bucketNum);
 Matcher m = PREFIXED_TASK_ID_REGEX.matcher(taskId);
 if (!m.matches()) {
   LOG.warn("Unable to determine bucket number from task id: " + taskId + ". Using " +
     "task ID as bucket number.");
   return adjustBucketNumLen(bucketNumStr, taskId);
 } else {
  String adjustedBucketNum = adjustBucketNumLen(bucketNumStr, m.group(2));
  return (m.group(1) == null ? "" : m.group(1)) + adjustedBucketNum;
 }
}

代码示例来源:origin: com.facebook.presto.hive/hive-apache

/**
 * Returns strBucketNum with enough 0's prefixing the task ID portion of the String to make it
 * equal in length to taskId
 *
 * @param taskId - the taskId used as a template for length
 * @param strBucketNum - the bucket number of the output, may or may not be prefixed
 * @return
 */
private static String replaceTaskId(String taskId, String strBucketNum) {
 Matcher m = PREFIXED_TASK_ID_REGEX.matcher(strBucketNum);
 if (!m.matches()) {
  LOG.warn("Unable to determine bucket number from file ID: " + strBucketNum + ". Using " +
    "file ID as bucket number.");
  return adjustBucketNumLen(strBucketNum, taskId);
 } else {
  String adjustedBucketNum = adjustBucketNumLen(m.group(2), taskId);
  return (m.group(1) == null ? "" : m.group(1)) + adjustedBucketNum;
 }
}

相关文章

微信公众号

最新文章

更多

Utilities类方法