org.apache.hadoop.hive.common.FileUtils.unescapePathName()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(8.0k)|赞(0)|评价(0)|浏览(219)

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

FileUtils.unescapePathName介绍

暂无

代码示例

代码示例来源:origin: prestodb/presto

public static List<String> extractPartitionValues(String partitionName)
  {
    ImmutableList.Builder<String> values = ImmutableList.builder();

    boolean inKey = true;
    int valueStart = -1;
    for (int i = 0; i < partitionName.length(); i++) {
      char current = partitionName.charAt(i);
      if (inKey) {
        checkArgument(current != '/', "Invalid partition spec: %s", partitionName);
        if (current == '=') {
          inKey = false;
          valueStart = i + 1;
        }
      }
      else if (current == '/') {
        checkArgument(valueStart != -1, "Invalid partition spec: %s", partitionName);
        values.add(FileUtils.unescapePathName(partitionName.substring(valueStart, i)));
        inKey = true;
        valueStart = -1;
      }
    }
    checkArgument(!inKey, "Invalid partition spec: %s", partitionName);
    values.add(FileUtils.unescapePathName(partitionName.substring(valueStart, partitionName.length())));

    return values.build();
  }
}

代码示例来源:origin: prestodb/presto

public static List<String> toPartitionValues(String partitionName)
{
  // mimics Warehouse.makeValsFromName
  ImmutableList.Builder<String> resultBuilder = ImmutableList.builder();
  int start = 0;
  while (true) {
    while (start < partitionName.length() && partitionName.charAt(start) != '=') {
      start++;
    }
    start++;
    int end = start;
    while (end < partitionName.length() && partitionName.charAt(end) != '/') {
      end++;
    }
    if (start > partitionName.length()) {
      break;
    }
    resultBuilder.add(unescapePathName(partitionName.substring(start, end)));
    start = end + 1;
  }
  return resultBuilder.build();
}

代码示例来源:origin: prestodb/presto

