@Test
  public void testCombine() throws Exception {
    JobConf newJob = new JobConf(job);

    Path dir1_file1 = new Path(dataDir1, "combinefile1_1");
    writeTextFile(dir1_file1,
                  "dir1_file1_line1\n" +
                  "dir1_file1_line2\n");

    Path dir2_file1 = new Path(dataDir2, "combinefile2_1");
    writeTextFile(dir2_file1,
                  "dir2_file1_line1\n" +
                  "dir2_file1_line2\n");

    // A symlink file, contains first file from first dir and second file from
    // second dir.
    writeSymlinkFile(
        new Path(symlinkDir, "symlink_file"),
        new Path(dataDir1, "combinefile1_1"),
        new Path(dataDir2, "combinefile2_1"));


    HiveConf hiveConf = new HiveConf(TestSymlinkTextInputFormat.class);
    // TODO: HIVE-28032: TestSymlinkTextInputFormat.testCombine to run on Tez
    hiveConf.setVar(HiveConf.ConfVars.HIVE_EXECUTION_ENGINE, "mr");
    hiveConf
    .setVar(HiveConf.ConfVars.HIVE_AUTHORIZATION_MANAGER,
        "org.apache.hadoop.hive.ql.security.authorization.plugin.sqlstd.SQLStdHiveAuthorizerFactory");
    HiveConf.setBoolVar(hiveConf, HiveConf.ConfVars.HIVE_REWORK_MAPREDWORK, true);
    HiveConf.setBoolVar(hiveConf, HiveConf.ConfVars.HIVE_SUPPORT_CONCURRENCY, false);
    Driver drv = new Driver(hiveConf);
    String tblName = "text_symlink_text";

    String createSymlinkTableCmd = "create table " + tblName + " (key int) stored as " +
      " inputformat 'org.apache.hadoop.hive.ql.io.SymlinkTextInputFormat' " +
      " outputformat 'org.apache.hadoop.hive.ql.io.IgnoreKeyTextOutputFormat'";

    SessionState.start(hiveConf);

    boolean tblCreated = false;
    try {
      int ecode = 0;
      drv.run(createSymlinkTableCmd);

      tblCreated = true;
      String loadFileCommand = "LOAD DATA LOCAL INPATH '" +
        new Path(symlinkDir, "symlink_file").toString() + "' INTO TABLE " + tblName;

      drv.run(loadFileCommand);

      String cmd = "select key*2 from " + tblName;
      ecode = drv.compile(cmd, true);
      if (ecode != 0) {
        throw new Exception("Select compile: " + cmd
            + " failed with exit code= " + ecode);
      }

      //create scratch dir
      Context ctx = new Context(newJob);
      Path emptyScratchDir = ctx.getMRTmpPath();
      FileSystem fileSys = emptyScratchDir.getFileSystem(newJob);
      fileSys.mkdirs(emptyScratchDir);

      QueryPlan plan = drv.getPlan();
      MapRedTask selectTask = (MapRedTask)plan.getRootTasks().get(0);

      List<Path> inputPaths = Utilities.getInputPaths(newJob, selectTask.getWork().getMapWork(), emptyScratchDir, ctx, false);
      Utilities.setInputPaths(newJob, inputPaths);

      Utilities.setMapRedWork(newJob, selectTask.getWork(), ctx.getMRTmpPath());

      CombineHiveInputFormat combineInputFormat = ReflectionUtils.newInstance(
          CombineHiveInputFormat.class, newJob);

      InputSplit[] retSplits = combineInputFormat.getSplits(newJob, 1);
      assertEquals(1, retSplits.length);
    } catch (Exception e) {
      e.printStackTrace();
      fail("Caught exception " + e);
    } finally {
      if (tblCreated) {
        drv.run("drop table text_symlink_text");
      }
    }
  }
Test combine symlink text input file. Two input dir, and each contains one
file, and then create one symlink file containing these 2 files. Normally
without combine, it will return at least 2 splits
ql/src/test/org/apache/hadoop/hive/ql/io/TestSymlinkTextInputFormat.java