forked from spring-attic/spring-hadoop
/
hive-context.xml
63 lines (49 loc) · 2.38 KB
/
hive-context.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:batch="http://www.springframework.org/schema/batch"
xmlns:hdp="http://www.springframework.org/schema/hadoop" xmlns:context="http://www.springframework.org/schema/context"
xmlns:c="http://www.springframework.org/schema/c" xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-2.1.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/hadoop http://www.springframework.org/schema/hadoop/spring-hadoop.xsd">
<context:property-placeholder location="classpath:hadoop.properties"
ignore-resource-not-found="true" ignore-unresolvable="true" />
<hdp:configuration>
fs.default.name=hdfs://localhost:9000
</hdp:configuration>
<hdp:hive-client host="localhost" port="10000">
</hdp:hive-client>
<job id="hiveJob" xmlns="http://www.springframework.org/schema/batch">
<step id="init" next="loadData">
<tasklet ref="initTableTasklet" />
</step>
<step id="loadData" next="showData">
<tasklet ref="loadDataScriptTasklet" />
</step>
<step id="showData">
<tasklet ref="hiveJdbcClient" />
</step>
</job>
<hdp:hive-tasklet id="initTableTasklet" hive-client-ref="hive-client">
<hdp:script location="org/springframework/data/hadoop/samples/hive/script.sql"/>
</hdp:hive-tasklet>
<hdp:hive-tasklet id="loadDataScriptTasklet"
hive-client-ref="hive-client">
<hdp:script>
LOAD DATA LOCAL INPATH 'data.txt' OVERWRITE INTO TABLE t1;
</hdp:script>
</hdp:hive-tasklet>
<bean id="hive-driver" class="org.apache.hadoop.hive.jdbc.HiveDriver" />
<bean id="hive-ds"
class="org.springframework.jdbc.datasource.SimpleDriverDataSource"
c:driver-ref="hive-driver" c:url="jdbc:hive://localhost:10000/default" />
<bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate"
c:data-source-ref="hive-ds" />
<bean id="hiveJdbcClient"
class="org.springframework.data.hadoop.samples.hive.HiveJdbcClientTasklet"
p:template-ref="jdbcTemplate">
<property name="sql">
<value>select * from t1</value>
</property>
</bean>
</beans>