How one would access a broadcasted variable from within
ForeachPartitionFunction  Spark(2.0.1) Java API ?

Integer _bcv = 123;
Broadcast<Integer> bcv = spark.sparkContext().broadcast(_bcv);
Dataset<Row> df_sql = spark.sql("select * from atable");

df_sql.foreachPartition(new ForeachPartitionFunction<Row>() {
    public void call(Iterator<Row> t) throws Exception {
        System.out.println(bcv.value());
    }}
);

Reply via email to