@Test
  public void testMultiColumnPruning() throws IOException {
    shell.setHiveSessionValue("hive.cbo.enable", true);

    Schema schema1 = new Schema(optional(1, "fk", Types.StringType.get()));
    List<Record> records1 = TestHelper.RecordsBuilder.newInstance(schema1).add("fk1").build();
    testTables.createTable(shell, "table1", schema1, fileFormat, records1);

    Schema schema2 = new Schema(optional(1, "fk", Types.StringType.get()), optional(2, "val", Types.StringType.get()));
    List<Record> records2 = TestHelper.RecordsBuilder.newInstance(schema2).add("fk1", "val").build();
    testTables.createTable(shell, "table2", schema2, fileFormat, records2);

    // MR is needed for the reproduction
    shell.setHiveSessionValue("hive.execution.engine", "mr");
    String query = "SELECT t2.val FROM table1 t1 JOIN table2 t2 ON t1.fk = t2.fk";
    List<Object[]> result = shell.executeStatement(query);
    Assert.assertEquals(1, result.size());
    Assert.assertArrayEquals(new Object[]{"val"}, result.get(0));
  }
Column pruning could become problematic when a single Map Task contains multiple TableScan operators where
different columns are pruned. This only occurs on MR, as Tez initializes a single Map task for every TableScan
operator.
iceberg/iceberg-handler/src/test/java/org/apache/iceberg/mr/hive/TestHiveIcebergSelects.java