@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));
  }
@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);
   
    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));
  }
@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); 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)); }