Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9ef522f

Browse files
author
James Lee
committed
update TypedDataset
1 parent69ee9eb commit9ef522f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

‎src/main/java/com/sparkTutorial/sparkSql/TypedDataset.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
importorg.apache.log4j.Level;
44
importorg.apache.log4j.Logger;
55
importorg.apache.spark.api.java.function.FilterFunction;
6+
importorg.apache.spark.api.java.function.MapFunction;
67
importorg.apache.spark.sql.*;
78

89
importstaticorg.apache.spark.sql.functions.avg;
@@ -59,8 +60,9 @@ public static void main(String[] args) throws Exception {
5960
.show();
6061

6162
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())
6466
.withColumnRenamed("value",SALARY_MIDPOINT_BUCKET)
6567
.groupBy(SALARY_MIDPOINT_BUCKET)
6668
.count()

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp