我使用hadoop hive 0.9.0和1.1.2以及netbeans,但是我得到了这个错误,我无法解决这个问题请帮我代码:
public class Hive_test {
private static String driverName = "org.apache.hadoop.hive.jdbc.HiveDriver";
@SuppressWarnings("CallToThreadDumpStack")
public static void main(String[] args) throws SQLException {
try {
Class.forName(driverName);
} catch (ClassNotFoundException e){
e.printStackTrace();
System.exit(1);
}
System.out.println("commencer la connexion");
Connection con = DriverManager.getConnection("jdbc:hive://localhost:10000/default",""," ");
Statement stmt = con.createStatement();
ResultSet res = stmt.executeQuery("select * from STATE");
while (res.next()){
System.out.println(String.valueOf(res.getInt(1)) + "\t" + res.getString(2));
System.out.println("sql terminer");
}
}
Run Code Online (Sandbox Code Playgroud)
错误如下;
error :
commencer la connexion
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at org.apache.thrift.protocol.TBinaryProtocol.readStringBody(TBinaryProtocol.java:353)
at org.apache.thrift.protocol.TBinaryProtocol.readMessageBegin(TBinaryProtocol.java:215) …Run Code Online (Sandbox Code Playgroud) 我有以下输入:
no,zadrar,MENTOR,rossana@xt.com,AGRATE
no,mittalsu,MENTOR,rossana@xt.com,GREATER NOIDA
no,abousamr,CADENCE,selim@xt.com,CROLLES
no,lokinsks,MENTOR,sergey@xt.com,CROLLES
no,billys,MENTOR,billy@xt.com,CROLLES
no,basiles1,CADENCE,stephane@xt.com,CASTELLETTO
no,cesaris1,CADENCE,stephane@xt.com,CROLLES
Run Code Online (Sandbox Code Playgroud)
我只想获取第 4 列唯一的行:
no,abousamr,CADENCE,selim@xt.com,CROLLES
no,lokinsks,MENTOR,sergey@xt.com,CROLLES
no,billys,MENTOR,billy@xt.com,CROLLES
Run Code Online (Sandbox Code Playgroud)
我尝试过:
awk -F"," '{print $4}' $vendor.csv | sort | uniq -u
Run Code Online (Sandbox Code Playgroud)
但我得到:
selim@xt.com
sergey@xt.com
billy@xt.com
Run Code Online (Sandbox Code Playgroud) 我有两个哈希。
%哈希1:
cavallaro; amg;
gariboldi; amg;
dalfabbro; mdg_dig;
valerio; apb_fmtrd;
Run Code Online (Sandbox Code Playgroud)
%hash2 :
cavallaro; 32;
gariboldi; 6;
dalfabbro; 62;
valerio; 19;
Run Code Online (Sandbox Code Playgroud)
我想通过这样的键组合它们;
cavallaro; 32; amg;
gariboldi; 6; amg;
dalfabbro; 62; mdg_dig;
valerio; 19; apb_fmtrd;
Run Code Online (Sandbox Code Playgroud)
我将如何为同一个键添加多个值。请,任何建议将不胜感激。