private void maskPattern(LineProcessingResult result, Mask mask, PatternReplacementPair patternReplacementPair) {
    if (!result.partialMaskWasMatched && queryMasks.contains(mask)) {
      if (patternReplacementPair.pattern.matcher(result.line).find()) {
        result.line = result.line.replaceAll(patternReplacementPair.pattern.pattern(), patternReplacementPair.replacement);
        result.partialMaskWasMatched = true;
      }
    }
  }
QOutProcessor: produces the final q.out from original q.out by postprocessing (e.g. masks)
itests/util/src/main/java/org/apache/hadoop/hive/ql/QOutProcessor.java