@Test
  public void testLlapAwareMemoryManager() throws IOException {
    ObjectInspector inspector;
    synchronized (TestOrcFile.class) {
      inspector = ObjectInspectorFactory.getReflectionObjectInspector(Long.class,
        ObjectInspectorFactory.ObjectInspectorOptions.JAVA);
    }

    try {
      OrcFile.WriterOptions opts = OrcFile.writerOptions(conf).inspector(inspector).compress(CompressionKind.ZLIB);
      Writer writer = OrcFile.createWriter(new Path(testFilePath, "-0"), opts);
      writer.close();
      assertEquals(opts.getMemoryManager().getClass(), MemoryManagerImpl.class);

      conf.set(HiveConf.ConfVars.HIVE_EXECUTION_MODE.varname, "llap");
      LlapDaemonInfo.initialize("test", new Configuration());
      LlapProxy.setDaemon(true);
      opts = OrcFile.writerOptions(conf).inspector(inspector).compress(CompressionKind.ZLIB);
      writer = OrcFile.createWriter(new Path(testFilePath, "-1"), opts);
      writer.close();
      assertEquals(opts.getMemoryManager().getClass(), OrcFile.LlapAwareMemoryManager.class);
      assertEquals(LlapDaemonInfo.INSTANCE.getMemoryPerExecutor() * 0.5,
        ((OrcFile.LlapAwareMemoryManager) opts.getMemoryManager()).getTotalMemoryPool(), 100);

      conf.setBoolean(HiveConf.ConfVars.HIVE_ORC_WRITER_LLAP_MEMORY_MANAGER_ENABLED.varname, false);
      opts = OrcFile.writerOptions(conf).inspector(inspector).compress(CompressionKind.ZLIB);
      writer = OrcFile.createWriter(new Path(testFilePath, "-2"), opts);
      writer.close();
      assertEquals(opts.getMemoryManager().getClass(), MemoryManagerImpl.class);
    } finally {
      LlapProxy.setDaemon(false);
      conf.set(HiveConf.ConfVars.HIVE_EXECUTION_MODE.varname, "container");
    }
  }
Read and write a randomly generated snappy file.
@throws Exception
ql/src/test/org/apache/hadoop/hive/ql/io/orc/TestOrcFile.java