MCPcopy Create free account
hub / github.com/apache/datafusion / test_recursion_limit

Function test_recursion_limit

datafusion/sql/src/parser.rs:2033–2054  ·  view source on GitHub ↗

Checks the recursion limit works for sql queries Recursion can happen easily with binary exprs (i.e, AND or OR)

()

Source from the content-addressed store, hash-verified

2031 /// Checks the recursion limit works for sql queries
2032 /// Recursion can happen easily with binary exprs (i.e, AND or OR)
2033 fn test_recursion_limit() {
2034 let sql = "SELECT 1 OR 2";
2035
2036 // Expect parse to succeed
2037 DFParserBuilder::new(sql)
2038 .build()
2039 .unwrap()
2040 .parse_statements()
2041 .unwrap();
2042
2043 let err = DFParserBuilder::new(sql)
2044 .with_recursion_limit(1)
2045 .build()
2046 .unwrap()
2047 .parse_statements()
2048 .unwrap_err();
2049
2050 assert_contains!(
2051 err.to_string(),
2052 "SQL error: RecursionLimitExceeded (current limit: 1)"
2053 );
2054 }
2055
2056 #[test]
2057 fn test_multistatement() {

Callers

nothing calls this directly

Calls 5

newFunction · 0.85
parse_statementsMethod · 0.80
unwrap_errMethod · 0.80
with_recursion_limitMethod · 0.80
buildMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…