OutputColsHelper implements Serializable { public Row getResultRow(Row input, Row output) { int numOutputs = outputColsPosInResult.length; if (output.getArity() != numOutputs) { throw new IllegalArgumentException("Invalid output size"); } int resultLength = reservedCols.length + outputColNames.length; Row result = new Row(resultLength); for (int i = 0; i < reservedCols.length; i++) { result.setField(reservedColsPosInResult[i], input.getField(reservedCols[i])); } for (int i = 0; i < numOutputs; i++) { result.setField(outputColsPosInResult[i], output.getField(i)); } return result; } OutputColsHelper(TableSchema inputSchema, String outputColName, TypeInformation outputColType);  OutputColsHelper(TableSchema inputSchema, String outputColName, TypeInformation outputColType,
                            String[] reservedColNames);  OutputColsHelper(TableSchema inputSchema, String[] outputColNames, TypeInformation[] outputColTypes);  OutputColsHelper(TableSchema inputSchema, String[] outputColNames, TypeInformation[] outputColTypes,
                            String[] reservedColNames); String[] getReservedColumns(); TableSchema getResultSchema(); Row getResultRow(Row input, Row output);  }
@Test public void testResultRow() { OutputColsHelper helper = new OutputColsHelper( tableSchema, "res", TypeInformation.of(String.class) ); Row expectRow = Row.of("a", 1L, 1, "b"); Assert.assertEquals(helper.getResultRow(row, Row.of("b")), expectRow); helper = new OutputColsHelper( tableSchema, new String[]{"res1", "res2"}, new TypeInformation[]{ TypeInformation.of(String.class), TypeInformation.of(Integer.class) } ); expectRow = Row.of("a", 1L, 1, "b", 2); Assert.assertEquals(helper.getResultRow(row, Row.of("b", 2)), expectRow); helper = new OutputColsHelper( tableSchema, new String[]{"res", "f0"}, new TypeInformation[]{ TypeInformation.of(Integer.class), TypeInformation.of(String.class) }, reservedColNames ); expectRow = Row.of("b", 2); Assert.assertEquals(helper.getResultRow(row, Row.of(2, "b")), expectRow); }