public static QueryState getNewQueryState(HiveConf conf, LineageState lineageState) {
    return new QueryState.Builder()
        .withGenerateNewQueryId(true)
        .withHiveConf(conf)
        .withLineageState(lineageState)
        .build();
  }
Generating the new QueryState object. Making sure, that the new queryId is generated.
@param conf The HiveConf which should be used
@param lineageState a LineageState to be set in the new QueryState object
@return The new QueryState object
ql/src/java/org/apache/hadoop/hive/ql/QueryState.java