String errorLine = lines.get(location.getLineNumber() - 1); String good = errorLine.substring(0, location.getColumnNumber() - 1); String bad = errorLine.substring(location.getColumnNumber() - 1); if ((location.getLineNumber() == lines.size()) && bad.trim().isEmpty()) { bad = " <EOF>"; for (int i = 1; i < location.getLineNumber(); i++) { ansi.a(lines.get(i - 1)).newline(); for (int i = location.getLineNumber(); i < lines.size(); i++) { ansi.a(lines.get(i)).newline(); String prefix = format("LINE %s: ", location.getLineNumber()); String padding = Strings.repeat(" ", prefix.length() + (location.getColumnNumber() - 1)); out.println(prefix + errorLine); out.println(padding + "^");
@Nullable private static ErrorLocation getErrorLocation(Throwable throwable) { // TODO: this is a big hack if (throwable instanceof ParsingException) { ParsingException e = (ParsingException) throwable; return new ErrorLocation(e.getLineNumber(), e.getColumnNumber()); } else if (throwable instanceof SemanticException) { SemanticException e = (SemanticException) throwable; if (e.getNode().getLocation().isPresent()) { NodeLocation nodeLocation = e.getNode().getLocation().get(); return new ErrorLocation(nodeLocation.getLineNumber(), nodeLocation.getColumnNumber()); } } return null; }
error.getSqlState(), error.getErrorCode(), errorLocation != null ? errorLocation.getLineNumber() : null, errorLocation != null ? errorLocation.getColumnNumber() : null); LogUtil.logQueryError(query, queryError, PrestoQueryExecutor.class); result.complete(QueryResult.errorResult(queryError, query));
@Nullable private static ErrorLocation getErrorLocation(Throwable throwable) { // TODO: this is a big hack if (throwable instanceof ParsingException) { ParsingException e = (ParsingException) throwable; return new ErrorLocation(e.getLineNumber(), e.getColumnNumber()); } else if (throwable instanceof SemanticException) { SemanticException e = (SemanticException) throwable; if (e.getNode().getLocation().isPresent()) { NodeLocation nodeLocation = e.getNode().getLocation().get(); return new ErrorLocation(nodeLocation.getLineNumber(), nodeLocation.getColumnNumber()); } } return null; }
String errorLine = lines.get(location.getLineNumber() - 1); String good = errorLine.substring(0, location.getColumnNumber() - 1); String bad = errorLine.substring(location.getColumnNumber() - 1); if ((location.getLineNumber() == lines.size()) && bad.trim().isEmpty()) { bad = " <EOF>"; for (int i = 1; i < location.getLineNumber(); i++) { ansi.a(lines.get(i - 1)).newline(); for (int i = location.getLineNumber(); i < lines.size(); i++) { ansi.a(lines.get(i)).newline(); String prefix = format("LINE %s: ", location.getLineNumber()); String padding = Strings.repeat(" ", prefix.length() + (location.getColumnNumber() - 1)); out.println(prefix + errorLine); out.println(padding + "^");
String errorLine = lines.get(location.getLineNumber() - 1); String good = errorLine.substring(0, location.getColumnNumber() - 1); String bad = errorLine.substring(location.getColumnNumber() - 1); if ((location.getLineNumber() == lines.size()) && bad.trim().isEmpty()) { bad = " <EOF>"; for (int i = 1; i < location.getLineNumber(); i++) { ansi.a(lines.get(i - 1)).newline(); for (int i = location.getLineNumber(); i < lines.size(); i++) { ansi.a(lines.get(i)).newline(); String prefix = format("LINE %s: ", location.getLineNumber()); String padding = Strings.repeat(" ", prefix.length() + (location.getColumnNumber() - 1)); out.println(prefix + errorLine); out.println(padding + "^");