Skip to content
This repository was archived by the owner on Apr 5, 2022. It is now read-only.

Commit 9668180

Browse files
author
Thomas Risberg
committed
SHDP-399 Fix issues running Hive tests
1 parent 7580ae7 commit 9668180

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ metastore_db
1616
.DS_Store
1717
/out/
1818
target
19+
*.log

spring-hadoop-build-tests/src/test/java/org/springframework/data/hadoop/batch/hive/HiveBatchTest.java

+8-4
Original file line numberDiff line numberDiff line change
@@ -130,17 +130,21 @@ public void testScriptParamExecute() throws Exception {
130130
String uri = data.getURI().getPath();
131131
System.out.println("Loading data from " + uri);
132132

133-
String script = "DROP TABLE IF EXISTS ${hiveconf:xxx};set zzz;set hiveconf:yyy;"
134-
+ "create table ${hiveconf:xxx} (key int, value string);"
135-
+ "LOAD DATA LOCAL INPATH '${hiveconf:data}' INTO TABLE ${hiveconf:xxx};"
136-
+ "select count(1) from ${hiveconf:xxx};";
133+
String prepScript = "DROP TABLE IF EXISTS ${hiveconf:xxx};" +
134+
"create table ${hiveconf:xxx} (key int, value string);";
135+
String script = "DROP TABLE IF EXISTS ${hiveconf:xxx};set zzz;set hiveconf:yyy;" +
136+
"create table ${hiveconf:xxx} (key int, value string);" +
137+
"LOAD DATA LOCAL INPATH '${hiveconf:data}' INTO TABLE ${hiveconf:xxx};" +
138+
"select count(1) from ${hiveconf:xxx};";
139+
Resource prep = new ByteArrayResource(prepScript.getBytes());
137140
Resource res = new ByteArrayResource(script.getBytes());
138141
Properties params = new Properties();
139142
params.put("xxx", "nonExisting");
140143
params.put("data", uri);
141144
params.put("zzz", "onions");
142145
params.put("yyy", "unleashed");
143146

147+
template.executeScript(new HiveScript(prep, params));
144148
List<String> run = template.executeScript(new HiveScript(res, params));
145149
System.out.println(run);
146150
assertEquals("zzz=onions", run.get(0));

spring-hadoop-build-tests/src/test/resources/org/springframework/data/hadoop/hadoop-ctx.xml

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
<!-- -->
3636
<hdp:configuration register-url-handler="false" depends-on="cfg-init" file-system-uri="${hadoop.fs}" job-tracker-uri="${hadoop.jt}">
3737
mapreduce.framework.name=yarn
38+
javax.jdo.option.ConnectionURL=jdbc:derby:;databaseName=build/metastore_db;create=true
3839
cfg=main
3940
someparam=somevalue
4041
</hdp:configuration>

0 commit comments

Comments
 (0)