private String randomizePattern(Random control, String value) {
    switch (control.nextInt(10)) {
    default:
    case 0: {
      return value;
    }
    case 1: {
      return control.nextInt(1000) + value;
    }
    case 2: {
      return value + control.nextInt(1000);
    }
    case 3: {
      return control.nextInt(1000) + value.substring(1);
    }
    case 4: {
      return value.substring(1) + control.nextInt(1000);
    }
    case 5: {
      return control.nextInt(1000) + value.substring(0, value.length() - 1);
    }
    case 6: {
      return "";
    }
    case 7: {
      return value.toLowerCase();
    }
    case 8: {
      StringBuilder sb = new StringBuilder();
      for (int i = 0; i < control.nextInt(12); i++) {
        sb.append((char) ('a' + control.nextInt(26)));
      }
      return sb.toString();
    }
    case 9: {
      StringBuilder sb = new StringBuilder();
      for (int i = 0; i < control.nextInt(12); i++) {
        sb.append((char) ('A' + control.nextInt(26)));
      }
      return sb.toString();
    }
    }
  }
Test vectorized expression and filter evaluation for strings.
ql/src/test/org/apache/hadoop/hive/ql/exec/vector/expressions/TestVectorStringExpressions.java