Repository: hive Updated Branches: refs/heads/master f8f3f415e -> b784fbc8b
HIVE-20161: Do Not Print StackTraces to STDERR in ParseDriver (BELUGA BEHR, reviewed by Prasanth Jayachandran and Peter Vary) Project: http://git-wip-us.apache.org/repos/asf/hive/repo Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/b784fbc8 Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/b784fbc8 Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/b784fbc8 Branch: refs/heads/master Commit: b784fbc8b8614bef96ad6c9f65f28f43700a7077 Parents: f8f3f41 Author: BELUGA BEHR <[email protected]> Authored: Thu Nov 29 12:16:16 2018 +0100 Committer: Peter Vary <[email protected]> Committed: Thu Nov 29 12:16:16 2018 +0100 ---------------------------------------------------------------------- .../hadoop/hive/ql/parse/ParseDriver.java | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hive/blob/b784fbc8/ql/src/java/org/apache/hadoop/hive/ql/parse/ParseDriver.java ---------------------------------------------------------------------- diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/ParseDriver.java b/ql/src/java/org/apache/hadoop/hive/ql/parse/ParseDriver.java index f707451..48c0a4a 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/parse/ParseDriver.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/ParseDriver.java @@ -41,7 +41,7 @@ import org.apache.hadoop.hive.ql.Context; */ public class ParseDriver { - private static final Logger LOG = LoggerFactory.getLogger("hive.ql.parse.ParseDriver"); + private static final Logger LOG = LoggerFactory.getLogger(ParseDriver.class); /** * ANTLRNoCaseStringStream. @@ -229,7 +229,6 @@ public class ParseDriver { try { r = parser.statement(); } catch (RecognitionException e) { - e.printStackTrace(); throw new ParseException(parser.errors); } @@ -250,7 +249,7 @@ public class ParseDriver { * Parse a string as a query hint. */ public ASTNode parseHint(String command) throws ParseException { - LOG.info("Parsing hint: " + command); + LOG.debug("Parsing hint: {}", command); HiveLexerX lexer = new HiveLexerX(new ANTLRNoCaseStringStream(command)); TokenRewriteStream tokens = new TokenRewriteStream(lexer); @@ -260,12 +259,11 @@ public class ParseDriver { try { r = parser.hint(); } catch (RecognitionException e) { - e.printStackTrace(); throw new ParseException(parser.errors); } if (lexer.getErrors().size() == 0 && parser.errors.size() == 0) { - LOG.info("Parse Completed"); + LOG.debug("Parse Completed"); } else if (lexer.getErrors().size() != 0) { throw new ParseException(lexer.getErrors()); } else { @@ -286,9 +284,7 @@ public class ParseDriver { * translation process. */ public ASTNode parseSelect(String command, Context ctx) throws ParseException { - if (LOG.isDebugEnabled()) { - LOG.debug("Parsing command: " + command); - } + LOG.debug("Parsing command: {}", command); HiveLexerX lexer = new HiveLexerX(new ANTLRNoCaseStringStream(command)); TokenRewriteStream tokens = new TokenRewriteStream(lexer); @@ -301,7 +297,6 @@ public class ParseDriver { try { r = parser.selectClause(); } catch (RecognitionException e) { - e.printStackTrace(); throw new ParseException(parser.errors); } @@ -316,7 +311,7 @@ public class ParseDriver { return r.getTree(); } public ASTNode parseExpression(String command) throws ParseException { - LOG.info("Parsing expression: " + command); + LOG.debug("Parsing expression: {}", command); HiveLexerX lexer = new HiveLexerX(new ANTLRNoCaseStringStream(command)); TokenRewriteStream tokens = new TokenRewriteStream(lexer); @@ -326,12 +321,11 @@ public class ParseDriver { try { r = parser.expression(); } catch (RecognitionException e) { - e.printStackTrace(); throw new ParseException(parser.errors); } if (lexer.getErrors().size() == 0 && parser.errors.size() == 0) { - LOG.info("Parse Completed"); + LOG.debug("Parse Completed"); } else if (lexer.getErrors().size() != 0) { throw new ParseException(lexer.getErrors()); } else { @@ -350,7 +344,6 @@ public class ParseDriver { try { r = parser.gResourcePlanParser.triggerExpressionStandalone(); } catch (RecognitionException e) { - e.printStackTrace(); throw new ParseException(parser.errors); } if (lexer.getErrors().size() != 0) { @@ -371,7 +364,6 @@ public class ParseDriver { try { r = parser.gResourcePlanParser.triggerActionExpressionStandalone(); } catch (RecognitionException e) { - e.printStackTrace(); throw new ParseException(parser.errors); } if (lexer.getErrors().size() != 0) {
