private void assertFails(Session session, SemanticErrorCode error, String message, @Language("SQL") String query) { try { analyze(session, query); fail(format("Expected error %s, but analysis succeeded", error)); } catch (SemanticException e) { if (e.getCode() != error) { fail(format("Expected error %s, but found %s: %s", error, e.getCode(), e.getMessage()), e); } if (!e.getMessage().matches(message)) { fail(format("Expected error '%s', but got '%s'", message, e.getMessage()), e); } } }
public void assertInvalidFunction(String projection, SemanticErrorCode expectedErrorCode, String message) { try { evaluateInvalid(projection); fail(format("Expected to throw %s exception", expectedErrorCode)); } catch (SemanticException e) { try { assertEquals(e.getCode(), expectedErrorCode); assertEquals(e.getMessage(), message); } catch (Throwable failure) { failure.addSuppressed(e); throw failure; } } }
format("Unable to set session property '%s' to '%s': %s", propertyName, statement.getValue(), e.getMessage()));
private void assertFails(Session session, SemanticErrorCode error, Optional<NodeLocation> location, @Language("SQL") String query) { try { analyze(session, query); fail(format("Expected error %s, but analysis succeeded", error)); } catch (SemanticException e) { if (e.getCode() != error) { fail(format("Expected error %s, but found %s: %s", error, e.getCode(), e.getMessage()), e); } if (location.isPresent()) { NodeLocation expected = location.get(); NodeLocation actual = e.getNode().getLocation().get(); if (expected.getLineNumber() != actual.getLineNumber() || expected.getColumnNumber() != actual.getColumnNumber()) { fail(format( "Expected error '%s' to occur at line %s, offset %s, but was: line %s, offset %s", e.getCode(), expected.getLineNumber(), expected.getColumnNumber(), actual.getLineNumber(), actual.getColumnNumber())); } } } }
private void assertMissingInformationSchema(Session session, @Language("SQL") String query) { try { analyze(session, query); fail("expected exception"); } catch (SemanticException e) { assertEquals(e.getCode(), MISSING_SCHEMA); assertEquals(e.getMessage(), "Schema information_schema does not exist"); } }
private void assertFailsWithoutExperimentalSyntax(SemanticErrorCode error, @Language("SQL") String query) { try { analyzeWithoutExperimentalSyntax(query); fail(format("Expected error %s, but analysis succeeded", error)); } catch (SemanticException e) { if (e.getCode() != error) { fail(format("Expected error %s, but found %s: %s", error, e.getCode(), e.getMessage()), e); } } }
private void assertFails(Session session, SemanticErrorCode error, @Language("SQL") String query) { try { analyze(session, query); fail(format("Expected error %s, but analysis succeeded", error)); } catch (SemanticException e) { if (e.getCode() != error) { fail(format("Expected error %s, but found %s: %s", error, e.getCode(), e.getMessage()), e); } } }
format("Unable to set session property '%s' to '%s': %s", propertyName, statement.getValue(), e.getMessage()));
if (!e.getMessage().matches("\\Qline 1:55: '=' cannot be applied to row<HyperLogLog>('col0'), row<HyperLogLog>('col0')\\E")) { throw e;