Skip to content

Conversation

taniabogatsch
Copy link
Contributor

This PR addresses one of the two bugs mentioned in #5816. list_filter would throw a runtime error when provided with non-boolean lambda expression results in nested lambdas. Now, we try to auto-cast the expression result to bool, and throw an exception if that fails.

@taniabogatsch taniabogatsch self-assigned this Feb 7, 2023
Copy link
Collaborator

@Mytherin Mytherin left a comment

Choose a reason for hiding this comment

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

Thanks for the PR!

I wonder if this cannot be solved at binding time by forcing the return type of the expression to be boolean. For regular functions this is solved by setting the arguments types - but perhaps for lambdas we need to explicitly call BoundCastExpression::AddCastToType to add the cast to the expression.

Copy link
Collaborator

@Mytherin Mytherin left a comment

Choose a reason for hiding this comment

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

Thanks! This looks a lot cleaner. One more comment:

@Mytherin Mytherin merged commit 0f0ce6d into duckdb:master Feb 10, 2023
@taniabogatsch taniabogatsch deleted the fix-lambda-bugs branch February 10, 2023 09:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants