public static HivePartitionStats merge(HivePartitionStats current, HivePartitionStats update) {
        if (current.getCommonStats().getRowNums() == -1 || update.getCommonStats().getRowNums() <= 0) {
            return current;
        } else if (current.getCommonStats().getRowNums() == 0 && update.getCommonStats().getRowNums() > 0) {
            return update;
        }

        return new HivePartitionStats(
                reduce(current.getCommonStats(), update.getCommonStats(), ReduceOperator.ADD),
                // TODO(stephen): collect and merge column statistics
                current.getColumnStats());
    }
@Test
    public void testMerge() {
        HivePartitionStats current = HivePartitionStats.empty();
        HivePartitionStats update = HivePartitionStats.empty();
        Assert.assertEquals(current, HivePartitionStats.merge(current, update));

        current = HivePartitionStats.fromCommonStats(5, 100);
        update = HivePartitionStats.empty();
        Assert.assertEquals(current, HivePartitionStats.merge(current, update));

        current = HivePartitionStats.fromCommonStats(0, 0);
        update = HivePartitionStats.fromCommonStats(5, 100);
        Assert.assertEquals(update, HivePartitionStats.merge(current, update));

        current = HivePartitionStats.fromCommonStats(5, 100);
        Assert.assertEquals(10, HivePartitionStats.merge(current, update).getCommonStats().getRowNums());
        Assert.assertEquals(200, HivePartitionStats.merge(current, update).getCommonStats().getTotalFileBytes());
    }