private void populateMappingsIfNecessary(Text from, Text to) {
    // If the from and to strings haven't changed, we don't need to preprocess again to regenerate
    // the mappings of code points that need to replaced or deleted
    if ((lastFrom == null) || (lastTo == null) || !from.equals(lastFrom) || !to.equals(lastTo)) {
      populateMappings(from, to);
      // These are null when evaluate() is called for the first time
      if (lastFrom == null) {
        lastFrom = new Text();
      }
      if (lastTo == null) {
        lastTo = new Text();
      }
      // Need to deep copy here since doing something like lastFrom = from instead, will make
      // lastFrom point to the same Text object which would make from.equals(lastFrom) always true
      lastFrom.set(from);
      lastTo.set(to);
    }
  }
Pre-processes the from and to strings by calling {@link #populateMappings(Text, Text)} if
necessary.

@param from
         from string to be used for translation
@param to
         to string to be used for translation
ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFTranslate.java