@Test
  public void testGetInputBytesMultipleTables() throws Exception {
    File file = new File(TEST_WAREHOUSE_DIR + "/" + SPECIFIC_SIZE_TABLE + "/part-m-00000");
    file.deleteOnExit();
    RandomAccessFile randomAccessFile = new RandomAccessFile(file, "rw");
    randomAccessFile.setLength(987654321L);
    randomAccessFile.close();
    file = new File(TEST_WAREHOUSE_DIR + "/" + SPECIFIC_DATABASE + ".db/" +
            SPECIFIC_SIZE_TABLE_2 + "/part-m-00000");
    file.deleteOnExit();
    randomAccessFile = new RandomAccessFile(file, "rw");
    randomAccessFile.setLength(12345678L);
    randomAccessFile.close();
    Job job = new Job();
    HCatLoader hCatLoader = new HCatLoader();

    //Mocking that Pig would assign different signature for each POLoad operator
    hCatLoader.setUDFContextSignature("testGetInputBytesMultipleTables" + SPECIFIC_SIZE_TABLE);
    hCatLoader.setLocation(SPECIFIC_SIZE_TABLE, job);

    HCatLoader hCatLoader2 = new HCatLoader();
    hCatLoader2.setUDFContextSignature("testGetInputBytesMultipleTables" + SPECIFIC_SIZE_TABLE_2);
    hCatLoader2.setLocation(SPECIFIC_DATABASE + "." + SPECIFIC_SIZE_TABLE_2, job);

    HCatLoader hCatLoader3 = new HCatLoader();
    hCatLoader3.setUDFContextSignature("testGetInputBytesMultipleTables" + PARTITIONED_TABLE);
    hCatLoader3.setLocation(PARTITIONED_TABLE, job);

    long specificTableSize = -1;
    long specificTableSize2 = -1;
    long partitionedTableSize = -1;

    ResourceStatistics statistics = hCatLoader.getStatistics(SPECIFIC_SIZE_TABLE, job);
    specificTableSize=statistics.getSizeInBytes();
    assertEquals(987654321, specificTableSize);

    statistics = hCatLoader2.getStatistics(SPECIFIC_SIZE_TABLE_2, job);
    specificTableSize2=statistics.getSizeInBytes();
    assertEquals(12345678, specificTableSize2);

    statistics = hCatLoader3.getStatistics(PARTITIONED_TABLE, job);
    partitionedTableSize=statistics.getSizeInBytes();
    //Partitioned table size here is dependent on underlying storage format, it's ~ 20<x<2000
    assertTrue(20 < partitionedTableSize && partitionedTableSize < 2000);

    //No-op here, just a reminder that Pig would do the calculation of the sum itself
    //e.g. when joining the 3 tables is requested
    assertTrue(Math.abs((specificTableSize + specificTableSize2 + partitionedTableSize) -
        (987654321+12345678+1010)) < 1010);
  }
Simulates Pig relying on HCatLoader to inform about input size of multiple tables.
@throws Exception
hcatalog/hcatalog-pig-adapter/src/test/java/org/apache/hive/hcatalog/pig/AbstractHCatLoaderTest.java