public void testQueryCrossWithSchema() throws FrontendException {
String query = "c = cross (load 'a' as (a, b, c)), (load 'b' as (d, e, f));";
LogicalPlan lp = planTester.buildPlan(query);
//check cross required fields
LOCross cross = (LOCross)lp.getLeaves().get(0);
RequiredFields crossRelevantFields0 = cross.getRelevantInputs(0, 0).get(0);
assertTrue(crossRelevantFields0.getNeedAllFields()==false);
assertTrue(crossRelevantFields0.getNeedNoFields()==false);
assertTrue(crossRelevantFields0.getFields().get(0).first==0);
assertTrue(crossRelevantFields0.getFields().get(0).second==0);
assertTrue(cross.getRelevantInputs(0, 0).get(1)==null);
RequiredFields crossRelevantFields1 = cross.getRelevantInputs(0, 1).get(0);
assertTrue(crossRelevantFields1.getNeedAllFields()==false);
assertTrue(crossRelevantFields1.getNeedNoFields()==false);
assertTrue(crossRelevantFields1.getFields().get(0).first==0);
assertTrue(crossRelevantFields1.getFields().get(0).second==1);
assertTrue(cross.getRelevantInputs(0, 1).get(1)==null);
RequiredFields crossRelevantFields2 = cross.getRelevantInputs(0, 2).get(0);
assertTrue(crossRelevantFields2.getNeedAllFields()==false);
assertTrue(crossRelevantFields2.getNeedNoFields()==false);
assertTrue(crossRelevantFields2.getFields().get(0).first==0);
assertTrue(crossRelevantFields2.getFields().get(0).second==2);
assertTrue(cross.getRelevantInputs(0, 2).get(1)==null);
RequiredFields crossRelevantFields3 = cross.getRelevantInputs(0, 3).get(1);
assertTrue(crossRelevantFields3.getNeedAllFields()==false);
assertTrue(crossRelevantFields3.getNeedNoFields()==false);
assertTrue(crossRelevantFields3.getFields().get(0).first==1);
assertTrue(crossRelevantFields3.getFields().get(0).second==0);
assertTrue(cross.getRelevantInputs(0, 3).get(0)==null);
RequiredFields crossRelevantFields4 = cross.getRelevantInputs(0, 4).get(1);
assertTrue(crossRelevantFields4.getNeedAllFields()==false);
assertTrue(crossRelevantFields4.getNeedNoFields()==false);
assertTrue(crossRelevantFields4.getFields().get(0).first==1);
assertTrue(crossRelevantFields4.getFields().get(0).second==1);
assertTrue(cross.getRelevantInputs(0, 4).get(0)==null);
RequiredFields crossRelevantFields5 = cross.getRelevantInputs(0, 5).get(1);
assertTrue(crossRelevantFields5.getNeedAllFields()==false);
assertTrue(crossRelevantFields5.getNeedAllFields()==false);
assertTrue(crossRelevantFields5.getFields().get(0).first==1);
assertTrue(crossRelevantFields5.getFields().get(0).second==2);
assertTrue(cross.getRelevantInputs(0, 5).get(0)==null);
}