@BeforeClass
  public static void startServices() throws Exception {
    hiveConf = new HiveConf();
    hiveConf.setIntVar(ConfVars.HIVE_SERVER2_THRIFT_MIN_WORKER_THREADS, 1);
    hiveConf.setIntVar(ConfVars.HIVE_SERVER2_THRIFT_MAX_WORKER_THREADS, 1);
    hiveConf.setBoolVar(ConfVars.METASTORE_EXECUTE_SET_UGI, true);
    hiveConf.setBoolVar(ConfVars.HIVE_SUPPORT_CONCURRENCY, false);

    // Setting hive.server2.enable.doAs to True ensures that HS2 performs the query operation as
    // the connected user instead of the user running HS2.
    hiveConf.setBoolVar(ConfVars.HIVE_SERVER2_ENABLE_DOAS, true);

    miniHS2 = new MiniHS2.Builder()
        .withMiniMR()
        .withRemoteMetastore()
        .withConf(hiveConf).build();

    miniHS2.start(new HashMap<String, String>());
  }
If the operation fails because of a DFS error, it used to result in an ugly stack at the client.
HIVE-16960 fixes that issue.  This test case checks one DFS error related to sticky bit.  When
the sticky bit is set, a user error indicating access denied will the thrown.

Setup: HIVE_SERVER2_ENABLE_DOAS set to true:  HS2 performs the operation as connected user.
Connect to HS2 as "hive".
Create a file and set the sticky bit on the directory.  This will not allow the file to move
out of the directory.
Perform "LOAD" operation.  This operation will attempt to move the file, resulting in an error
from DFS.  The DFS error will translate to an Hive Error with number 20009, that corresponds to
"ACCESS DENIED".  The test checks that 20009 is thrown.

Additional tests can be added to cover Quota related exceptions.
itests/hive-unit/src/test/java/org/apache/hive/service/TestDFSErrorHandling.java