@Override
  public void copyToNewInstance(Object newInstance) throws UDFArgumentException {
    super.copyToNewInstance(newInstance);
    // Need to preserve currentGroups
    GenericUDFCurrentGroups other = (GenericUDFCurrentGroups) newInstance;
    if (this.currentGroups != null) {
      if (currentGroups != null) {
        other.currentGroups = new ArrayList<Text>();
        for (Text group : currentGroups) {
          other.currentGroups.add(new Text(group));
        }
      }
    }
  }
UDF to get current group from authenticator. This function is not a deterministic function,
but a runtime constant. The return value is constant within a query but can be different between queries.
ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFCurrentGroups.java