2016-07-01 3 views
0

나는 git에서 hive-jdbc를 빌드하고 결과 집합을 가져 오기 위해 기본 jdbc 쿼리를 실행하려고합니다. 어떤 이유로 쿼리에서 다음 예외가 throw됩니다. 여전히 결과 집합을 가져올 수없는, 내가 DML을 위해하는 executeQuery를 사용하고 다른 게시물에 제안하지만 따라 다음하이브 JDBC 연결 "쿼리가 결과 집합을 생성하지 못했습니다."

16/07/01 22:08:12 INFO Utils: Supplied authorities: localhost:10000 
16/07/01 22:08:12 INFO Utils: Resolved authority: localhost:10000 
16/07/01 22:08:12 DEBUG TSaslTransport: opening transport [email protected] 
16/07/01 22:08:12 DEBUG TSaslClientTransport: Sending mechanism name PLAIN and initial response of length 16 
16/07/01 22:08:12 DEBUG TSaslTransport: CLIENT: Writing message with status START and payload length 5 
16/07/01 22:08:12 DEBUG TSaslTransport: CLIENT: Writing message with status COMPLETE and payload length 16 
16/07/01 22:08:12 DEBUG TSaslTransport: CLIENT: Start message handled 
16/07/01 22:08:12 DEBUG TSaslTransport: CLIENT: Main negotiation loop complete 
16/07/01 22:08:12 DEBUG TSaslTransport: CLIENT: SASL Client receiving last message 
16/07/01 22:08:12 DEBUG TSaslTransport: CLIENT: Received message with status COMPLETE and payload length 0 
16/07/01 22:08:12 DEBUG TSaslTransport: writing data length: 71 
16/07/01 22:08:12 DEBUG TSaslTransport: CLIENT: reading data length: 109 
16/07/01 22:08:12 DEBUG TSaslTransport: writing data length: 183 
16/07/01 22:08:12 DEBUG TSaslTransport: CLIENT: reading data length: 109 
16/07/01 22:08:12 DEBUG TSaslTransport: writing data length: 100 
16/07/01 22:08:12 DEBUG TSaslTransport: CLIENT: reading data length: 53 
Exception in thread "main" java.sql.SQLException: The query did not generate a result set! 
    at org.apache.hive.jdbc.HiveStatement.executeQuery(HiveStatement.java:459) 
    at com.kris.mond.sample.HiveQuery.main(HiveQuery.java:20) 

,

 try { 
     Class.forName("org.apache.hive.jdbc.HiveDriver"); 
     } catch (ClassNotFoundException e) { 
      System.err.println("Could not load the driver"); 
      System.exit(1); 
     } 
    Connection con = DriverManager.getConnection("jdbc:hive2://localhost:10000/default", "hduser", "*******"); 
    Statement stmt = con.createStatement(); 
    ResultSet rs = stmt.executeQuery("select account_id,account_parent,account_description from account"); 

내가 사용하고 코드의 조각이다.

이 문제에 대해 도움을 주시면 감사하겠습니다. 미리 감사드립니다.

+0

전체 스택 추적을 인쇄하고 게시하는 것이 더 좋을 것입니다. – duffymo

+0

감사합니다. Duffy, 제안 사항대로 게시물을 업데이트했습니다. –

+0

더 있습니까? 별로 개선하지 못했습니다. – duffymo

답변

1

나는는 결과 집합을 사용할 수 있더라도 false를 반환한다() 어떤 이유로 status.isHasResultSet를 들어

public boolean execute(String sql) throws SQLException { runAsyncOnServer(sql); TGetOperationStatusResp status = waitForOperationToComplete(); **// The query should be completed by now --> /*if (!status.isHasResultSet()) { --> return false; --> }*/** resultSet = new HiveQueryResultSet.Builder(this).setClient(client).setSessionHandle(sessHandle) .setStmtHandle(stmtHandle).setMaxRows(maxRows).setFetchSize(fetchSize) .setScrollable(isScrollableResultset) .build(); return true; } 

HiveStatement.java

에 다음 패치 후 결과 집합을 얻을 수 있었다있다.

+0

그것은 나를 위해 일했다. 감사 – sras

관련 문제