값을 업데이트해야하며 값이 0이면 해당 행을 삭제해야합니다. 다음은 스냅 샷입니다.데이터 프레임의 값을 업데이트하고이 값에 따라 행을 스칼라에 놓는 방법
val net = sc.accumulator(0.0)
df1.foreach(x=> {net += calculate(df2, x)})
def calculate(df2:DataFrame, x : Row):Double = {
var pro:Double = 0.0
df2.foreach(y => {if(xxx){ do some stuff and update the y.getLong(2) value }
else if(yyy){ do some stuff and update the y.getLong(2) value}
if(y.getLong(2) == 0) {drop this row from df2} })
return pro;
}
의견이 있으십니까? 감사.