private void compareValue(Schema.Field field, Object originalValue, Record record,
      AtomicInteger fieldsValidated) {
    Object valueInRecord = record.get(field);
    Assert.assertEquals(field + " values are not equal", originalValue, valueInRecord);
    fieldsValidated.incrementAndGet();
  }
This unit test asserts that the record is created as expected from the various hive source objects like:
DriverContext, SessionState, QueryInfo, etc.
itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/queryhistory/TestQueryHistoryService.java