PyPika is a python SQL query builder that exposes the full richness of the SQL language using a syntax that reflects the resulting query. PyPika excels at all sorts of SQL queries but is especially useful for data analysis.
https://github.com/kayak/pypika/blob/30574f997c80851f7e940ad09a63e14a98871dd3/pypika/queries.py#L606-L611
Here, set_operation operator is UNION and _set_operation_query itself could be a _SetOperation type instead of QueryBuilder which gives error when len() is applied on set_operation_query._selects. Hence, the above codelines should be fixed so that it doesn't give below error when UNION is performed on 2 _SetOperation queries.
if len(self.base_query._selects) != len(set_operation_query._selects):
TypeError: object of type 'Field' has no len()
Please refer below screenshot for steps to reproduce the issue.
Note : Typecheck on input parameter set_operation is needed here.
https://github.com/kayak/pypika/blob/30574f997c80851f7e940ad09a63e14a98871dd3/pypika/queries.py#L606-L611 Here, set_operation operator is UNION and _set_operation_query itself could be a _SetOperation type instead of QueryBuilder which gives error when len() is applied on set_operation_query._selects. Hence, the above codelines should be fixed so that it doesn't give below error when UNION is performed on 2 _SetOperation queries.
Please refer below screenshot for steps to reproduce the issue.
Note : Typecheck on input parameter set_operation is needed here.