@Test
public void testProjectFields() throws Exception {

	OrcTableSource orc = OrcTableSource.builder()
		.path(getPath(TEST_FILE_NESTED))
		.forOrcSchema(TEST_SCHEMA_NESTED)
		.build();
	OrcTableSource projected = (OrcTableSource) orc.projectFields(new int[]{3, 5, 1, 0});
	// ensure copy is returned
	assertTrue(orc != projected);
	// ensure table schema is identical
	assertEquals(orc.getTableSchema(), projected.getTableSchema());
	// ensure return type was adapted
	String[] fieldNames = getNestedFieldNames();
	TypeInformation[] fieldTypes = getNestedFieldTypes();
	assertEquals(
		Types.ROW_NAMED(
			new String[] {fieldNames[3], fieldNames[5], fieldNames[1], fieldNames[0]},
			new TypeInformation[] {fieldTypes[3], fieldTypes[5], fieldTypes[1], fieldTypes[0]}),
		projected.getReturnType());
	// ensure IF is configured with selected fields
	OrcTableSource spyTS = spy(projected);
	OrcRowInputFormat mockIF = mock(OrcRowInputFormat.class);
	doReturn(mockIF).when(spyTS).buildOrcInputFormat();
	spyTS.getDataSet(mock(ExecutionEnvironment.class));
	verify(mockIF).selectFields(eq(3), eq(5), eq(1), eq(0));
}