[ 
https://issues.apache.org/jira/browse/HIVE-23526?focusedWorklogId=440519&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-440519
 ]

ASF GitHub Bot logged work on HIVE-23526:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 02/Jun/20 23:45
            Start Date: 02/Jun/20 23:45
    Worklog Time Spent: 10m 
      Work Description: dengzhhu653 commented on a change in pull request #1029:
URL: https://github.com/apache/hive/pull/1029#discussion_r433726195



##########
File path: beeline/src/java/org/apache/hive/beeline/Commands.java
##########
@@ -974,86 +974,79 @@ private boolean executeInternal(String sql, boolean call) 
{
 
     ClientHook hook = ClientCommandHookFactory.get().getHook(beeLine, sql);
 
-    try {
-      Statement stmnt = null;
-      boolean hasResults;
-      Thread logThread = null;
+    Statement stmnt = null;
+    boolean hasResults;
+    Thread logThread = null;
 
-      try {
-        long start = System.currentTimeMillis();
+    try {
+      long start = System.currentTimeMillis();
 
-        if (call) {
-          stmnt = 
beeLine.getDatabaseConnection().getConnection().prepareCall(sql);
-          hasResults = ((CallableStatement) stmnt).execute();
+      if (call) {
+        stmnt = 
beeLine.getDatabaseConnection().getConnection().prepareCall(sql);
+        hasResults = ((CallableStatement) stmnt).execute();
+      } else {
+        stmnt = beeLine.createStatement();
+        // In test mode we want the operation logs regardless of the settings
+        if (!beeLine.isTestMode() && beeLine.getOpts().isSilent()) {
+          hasResults = stmnt.execute(sql);
         } else {
-          stmnt = beeLine.createStatement();
-          // In test mode we want the operation logs regardless of the settings
-          if (!beeLine.isTestMode() && beeLine.getOpts().isSilent()) {
-            hasResults = stmnt.execute(sql);
-          } else {
-            InPlaceUpdateStream.EventNotifier eventNotifier =
-                new InPlaceUpdateStream.EventNotifier();
-            logThread = new Thread(createLogRunnable(stmnt, eventNotifier));
-            logThread.setDaemon(true);
-            logThread.start();
-            if (stmnt instanceof HiveStatement) {
-              HiveStatement hiveStatement = (HiveStatement) stmnt;
-              hiveStatement.setInPlaceUpdateStream(
-                  new BeelineInPlaceUpdateStream(
-                      beeLine.getErrorStream(),
-                      eventNotifier
-                  ));
-            }
-            hasResults = stmnt.execute(sql);
-            logThread.interrupt();
-            logThread.join(DEFAULT_QUERY_PROGRESS_THREAD_TIMEOUT);
+          InPlaceUpdateStream.EventNotifier eventNotifier =
+              new InPlaceUpdateStream.EventNotifier();
+          logThread = new Thread(createLogRunnable(stmnt, eventNotifier));
+          logThread.setDaemon(true);
+          logThread.start();
+          if (stmnt instanceof HiveStatement) {
+            HiveStatement hiveStatement = (HiveStatement) stmnt;
+            hiveStatement.setInPlaceUpdateStream(
+                new BeelineInPlaceUpdateStream(
+                    beeLine.getErrorStream(),
+                    eventNotifier
+                ));
           }
+          hasResults = stmnt.execute(sql);
+          logThread.interrupt();
+          logThread.join(DEFAULT_QUERY_PROGRESS_THREAD_TIMEOUT);
         }
+      }
 
-        beeLine.showWarnings();
-
-        if (hasResults) {
-          OutputFile outputFile = beeLine.getRecordOutputFile();
-          if (beeLine.isTestMode() && outputFile != null && 
outputFile.isActiveConverter()) {
-            outputFile.fetchStarted();
-            if (!sql.trim().toLowerCase().startsWith("explain")) {
-              outputFile.foundQuery(true);
-            } else {
-              outputFile.foundQuery(false);
-            }
-          }
-          do {
-            ResultSet rs = stmnt.getResultSet();
-            try {
-              int count = beeLine.print(rs);
-              long end = System.currentTimeMillis();
-
-              if (showReport()) {
-                beeLine.output(beeLine.loc("rows-selected", count) + " " + 
beeLine.locElapsedTime(end - start),
-                    true, beeLine.getErrorStream());
-              }
-            } finally {
-              if (logThread != null) {
-                logThread.join(DEFAULT_QUERY_PROGRESS_THREAD_TIMEOUT);
-                showRemainingLogsIfAny(stmnt);
-                logThread = null;
-              }
-              rs.close();

Review comment:
       I wondering if this maybe is not a thrift problem, reading out of 
sequence is just a consequence of the upper request unpredictably interrupts 
while the connection is still being alive. Fix lands in the jdbc driver maybe 
is not a best approach,  as user who uses jdbc driver can handle the root cause 
at their logic as beeline does.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 440519)
    Time Spent: 2h  (was: 1h 50m)

> Beeline may throw the misleading exception
> ------------------------------------------
>
>                 Key: HIVE-23526
>                 URL: https://issues.apache.org/jira/browse/HIVE-23526
>             Project: Hive
>          Issue Type: Bug
>          Components: Beeline
>         Environment: Hive 1.2.2
>            Reporter: Zhihua Deng
>            Priority: Major
>              Labels: pull-request-available
>         Attachments: HIVE-23526.2.patch, HIVE-23526.3.patch, 
> HIVE-23526.patch, outofsequence.log
>
>          Time Spent: 2h
>  Remaining Estimate: 0h
>
> Sometimes we can see 'out of sequence response' message in beeline, for 
> example:
> Error: org.apache.thrift.TApplicationException: CloseOperation failed: out of 
> sequence response (state=08S01,code=0)
> java.sql.SQLException: org.apache.thrift.TApplicationException: 
> CloseOperation failed: out of sequence response
> at 
> org.apache.hive.jdbc.HiveStatement.closeClientOperation(HiveStatement.java:198)
> at org.apache.hive.jdbc.HiveStatement.close(HiveStatement.java:217)
> at org.apache.hive.beeline.Commands.execute(Commands.java:891)
> at org.apache.hive.beeline.Commands.sql(Commands.java:713)
> at org.apache.hive.beeline.BeeLine.dispatch(BeeLine.java:976)
> at org.apache.hive.beeline.BeeLine.execute(BeeLine.java:816)
> at org.apache.hive.beeline.BeeLine.begin(BeeLine.java:774)
> at org.apache.hive.beeline.BeeLine.mainWithInputRedirection(BeeLine.java:487)
> at org.apache.hive.beeline.BeeLine.main(BeeLine.java:470)
> and there is no other usage message to figured it out, even with --verbose, 
> this makes problem puzzled as beeline does not have concurrency problem on 
> underlying thrift transport.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to