DataFrameToIterableRow implements Function<Dataset<Row>, Iterable<? extends Row>> { @Override public Iterable<? extends Row> apply(final Dataset<Row> dataset) { return dataset::toLocalIterator; }  @Override Iterable<? extends Row> apply(final Dataset<Row> dataset);  }
@Test public void shouldConvertDataFrameToIterableOfRows() { final SparkSession sparkSession = SparkSessionProvider.getSparkSession(); final Function<Dataset<Row>, Iterable<? extends Row>> function = new DataFrameToIterableRow(); final Dataset<Row> dataframe = Graphs$.MODULE$.friends().vertices(); final Iterable<? extends Row> result = function.apply(dataframe); final List<Row> resultList = Lists.newArrayList(result); assertThat(resultList, hasSize(7)); }