public static boolean addResource(Configuration conf, String key, Object resource) {
    Optional<QueryState> queryState = getQueryState(conf);
    if (queryState.isPresent()) {
      queryState.get().addResource(key, resource);
      return true;
    } else {
      return false;
    }
  }
@param conf Configuration object used for getting the query state, should contain the query id
@param key The resource identifier
@param resource The resource to save into the QueryState
@return whether operation succeeded
ql/src/java/org/apache/hadoop/hive/ql/session/SessionStateUtil.java