Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TINY] Use sql function IsNullable property to determine its nullability, rather than always assume it's nullable #20177

Merged
merged 1 commit into from
Mar 4, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1015,8 +1015,7 @@ protected override Expression VisitSqlFunction(SqlFunctionExpression sqlFunction

if (sqlFunctionExpression.IsNiladic)
{
// TODO: #18555
_nullable = true;
_nullable = sqlFunctionExpression.IsNullable;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can move this outside instead of repeating here and below.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

visiting arguments will override _nullable value

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, thanks for explaining - stateful visitor pattern isn't easy :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes me think again it may make sense to keep having VisitInternal returning the nullability of the visited node, and restoring _nullable to what it was when it was called. This would make it clearer to see what gets modified when.


return sqlFunctionExpression.Update(instance, sqlFunctionExpression.Arguments);
}
Expand All @@ -1027,8 +1026,7 @@ protected override Expression VisitSqlFunction(SqlFunctionExpression sqlFunction
(arguments[i], _) = VisitInternal<SqlExpression>(sqlFunctionExpression.Arguments[i]);
}

// TODO: #18555
_nullable = true;
_nullable = sqlFunctionExpression.IsNullable;

return sqlFunctionExpression.Update(instance, arguments);
}
Expand Down