Skip to content

Commit

Permalink
Fix null exception in ExpressionVisitorAdapter with simple INTERVAL e…
Browse files Browse the repository at this point in the history
…xpression (#2133)
  • Loading branch information
tomershay authored Dec 28, 2024
1 parent 1edc439 commit d9acb5f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,10 @@ public <S> T visit(ExtractExpression extractExpression, S context) {

@Override
public <S> T visit(IntervalExpression intervalExpression, S context) {
return intervalExpression.getExpression().accept(this, context);
if (intervalExpression.getExpression() != null) {
intervalExpression.getExpression().accept(this, context);
}
return null;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,4 +321,11 @@ public <S> Void visit(ExcludesExpression expr, S parameters) {
assertInstanceOf(Column.class, exprList.get(0));
assertInstanceOf(ParenthesedExpressionList.class, exprList.get(1));
}

@Test
public void testIntervalWithNoExpression() throws JSQLParserException {
Expression expr = CCJSqlParserUtil.parseExpression("INTERVAL 1 DAY");
ExpressionVisitorAdapter<Void> adapter = new ExpressionVisitorAdapter<>();
expr.accept(adapter, null);
}
}

0 comments on commit d9acb5f

Please sign in to comment.