John Doe created HIVE-18217:
-------------------------------
Summary: When Text is corrupted, populateMappings() hangs
indefinitely
Key: HIVE-18217
URL: https://issues.apache.org/jira/browse/HIVE-18217
Project: Hive
Issue Type: Bug
Affects Versions: 2.3.2
Reporter: John Doe
Similar like [HIVE-18216|https://issues.apache.org/jira/browse/HIVE-18216],
when the Text is corrupted, the following loop become infinite.
{code:java}
private void populateMappings(Text from, Text to) {
replacementMap.clear();
deletionSet.clear();
ByteBuffer fromBytes = ByteBuffer.wrap(from.getBytes(), 0,
from.getLength());
ByteBuffer toBytes = ByteBuffer.wrap(to.getBytes(), 0, to.getLength());
// Traverse through the from string, one code point at a time
while (fromBytes.hasRemaining()) {
// This will also move the iterator ahead by one code point
int fromCodePoint = Text.bytesToCodePoint(fromBytes);
// If the to string has more code points, make sure to traverse it too
if (toBytes.hasRemaining()) {
int toCodePoint = Text.bytesToCodePoint(toBytes);
// If the code point from from string already has a replacement or is
to be deleted, we
// don't need to do anything, just move on to the next code point
if (replacementMap.containsKey(fromCodePoint) ||
deletionSet.contains(fromCodePoint)) {
continue;
}
replacementMap.put(fromCodePoint, toCodePoint);
} else {
// If the code point from from string already has a replacement or is
to be deleted, we
// don't need to do anything, just move on to the next code point
if (replacementMap.containsKey(fromCodePoint) ||
deletionSet.contains(fromCodePoint)) {
continue;
}
deletionSet.add(fromCodePoint);
}
}
}
{code}
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)