신은섭(Shin Eun Seop)

att1

This diff is collapsed. Click to expand it.
1 +<?xml version="1.0" encoding="UTF-8"?>
2 +<project version="4">
3 + <component name="CompilerConfiguration">
4 + <annotationProcessing>
5 + <profile name="Maven default annotation processors profile" enabled="true">
6 + <sourceOutputDir name="target/generated-sources/annotations" />
7 + <sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
8 + <outputRelativeToContentRoot value="true" />
9 + <module name="Detecting_fraud_clicks" />
10 + </profile>
11 + </annotationProcessing>
12 + <bytecodeTargetLevel target="9">
13 + <module name="Detecting_fraud_clicks" target="1.8" />
14 + </bytecodeTargetLevel>
15 + </component>
16 +</project>
...\ No newline at end of file ...\ No newline at end of file
...@@ -3,4 +3,14 @@ ...@@ -3,4 +3,14 @@
3 <component name="JavaScriptSettings"> 3 <component name="JavaScriptSettings">
4 <option name="languageLevel" value="ES6" /> 4 <option name="languageLevel" value="ES6" />
5 </component> 5 </component>
6 + <component name="MavenProjectsManager">
7 + <option name="originalFiles">
8 + <list>
9 + <option value="$PROJECT_DIR$/pom.xml" />
10 + </list>
11 + </option>
12 + </component>
13 + <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="false" project-jdk-name="1.8" project-jdk-type="JavaSDK">
14 + <output url="file:///tmp" />
15 + </component>
6 </project> 16 </project>
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -17,6 +17,33 @@ ...@@ -17,6 +17,33 @@
17 <version>2.3.0</version> 17 <version>2.3.0</version>
18 </dependency> 18 </dependency>
19 19
20 + <dependency>
21 + <groupId>org.apache.spark</groupId>
22 + <artifactId>spark-sql_2.11</artifactId>
23 + <version>2.3.0</version>
24 + </dependency>
25 +
26 + <dependency>
27 + <groupId>com.databricks</groupId>
28 + <artifactId>spark-csv_2.11</artifactId>
29 + <version>1.5.0</version>
30 + </dependency>
31 +
20 </dependencies> 32 </dependencies>
21 - 33 +
34 + <build>
35 + <plugins>
36 + <plugin>
37 + <groupId>org.apache.maven.plugins</groupId>
38 + <artifactId>maven-compiler-plugin</artifactId>
39 + <version>3.6.1</version>
40 + <configuration>
41 + <source>1.8</source>
42 + <target>1.8</target>
43 + </configuration>
44 + </plugin>
45 + </plugins>
46 + </build>
47 +
48 +
22 </project> 49 </project>
...\ No newline at end of file ...\ No newline at end of file
......
1 +import org.apache.spark.SparkConf;
2 +import org.apache.spark.api.java.JavaSparkContext;
3 +import org.apache.spark.sql.*;
4 +import org.apache.spark.sql.Row;
5 +
6 +
7 +public class AvgAdvTime {
8 +
9 + public static void main(String[] args) throws Exception {
10 +
11 + SparkSession spark = SparkSession
12 + .builder()
13 + .appName("Java Spark SQL basic example")
14 + .getOrCreate();
15 +
16 + Dataset<Row> df = spark.read().format("csv")
17 + .option("inferSchema", "true")
18 + .option("header", "true")
19 + .load("train_sample.csv");
20 +
21 + df.show();
22 + df.createOrReplaceTempView("logs");
23 +
24 + Dataset<Row> ds = spark.sql("SELECT ip, app, click_time, is_attributed" +
25 + "FROM logs " +
26 + "ORDER BY click_time");
27 + ds.show();
28 +
29 + System.out.println();
30 + }
31 +}
...\ No newline at end of file ...\ No newline at end of file
This diff could not be displayed because it is too large.