kgyrtkirk commented on a change in pull request #1029:
URL: https://github.com/apache/hive/pull/1029#discussion_r433704040



##########
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:
       in case it should be fixed in some other way `ResultSet` is 
`AutoCloseable` so it is expected to call `close` on it no matter what - I now 
think that this fix should either land in the jdbc driver - or should be fixed 
in thrift
   




----------------------------------------------------------------
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



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org
For additional commands, e-mail: gitbox-h...@hive.apache.org

Reply via email to