Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
201 views
in Technique[技术] by (71.8m points)

java - Hive JDBC设置内存参数(Hive jdbc set memory params)

Hive has some parameters which decide how much memory it uses in map/reduce :

(Hive具有一些参数,这些参数决定了它在map / reduce中使用多少内存:)

set mapreduce.reduce.memory.mb = 10096 ; 
set mapreduce.map.memory.mb = 10096 ;

so usually when I use hive shell for a big query I run something like

(所以通常当我使用蜂巢壳进行大型查询时,我会运行类似)

hive -e "set mapreduce.reduce.memory.mb = 10096 ; set mapreduce.map.memory.mb = 10096 ; select * from table"

But when I use jdbc with hive from java, I cant seem to find a way to increase memory for large queries.

(但是,当我将jdbc与java中的hive一起使用时,我似乎无法找到增加大型查询的内存的方法。)

I run something like this:

(我运行这样的事情:)

String driverName = "org.apache.hive.jdbc.HiveDriver"; 
con = DriverManager.getConnection("jdbc:hive2://machines/hiveDB");
PreparedStatement ps = con.prepareStatement(sqlQuery);
ResultSet rs = ps.executeQuery();

But JDBC blocks running multiple queries in a single query so I cant do what I did in hive shell, and I dont see another way to do it, so right now I just cant run queries which are too big.

(但是JDBC阻止了在单个查询中运行多个查询,因此我无法完成在蜂巢壳中所做的事情,而且我看不到另一种实现方式,因此现在我无法运行太大的查询。)

Anyone has any idea?

(有人知道吗?)

I thought about running multiple statements but nothing guarantees they will run on the same machine.

(我考虑过要运行多个语句,但是不能保证它们将在同一台计算机上运行。)

TL;DR would like to set hive parameters in java jdbc using the hivedriver for large queries and cant figure a way.

(TL; DR希望使用hivedriver在Java jdbc中设置蜂巢参数,以进行大型查询,并且无法找到一种方法。)

  ask by Ilya Brodezki translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...