我想要覆盖我的一些蜂巢属性值,我正在使用spring上下文连接到蜂箱。基本上,我想执行语句SET hive.auto.convert.join=false; template.execute(splitQuery);,但这不起作用。
I have also tried by setting this var into jdbc url like this. `jdbc:hive2://host:port/default;hive.auto.convert.join=false` but this also did not work.我的sprint context.xml是
<?xml version="1.0" encoding="UTF-8"?><beans:beans xmlns="http://www.springframework.org/schema/hadoop" xmlns:beans="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:c="http://www.springframework.org/schema/c"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.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="hadoop.properties,hive.properties" />
<configuration>
fs.defaultFS=${hd.fs}
yarn.resourcemanager.address=${hd.rm}
mapreduce.framework.name=yarn
mapreduce.jobhistory.address=${hd.jh}
</configuration>
<!-- This sample requires a running HiveServer2 -->
<hive-client-factory id="hiveClientFactory" hive-data-source-ref="hiveDataSource" />
<beans:bean id="hiveDriver" class="org.apache.hive.jdbc.HiveDriver" />
<beans:bean id="hiveDataSource" class="org.springframework.jdbc.datasource.SimpleDriverDataSource">
<beans:constructor-arg name="driver" ref="hiveDriver" />
<beans:constructor-arg name="url" value="${hive.url}" />
<beans:constructor-arg name="username" value="${hive.user}" />
<beans:constructor-arg name="password" value="${hive.password}" />
</beans:bean>
<beans:bean id="template" class="org.springframework.jdbc.core.JdbcTemplate" c:data-source-ref="hiveDataSource"/>
<!-- hive-template id="hiveTemplate"/ -->
有人能提出其他的建议吗?谢谢
发布于 2018-02-26 14:21:37
您应该能够将附加属性作为
它将在driver.connect方法期间注入属性。所以你应该能够做一些类似的事情(没有测试)。
<bean id="myproperties"
class="org.springframework.beans.factory.config.PropertiesFactoryBean">
<property name="properties">
<value>
hive.auto.convert.join=false
</value>
</property>
</bean>
<beans:bean id="hiveDataSource" class="org.springframework.jdbc.datasource.SimpleDriverDataSource">
<beans:constructor-arg name="driver" ref="hiveDriver" />
<beans:constructor-arg name="url" value="${hive.url}" />
<beans:constructor-arg name="username" value="${hive.user}" />
<beans:constructor-arg name="password" value="${hive.password}" />
<property name="connectionProperties" ref="myproperties">
</property>
</beans:bean>https://stackoverflow.com/questions/48974940
复制相似问题