@Override
  public ObjectInspector initialize(ObjectInspector[] arguments) throws UDFArgumentException {
    if (arguments.length != 0) {
      throw new UDFArgumentLengthException(
          "The function CURRENT_GROUPS does not take any arguments, but found " + arguments.length);
    }

    if (currentGroups == null) {
      List<String> sessGroupsFromAuth = SessionState.getGroupsFromAuthenticator();
      if (sessGroupsFromAuth != null) {
        currentGroups = new ArrayList<Text>();
        for (String group : sessGroupsFromAuth) {
          currentGroups.add(new Text(group));
        }
      }
    }

    return ObjectInspectorFactory.getStandardListObjectInspector(
        PrimitiveObjectInspectorFactory.writableStringObjectInspector);
  }
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