|
3 | 3 | importorg.apache.log4j.Level;
|
4 | 4 | importorg.apache.log4j.Logger;
|
5 | 5 | importorg.apache.spark.api.java.function.FilterFunction;
|
| 6 | +importorg.apache.spark.api.java.function.MapFunction; |
6 | 7 | importorg.apache.spark.sql.*;
|
7 | 8 |
|
8 | 9 | importstaticorg.apache.spark.sql.functions.avg;
|
@@ -59,8 +60,9 @@ public static void main(String[] args) throws Exception {
|
59 | 60 | .show();
|
60 | 61 |
|
61 | 62 | System.out.println("=== Group by salary bucket ===");
|
62 |
| -typedDataset.map(response ->response.getSalaryMidPoint() ==null ? |
63 |
| -null :Math.round(response.getSalaryMidPoint()/20000) *20000,Encoders.INT()) |
| 63 | +typedDataset.map((MapFunction<Response,Integer>)response ->response.getSalaryMidPoint() ==null ? |
| 64 | +null : |
| 65 | +Math.round(response.getSalaryMidPoint()/20000) *20000,Encoders.INT()) |
64 | 66 | .withColumnRenamed("value",SALARY_MIDPOINT_BUCKET)
|
65 | 67 | .groupBy(SALARY_MIDPOINT_BUCKET)
|
66 | 68 | .count()
|
|