Skip to content

Commit 8dbd25e

Browse files
author
P Sruthi
committed
added data resources folder
1 parent f534125 commit 8dbd25e

File tree

5 files changed

+34
-5
lines changed

5 files changed

+34
-5
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.idea
2+
target
3+
*.iml
4+
*.log
5+
metastore_db

data/records.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"id":"305901156","language":"English","content":"Demo SparkSql as JDBC source via Spark ThriftServer"}

pom.xml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,30 @@
226226
<artifactId>gson</artifactId>
227227
<version>2.2.4</version>
228228
</dependency>
229+
230+
<dependency>
231+
<groupId>org.apache.hive</groupId>
232+
<artifactId>hive-common</artifactId>
233+
<version>2.1.1</version>
234+
</dependency>
235+
236+
<dependency>
237+
<groupId>org.apache.hive</groupId>
238+
<artifactId>hive-jdbc</artifactId>
239+
<version>2.1.1</version>
240+
</dependency>
241+
242+
<dependency>
243+
<groupId>org.apache.hive</groupId>
244+
<artifactId>hive-exec</artifactId>
245+
<version>2.1.1</version>
246+
</dependency>
247+
248+
<dependency>
249+
<groupId>org.apache.hive</groupId>
250+
<artifactId>hive-service</artifactId>
251+
<version>2.1.1</version>
252+
</dependency>
229253
</dependencies>
230254

231255
</project>

src/main/scala/MainApp.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ object MainApp {
2323

2424
// For simplicity, Iam loading data from one file for now..
2525
// But, in reality, this records dataset can be some real-time continuous streaming data
26-
val records = spark.read.format("json").load("/Users/surthi/Downloads/delme.json")
26+
val records = spark.read.format("json").load("data/records.json")
2727
records.show()
28-
// records.write.saveAsTable("records")
28+
records.write.saveAsTable("records")
2929

3030
// This loop will keep the session alive
3131
while (true) {

src/test/java/TestThriftClient.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import java.sql.Statement;
88
import java.sql.DriverManager;
99

10-
1110
/**
1211
* This is a test case that connects to sprak's thrift server and asserts that the data is present.
1312
* In this example, 3 asserts are done: "show tables", "describe table <table-name>" and "select * from <table-name>".
@@ -26,7 +25,7 @@ public static void main(String[] args) throws SQLException {
2625
}
2726

2827
// Change the connection-url, username and password accordingly
29-
String connUrl = "jdbc:hive2://172.20.1.190:10000/default";
28+
String connUrl = "jdbc:hive2://localhost:10000/default";
3029
String username = "";
3130
String password = "";
3231

@@ -42,7 +41,7 @@ public static void main(String[] args) throws SQLException {
4241
}
4342

4443
// describe table
45-
String tableName = "hiveivnews";
44+
String tableName = "records";
4645
sql = "describe " + tableName;
4746
System.out.println("Running: " + sql);
4847
res = stmt.executeQuery(sql);

0 commit comments

Comments
 (0)