String value = unescapePathName(fileStatus.getPath().getName().substring(directoryPrefix.length()));
for (ArrayDeque<String> childPartition : childPartitionValues) {
  childPartition.addFirst(value);

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

Path lbdPath = fSta.getPath().getParent();
List<String> skewedValue = new ArrayList<String>();
String lbDirName = FileUtils.unescapePathName(lbdPath.toString());
String partDirName = FileUtils.unescapePathName(newPartPath.toString());
String lbDirSuffix = lbDirName.replace(partDirName, "");
String[] dirNames = lbDirSuffix.split(Path.SEPARATOR);

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

Path lbdPath = fSta.getPath().getParent();
List<String> skewedValue = new ArrayList<String>();
String lbDirName = FileUtils.unescapePathName(lbdPath.toString());
String partDirName = FileUtils.unescapePathName(newPartPath.toString());
String lbDirSuffix = lbDirName.replace(partDirName, ""); // TODO: should it rather do a prefix?
if (lbDirSuffix.startsWith(Path.SEPARATOR)) {

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

/**
 * Show the table partitions.
 */
@Override
public void showTablePartitions(DataOutputStream outStream, List<String> parts)
  throws HiveException
  {
 try {
  for (String part : parts) {
   // Partition names are URL encoded. We decode the names unless Hive
   // is configured to use the encoded names.
   SessionState ss = SessionState.get();
   if (ss != null && ss.getConf() != null &&
     !ss.getConf().getBoolVar(HiveConf.ConfVars.HIVE_DECODE_PARTITION_NAME)) {
    outStream.write(part.getBytes("UTF-8"));
   } else {
    outStream.write(FileUtils.unescapePathName(part).getBytes("UTF-8"));
   }
   outStream.write(terminator);
  }
 } catch (IOException e) {
  throw new HiveException(e);
 }
  }

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

/**
 * Show the table partitions.
 */
@Override
public void showTablePartitions(DataOutputStream outStream, List<String> parts)
  throws HiveException
  {
 try {
  for (String part : parts) {
   // Partition names are URL encoded. We decode the names unless Hive
   // is configured to use the encoded names.
   SessionState ss = SessionState.get();
   if (ss != null && ss.getConf() != null &&
     !ss.getConf().getBoolVar(HiveConf.ConfVars.HIVE_DECODE_PARTITION_NAME)) {
    outStream.write(part.getBytes("UTF-8"));
   } else {
    outStream.write(FileUtils.unescapePathName(part).getBytes("UTF-8"));
   }
   outStream.write(terminator);
  }
 } catch (IOException e) {
  throw new HiveException(e);
 }
  }

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

static String unescapePathName(String path) {
 return FileUtils.unescapePathName(path);
}

代码示例来源:origin: edu.berkeley.cs.shark/hive-metastore

static String unescapePathName(String path) {
 return FileUtils.unescapePathName(path);
}

代码示例来源:origin: org.spark-project.hive/hive-metastore

static String unescapePathName(String path) {
 return FileUtils.unescapePathName(path);
}

代码示例来源:origin: org.apache.hadoop.hive/hive-metastore

static String unescapePathName(String path) {
 return FileUtils.unescapePathName(path);
}

代码示例来源:origin: prestosql/presto

public static List<String> toPartitionValues(String partitionName)
{
  // mimics Warehouse.makeValsFromName
  ImmutableList.Builder<String> resultBuilder = ImmutableList.builder();
  int start = 0;
  while (true) {
    while (start < partitionName.length() && partitionName.charAt(start) != '=') {
      start++;
    }
    start++;
    int end = start;
    while (end < partitionName.length() && partitionName.charAt(end) != '/') {
      end++;
    }
    if (start > partitionName.length()) {
      break;
    }
    resultBuilder.add(unescapePathName(partitionName.substring(start, end)));
    start = end + 1;
  }
  return resultBuilder.build();
}

代码示例来源:origin: uk.co.nichesolutions.presto/presto-hive

public static List<String> extractPartitionKeyValues(String partitionName)
  {
    ImmutableList.Builder<String> values = ImmutableList.builder();

    boolean inKey = true;
    int valueStart = -1;
    for (int i = 0; i < partitionName.length(); i++) {
      char current = partitionName.charAt(i);
      if (inKey) {
        checkArgument(current != '/', "Invalid partition spec: %s", partitionName);
        if (current == '=') {
          inKey = false;
          valueStart = i + 1;
        }
      }
      else if (current == '/') {
        checkArgument(valueStart != -1, "Invalid partition spec: %s", partitionName);
        values.add(FileUtils.unescapePathName(partitionName.substring(valueStart, i)));
        inKey = true;
        valueStart = -1;
      }
    }
    checkArgument(!inKey, "Invalid partition spec: %s", partitionName);
    values.add(FileUtils.unescapePathName(partitionName.substring(valueStart, partitionName.length())));

    return values.build();
  }
}

代码示例来源:origin: prestosql/presto

public static List<String> extractPartitionValues(String partitionName)
  {
    ImmutableList.Builder<String> values = ImmutableList.builder();

    boolean inKey = true;
    int valueStart = -1;
    for (int i = 0; i < partitionName.length(); i++) {
      char current = partitionName.charAt(i);
      if (inKey) {
        checkArgument(current != '/', "Invalid partition spec: %s", partitionName);
        if (current == '=') {
          inKey = false;
          valueStart = i + 1;
        }
      }
      else if (current == '/') {
        checkArgument(valueStart != -1, "Invalid partition spec: %s", partitionName);
        values.add(FileUtils.unescapePathName(partitionName.substring(valueStart, i)));
        inKey = true;
        valueStart = -1;
      }
    }
    checkArgument(!inKey, "Invalid partition spec: %s", partitionName);
    values.add(FileUtils.unescapePathName(partitionName.substring(valueStart, partitionName.length())));

    return values.build();
  }
}

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

Path lbdPath = fSta.getPath().getParent();
List<String> skewedValue = new ArrayList<String>();
String lbDirName = FileUtils.unescapePathName(lbdPath.toString());
String partDirName = FileUtils.unescapePathName(newPartPath.toString());
String lbDirSuffix = lbDirName.replace(partDirName, "");
String[] dirNames = lbDirSuffix.split(Path.SEPARATOR);

代码示例来源:origin: prestosql/presto

String value = unescapePathName(fileStatus.getPath().getName().substring(directoryPrefix.length()));
for (ArrayDeque<String> childPartition : childPartitionValues) {
  childPartition.addFirst(value);

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

/**
 * Show the table partitions.
 */
@Override
public void showTablePartitons(DataOutputStream outStream, List<String> parts)
  throws HiveException
  {
 try {
  for (String part : parts) {
   // Partition names are URL encoded. We decode the names unless Hive
   // is configured to use the encoded names.
   SessionState ss = SessionState.get();
   if (ss != null && ss.getConf() != null &&
     !ss.getConf().getBoolVar(HiveConf.ConfVars.HIVE_DECODE_PARTITION_NAME)) {
    outStream.writeBytes(part);
   } else {
    outStream.writeBytes(FileUtils.unescapePathName(part));
   }
   outStream.write(terminator);
  }
 } catch (IOException e) {
  throw new HiveException(e);
 }
  }

相关文章