private void setupSessionIO(SessionState sessionState) { try { LOG.info("Putting temp output to file " + sessionState.getTmpOutputFile().toString() + " and error output to file " + sessionState.getTmpErrOutputFile().toString()); sessionState.in = null; // hive server's session input stream is not used // open a per-session file in auto-flush mode for writing temp results and tmp error output sessionState.out = new SessionStream( new FileOutputStream(sessionState.getTmpOutputFile()), true, StandardCharsets.UTF_8.name()); sessionState.err = new SessionStream( new FileOutputStream(sessionState.getTmpErrOutputFile()), true, StandardCharsets.UTF_8.name()); } catch (IOException e) { LOG.error("Error in creating temp output file ", e); // Close file streams to avoid resource leaking ServiceUtils.cleanup(LOG, parentSession.getSessionState().out, parentSession.getSessionState().err); try { sessionState.in = null; sessionState.out = new SessionStream(System.out, true, StandardCharsets.UTF_8.name()); sessionState.err = new SessionStream(System.err, true, StandardCharsets.UTF_8.name()); } catch (UnsupportedEncodingException ee) { LOG.error("Error creating PrintStream", e); ee.printStackTrace(); sessionState.out = null; sessionState.err = null; } } }
if (resultReader == null) { SessionState sessionState = getParentSession().getSessionState(); File tmp = sessionState.getTmpOutputFile(); try { resultReader = new BufferedReader(new FileReader(tmp));
if (startSs.getTmpOutputFile() == null) { try { startSs.setTmpOutputFile(createTempFile(startSs.getConf()));
if (startSs.getTmpOutputFile() == null) { try { startSs.setTmpOutputFile(createTempFile(startSs.getConf()));
private void setupSessionIO(SessionState sessionState) { try { LOG.info("Putting temp output to file " + sessionState.getTmpOutputFile().toString()); sessionState.in = null; // hive server's session input stream is not used // open a per-session file in auto-flush mode for writing temp results sessionState.out = new PrintStream(new FileOutputStream(sessionState.getTmpOutputFile()), true, "UTF-8"); // TODO: for hadoop jobs, progress is printed out to session.err, // we should find a way to feed back job progress to client sessionState.err = new PrintStream(System.err, true, "UTF-8"); } catch (IOException e) { LOG.error("Error in creating temp output file ", e); try { sessionState.in = null; sessionState.out = new PrintStream(System.out, true, "UTF-8"); sessionState.err = new PrintStream(System.err, true, "UTF-8"); } catch (UnsupportedEncodingException ee) { LOG.error("Error creating PrintStream", e); ee.printStackTrace(); sessionState.out = null; sessionState.err = null; } } }
private void setupSessionIO(SessionState sessionState) { try { LOG.info("Putting temp output to file " + sessionState.getTmpOutputFile().toString()); sessionState.in = null; // hive server's session input stream is not used // open a per-session file in auto-flush mode for writing temp results sessionState.out = new PrintStream(new FileOutputStream(sessionState.getTmpOutputFile()), true, "UTF-8"); // TODO: for hadoop jobs, progress is printed out to session.err, // we should find a way to feed back job progress to client sessionState.err = new PrintStream(System.err, true, "UTF-8"); } catch (IOException e) { LOG.error("Error in creating temp output file ", e); try { sessionState.in = null; sessionState.out = new PrintStream(System.out, true, "UTF-8"); sessionState.err = new PrintStream(System.err, true, "UTF-8"); } catch (UnsupportedEncodingException ee) { LOG.error("Error creating PrintStream", e); ee.printStackTrace(); sessionState.out = null; sessionState.err = null; } } }
private void setupSessionIO(SessionState sessionState) { try { LOG.info("Putting temp output to file " + sessionState.getTmpOutputFile().toString()); sessionState.in = null; // hive server's session input stream is not used // open a per-session file in auto-flush mode for writing temp results sessionState.out = new PrintStream(new FileOutputStream(sessionState.getTmpOutputFile()), true, "UTF-8"); // TODO: for hadoop jobs, progress is printed out to session.err, // we should find a way to feed back job progress to client sessionState.err = new PrintStream(System.err, true, "UTF-8"); } catch (IOException e) { LOG.error("Error in creating temp output file ", e); try { sessionState.in = null; sessionState.out = new PrintStream(System.out, true, "UTF-8"); sessionState.err = new PrintStream(System.err, true, "UTF-8"); } catch (UnsupportedEncodingException ee) { LOG.error("Error creating PrintStream", e); ee.printStackTrace(); sessionState.out = null; sessionState.err = null; } } }
private void setupSessionIO(SessionState sessionState) { try { LOG.info("Putting temp output to file " + sessionState.getTmpOutputFile().toString()); sessionState.in = null; // hive server's session input stream is not used // open a per-session file in auto-flush mode for writing temp results sessionState.out = new PrintStream(new FileOutputStream(sessionState.getTmpOutputFile()), true, "UTF-8"); // TODO: for hadoop jobs, progress is printed out to session.err, // we should find a way to feed back job progress to client sessionState.err = new PrintStream(System.err, true, "UTF-8"); } catch (IOException e) { LOG.error("Error in creating temp output file ", e); try { sessionState.in = null; sessionState.out = new PrintStream(System.out, true, "UTF-8"); sessionState.err = new PrintStream(System.err, true, "UTF-8"); } catch (UnsupportedEncodingException ee) { LOG.error("Error creating PrintStream", e); ee.printStackTrace(); sessionState.out = null; sessionState.err = null; } } }
private void cleanTmpFile() { resetResultReader(); SessionState sessionState = getParentSession().getSessionState(); File tmp = sessionState.getTmpOutputFile(); tmp.delete(); }
private void setupSessionIO(SessionState sessionState) { try { LOG.info("Putting temp output to file " + sessionState.getTmpOutputFile().toString() + " and error output to file " + sessionState.getTmpErrOutputFile().toString()); sessionState.in = null; // hive server's session input stream is not used // open a per-session file in auto-flush mode for writing temp results and tmp error output sessionState.out = new PrintStream(new FileOutputStream(sessionState.getTmpOutputFile()), true, CharEncoding.UTF_8); sessionState.err = new PrintStream(new FileOutputStream(sessionState.getTmpErrOutputFile()), true,CharEncoding.UTF_8); } catch (IOException e) { LOG.error("Error in creating temp output file ", e); // Close file streams to avoid resource leaking ServiceUtils.cleanup(LOG, parentSession.getSessionState().out, parentSession.getSessionState().err); closeSessionStreams = false; try { sessionState.in = null; sessionState.out = new PrintStream(System.out, true, CharEncoding.UTF_8); sessionState.err = new PrintStream(System.err, true, CharEncoding.UTF_8); } catch (UnsupportedEncodingException ee) { LOG.error("Error creating PrintStream", e); ee.printStackTrace(); sessionState.out = null; sessionState.err = null; } } }
private void cleanTmpFile() { resetResultReader(); SessionState sessionState = getParentSession().getSessionState(); File tmp = sessionState.getTmpOutputFile(); tmp.delete(); }
private void cleanTmpFile() { resetResultReader(); SessionState sessionState = getParentSession().getSessionState(); File tmp = sessionState.getTmpOutputFile(); tmp.delete(); }
private void cleanTmpFile() { resetResultReader(); SessionState sessionState = getParentSession().getSessionState(); File tmp = sessionState.getTmpOutputFile(); tmp.delete(); }
if (resultReader == null) { SessionState sessionState = getParentSession().getSessionState(); File tmp = sessionState.getTmpOutputFile(); try { resultReader = new BufferedReader(new FileReader(tmp));
if (resultReader == null) { SessionState sessionState = getParentSession().getSessionState(); File tmp = sessionState.getTmpOutputFile(); try { resultReader = new BufferedReader(new FileReader(tmp));
if (resultReader == null) { SessionState sessionState = getParentSession().getSessionState(); File tmp = sessionState.getTmpOutputFile(); try { resultReader = new BufferedReader(new FileReader(tmp));
private void cleanup(OperationState state) throws HiveSQLException { setState(state); if (shouldRunAsync()) { Future<?> backgroundHandle = getBackgroundHandle(); if (backgroundHandle != null) { backgroundHandle.cancel(true); } } if (driver != null) { driver.close(); driver.destroy(); } driver = null; SessionState ss = SessionState.get(); if (ss.getTmpOutputFile() != null) { ss.getTmpOutputFile().delete(); } }
private void cleanup(OperationState state) throws HiveSQLException { setState(state); if (shouldRunAsync()) { Future<?> backgroundHandle = getBackgroundHandle(); if (backgroundHandle != null) { backgroundHandle.cancel(true); } } if (driver != null) { driver.close(); driver.destroy(); } driver = null; SessionState ss = SessionState.get(); if (ss.getTmpOutputFile() != null) { ss.getTmpOutputFile().delete(); } }
private void cleanup(OperationState state) throws HiveSQLException { setState(state); if (shouldRunAsync()) { Future<?> backgroundHandle = getBackgroundHandle(); if (backgroundHandle != null) { backgroundHandle.cancel(true); } } if (driver != null) { driver.close(); driver.destroy(); } driver = null; SessionState ss = SessionState.get(); if (ss.getTmpOutputFile() != null) { ss.getTmpOutputFile().delete(); } }
private void cleanup(OperationState state) throws HiveSQLException { setState(state); if (shouldRunAsync()) { Future<?> backgroundHandle = getBackgroundHandle(); if (backgroundHandle != null) { backgroundHandle.cancel(true); } } if (driver != null) { driver.close(); driver.destroy(); } driver = null; SessionState ss = SessionState.get(); if (ss.getTmpOutputFile() != null) { ss.getTmpOutputFile().delete(); } }