Skip to content

Commit ed4f46d

Browse files
init commit of project 5
1 parent ec5931e commit ed4f46d

File tree

11 files changed

+226
-0
lines changed

11 files changed

+226
-0
lines changed

project5/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/bin/
2+
/target/
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
eclipse.preferences.version=1
2+
encoding//src/main/java=UTF-8
3+
encoding//src/main/resources=UTF-8
4+
encoding/<project>=UTF-8
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
eclipse.preferences.version=1
2+
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3+
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
4+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
5+
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
6+
org.eclipse.jdt.core.compiler.compliance=1.8
7+
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
8+
org.eclipse.jdt.core.compiler.debug.localVariable=generate
9+
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
10+
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
11+
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
12+
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
13+
org.eclipse.jdt.core.compiler.release=disabled
14+
org.eclipse.jdt.core.compiler.source=1.8
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
activeProfiles=
2+
eclipse.preferences.version=1
3+
resolveWorkspaceProjects=true
4+
version=1

project5/pom.xml

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
2+
<modelVersion>4.0.0</modelVersion>
3+
<groupId>com.jobreadyprogrammer</groupId>
4+
<artifactId>project2</artifactId>
5+
<version>0.0.1-SNAPSHOT</version>
6+
<packaging>jar</packaging>
7+
8+
9+
<properties>
10+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
11+
<java.version>1.8</java.version>
12+
<scala.version>2.11</scala.version>
13+
<spark.version>2.3.1</spark.version>
14+
<maven.compiler.source>1.8</maven.compiler.source>
15+
<maven.compiler.target>1.8</maven.compiler.target>
16+
</properties>
17+
18+
<dependencies>
19+
<!-- Spark -->
20+
<dependency>
21+
<groupId>org.apache.spark</groupId>
22+
<artifactId>spark-core_${scala.version}</artifactId>
23+
<version>${spark.version}</version>
24+
</dependency>
25+
26+
<dependency>
27+
<groupId>org.apache.spark</groupId>
28+
<artifactId>spark-sql_${scala.version}</artifactId>
29+
<version>${spark.version}</version>
30+
<exclusions>
31+
<exclusion>
32+
<groupId>org.slf4j</groupId>
33+
<artifactId>slf4j-simple</artifactId>
34+
</exclusion>
35+
</exclusions>
36+
</dependency>
37+
38+
<dependency>
39+
<groupId>org.apache.spark</groupId>
40+
<artifactId>spark-mllib_${scala.version}</artifactId>
41+
<version>${spark.version}</version>
42+
<exclusions>
43+
<exclusion>
44+
<groupId>org.slf4j</groupId>
45+
<artifactId>slf4j-log4j12</artifactId>
46+
</exclusion>
47+
<exclusion>
48+
<groupId>org.slf4j</groupId>
49+
<artifactId>slf4j-simple</artifactId>
50+
</exclusion>
51+
</exclusions>
52+
</dependency>
53+
54+
<dependency>
55+
<groupId>junit</groupId>
56+
<artifactId>junit</artifactId>
57+
<version>4.11</version>
58+
<scope>test</scope>
59+
</dependency>
60+
61+
</dependencies>
62+
63+
<build>
64+
65+
<plugins>
66+
<plugin>
67+
<groupId>org.apache.maven.plugins</groupId>
68+
<artifactId>maven-dependency-plugin</artifactId>
69+
<executions>
70+
<execution>
71+
<id>copy-dependencies</id>
72+
<phase>prepare-package</phase>
73+
<goals>
74+
<goal>copy-dependencies</goal>
75+
</goals>
76+
<configuration>
77+
<outputDirectory>
78+
${project.build.directory}/libs
79+
</outputDirectory>
80+
</configuration>
81+
</execution>
82+
</executions>
83+
</plugin>
84+
85+
86+
<plugin>
87+
<groupId>org.springframework.boot</groupId>
88+
<artifactId>spring-boot-maven-plugin</artifactId>
89+
<executions>
90+
<execution>
91+
<goals>
92+
<goal>repackage</goal>
93+
</goals>
94+
<configuration>
95+
96+
<mainClass>com.jobreadyprogrammer.spark.Application</mainClass>
97+
98+
</configuration>
99+
</execution>
100+
</executions>
101+
</plugin>
102+
103+
104+
</plugins>
105+
106+
107+
</build>
108+
109+
110+
</project>
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package com.jobreadyprogrammer.spark;
2+
3+
import org.apache.spark.sql.Dataset;
4+
import org.apache.spark.sql.Row;
5+
import org.apache.spark.sql.SparkSession;
6+
7+
public class Application {
8+
9+
public static void main(String[] args) {
10+
11+
SparkSession spark = SparkSession.builder()
12+
.appName("Learning More Spark SQL")
13+
.master("local")
14+
.getOrCreate();
15+
16+
17+
String filename = "src/main/resources/grade_chart.csv";
18+
19+
Dataset<Row> df = spark.read().format("csv")
20+
.option("inferSchema", "true") // Make sure to use string version of true
21+
.option("header", true)
22+
.load(filename);
23+
24+
df.show(10);
25+
26+
}
27+
28+
29+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
customer_id,last_name,first_name,favorite_website
2+
4000,Jackson ,Joe ,techonthenet.com
3+
5000,Smith ,Jane ,digminecraft.com
4+
6000,Ferguson ,Samantha ,bigactivities.com
5+
7000,Reynolds ,Allen ,checkyourmath.com
6+
8000,Anderson ,Paige ,
7+
9000,Johnson ,Derek ,techonthenet.com
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
gpa,letter_grade
2+
1.0,F
3+
1.5,D
4+
2.0,C
5+
2.5,C+
6+
3.0,B
7+
3.5,B+
8+
4.0,A
9+
,
10+
,
11+
,
12+
,
13+
,
14+
,
15+
,
16+
,
17+
,
18+
,
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
customer_id,product_id
2+
7000,1
3+
7000,1
4+
7000,2
5+
5000,6
6+
5000,7
7+
5000,7
8+
5000,6
9+
8000,2
10+
8000,3
11+
8000,3
12+
4000,3
13+
6000,1
14+
6000,1
15+
6000,3
16+
6000,6
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
product_id,product_name,product_price
2+
1,Pear ,0.95
3+
2,Banana ,0.75
4+
3,Orange ,0.75
5+
4,Apple ,0.85
6+
5,Bread ,2.50
7+
6,Sliced Ham ,3.00
8+
7,Kleenex ,4.00

0 commit comments

Comments
 (0)