File tree 1 file changed +4
-2
lines changed
src/main/java/com/sparkTutorial/sparkSql
1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change 3
3
import org .apache .log4j .Level ;
4
4
import org .apache .log4j .Logger ;
5
5
import org .apache .spark .api .java .function .FilterFunction ;
6
+ import org .apache .spark .api .java .function .MapFunction ;
6
7
import org .apache .spark .sql .*;
7
8
8
9
import static org .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 ()
You can’t perform that action at this time.
0 commit comments