SELECT c, SUM(COUNT(*)) OVER (ORDER BY c ASC ROWS UNBOUNDED PRECEDING) FROM tbl GROUP BY c
The window element here does not contain a range or an offset, yet this will throw an NPE in TableNamesFinder when it tries to walk the AnalyticExpression:
String sqlStr = "SELECT c, SUM(COUNT(*)) OVER (ORDER BY c ASC ROWS UNBOUNDED PRECEDING) FROM tbl GROUP BY c";
assertThatCode(() -> TablesNamesFinder.findTables(sqlStr))
.doesNotThrowAnyException();
Gives:
Expecting code not to raise a throwable but caught
"java.lang.NullPointerException: Cannot invoke "net.sf.jsqlparser.expression.WindowRange.getStart()" because the return value of "net.sf.jsqlparser.expression.WindowElement.getRange()" is null
The window element here does not contain a range or an offset, yet this will throw an NPE in TableNamesFinder when it tries to walk the AnalyticExpression:
Gives: