Showing
1 changed file
with
11 additions
and
0 deletions
| ... | @@ -30,6 +30,8 @@ public class Aggregation { | ... | @@ -30,6 +30,8 @@ public class Aggregation { |
| 30 | 30 | ||
| 31 | //test | 31 | //test |
| 32 | dataset.where("ip == '5348' and app == '19'").show(10); | 32 | dataset.where("ip == '5348' and app == '19'").show(10); |
| 33 | + | ||
| 34 | + agg.saveCSVDataSet(dataset, "./agg_data"); | ||
| 33 | } | 35 | } |
| 34 | 36 | ||
| 35 | 37 | ||
| ... | @@ -84,4 +86,13 @@ public class Aggregation { | ... | @@ -84,4 +86,13 @@ public class Aggregation { |
| 84 | (count("utc_click_time").over(w)).minus(1)); //TODO 본인것 포함할 것인지 정해야함. | 86 | (count("utc_click_time").over(w)).minus(1)); //TODO 본인것 포함할 것인지 정해야함. |
| 85 | return newDF; | 87 | return newDF; |
| 86 | } | 88 | } |
| 89 | + | ||
| 90 | + private void saveCSVDataSet(Dataset<Row> dataset, String path){ | ||
| 91 | + // Read SCV to DataSet | ||
| 92 | + dataset.repartition(1) | ||
| 93 | + .write().format("csv") | ||
| 94 | + .option("inferSchema", "true") | ||
| 95 | + .option("header", "true") | ||
| 96 | + .save(path); | ||
| 97 | + } | ||
| 87 | } | 98 | } | ... | ... |
-
Please register or login to post a comment