private static PartitionDesc doGetPartitionDescFromPath(
-snip-
if (part == null) {
String dirStr = dir.toString();
//int dirPathIndex = dirPath.lastIndexOf(File.separator);
//int dirStrIndex = dirStr.lastIndexOf(File.separator);
int dirPathIndex = dirPath.lastIndexOf("/");
int dirStrIndex = dirStr.lastIndexOf("/");
while (dirPathIndex >= 0 && dirStrIndex >= 0) {
dirStr = dirStr.substring(0, dirStrIndex);
dirPath = dirPath.substring(0, dirPathIndex);
//first try full match
part = pathToPartitionInfo.get(dirStr);
if (part == null) {
// LOG.warn("exact match not found, try ripping input path's theme and authority");
part = pathToPartitionInfo.get(dirPath);
}
if (part != null) {
break;
}
//dirPathIndex = dirPath.lastIndexOf(File.separator);
//dirStrIndex = dirStr.lastIndexOf(File.separator);
dirPathIndex = dirPath.lastIndexOf("/");
dirStrIndex = dirStr.lastIndexOf("/");
}
}
return part;
}
というか、File.separatorでgrepすると多数あるので、、、他にも危ないところはありそう。。。
日曜日, 9月 18, 2011
Cygwin+Hiveで必要になる修正(File.separatorも!)
Hive内部では、当然HDFSのPath操作を各種行っているのだけど、、そのセパレータ(HDFSなら"/"であるべき)を、File.separatorシステム変数から取得している。
Cygwinではこれが"¥"になってしまうので、修正として先にで紹介したものだけでなく、ql/io/HiveFileFormatUtils.javaのdoGetPartitionDescFromPath()も変更が必要だった。
登録:
コメント (Atom)