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

Commitcaf78df

Browse files
author
James Lee
committed
improve UkMarketSpaces
1 parente0f69f2 commitcaf78df

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

‎src/main/java/com/sparkTutorial/sparkSql/join/UkMarketSpaces.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,16 @@ public static void main(String[] args) throws Exception {
2121
Dataset<Row>postCode =session.read().option("header","true").csv("in/uk-postcode.csv")
2222
.withColumn("PostCode",concat_ws("",col("PostCode"),lit(" ")));
2323

24-
postCode.show();
24+
System.out.println("=== Print 20 records of market space table ===");
2525
marketSpace.show();
2626

27-
Dataset<Row>joined =marketSpace.join(postCode,marketSpace.col("Postcode").startsWith(postCode.col("Postcode")));
27+
System.out.println("=== Print 20 records of postcode table ===");
28+
postCode.show();
2829

29-
joined.show();
30+
Dataset<Row>joined =marketSpace.join(postCode,
31+
marketSpace.col("Postcode").startsWith(postCode.col("Postcode")),"left_outer");
3032

33+
System.out.println("=== Group by Region ===");
3134
joined.groupBy("Region").count().show(200);
3235
}
3336
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp