@Test public void testToInt() throws Exception { List<Row> rows = Collections.singletonList( new Row("str_col", "10000").add("int_col", 10000).add("double_col", 10000.0d) .add("short_col", new Short("10000")).add("long_col", 10000L).add("float_col", 10000.0f) .add("bytes_col", new byte[]{0, 0, 39, 16}) ); String[] directives = new String[] { "set-type str_col int", "set-type int_col i64", "set-type double_col integer", "set-type short_col INT", "set-type long_col I64", "set-type float_col Integer", "set-type bytes_col INTEGER" }; List<Row> results = TestingRig.execute(directives, rows); Row row = results.get(0); for (int i = 0; i < row.width(); i++) { Object object = row.getValue(i); Assert.assertTrue(object instanceof Integer); Integer intValue = (Integer) object; Assert.assertEquals(10000, (int) intValue); } }
@Override public List<Row> execute(List<Row> rows, ExecutorContext context) throws DirectiveExecutionException { for (Row row : rows) { ColumnConverter.convertType(NAME, row, col, type); } return rows; }
SetType implements Directive, Lineage { @Override public List<Row> execute(List<Row> rows, ExecutorContext context) throws DirectiveExecutionException { for (Row row : rows) { ColumnConverter.convertType(NAME, row, col, type); } return rows; } }
SetType implements Directive, Lineage { @Override public List<Row> execute(List<Row> rows, ExecutorContext context) throws DirectiveExecutionException { for (Row row : rows) { ColumnConverter.convertType(NAME, row, col, type); } return rows; }  }
SetType implements Directive, Lineage { @Override public List<Row> execute(List<Row> rows, ExecutorContext context) throws DirectiveExecutionException { for (Row row : rows) { ColumnConverter.convertType(NAME, row, col, type); } return rows; }  @Override UsageDefinition define(); @Override void initialize(Arguments args); @Override void destroy(); @Override List<Row> execute(List<Row> rows, ExecutorContext context); @Override Mutation lineage(); }
SetType implements Directive, Lineage { @Override public List<Row> execute(List<Row> rows, ExecutorContext context) throws DirectiveExecutionException { for (Row row : rows) { ColumnConverter.convertType(NAME, row, col, type); } return rows; }  @Override UsageDefinition define(); @Override void initialize(Arguments args); @Override void destroy(); @Override List<Row> execute(List<Row> rows, ExecutorContext context); @Override Mutation lineage(); static final String NAME; }