| Age | Commit message (Collapse) | Author |
|
Thanks to these people for pointing these out:
* Hojeong Park
* Natalia Bidart
* Sulav Raj Bista
|
|
Adding proper support for subquery right-hand-sides to TupleIn made it
obsolete.
|
|
https://github.com/psf/black/releases/tag/24.1.0
|
|
early return.
This avoids costly hashing.
Thanks Anthony Shaw for the report.
Co-Authored-By: Simon Charette <charette.s@gmail.com>
|
|
An n-ary logical XOR Q(…) ^ Q(…) ^ … ^ Q(…) should evaluate to true
when an odd number of its operands evaluate to true, not when exactly
one operand evaluates to true.
|
|
Also avoid an unnecessary pushdown when aggregating over a query that doesn't
have aggregate annotations.
|
|
Adjusting WhereNode.as_sql() to raise an exception when encoutering a
full match just like with empty matches ensures that all case are
explicitly handled.
|
|
Recent refactors allowed GROUP BY aliasing allowed for aliasing to be
entirely handled by the sql.Query.set_group_by and compiler layers.
|
|
annotations.
This reverts b64db05b9cedd96905d637a2d824cbbf428e40e7.
It was reasonable to assume it was unnecessary code as there were
no failing tests upon its removal. This commit adds the necessary
regression tests for the failing condition identified in #34024
alongside the original tests added in the PR for which
WhereNode.is_summary was introduced.
|
|
Adds support for joint predicates against window annotations through
subquery wrapping while maintaining errors for disjointed filter
attempts.
The "qualify" wording was used to refer to predicates against window
annotations as it's the name of a specialized Snowflake extension to
SQL that is to window functions what HAVING is to aggregates.
While not complete the implementation should cover most of the common
use cases for filtering against window functions without requiring
the complex subquery pushdown and predicate re-aliasing machinery to
deal with disjointed predicates against columns, aggregates, and window
functions.
A complete disjointed filtering implementation should likely be
deferred until proper QUALIFY support lands or the ORM gains a proper
subquery pushdown interface.
|
|
This allows the copy.copy() usage in the Q._combine() method to finish
sooner, instead of having to fallback to using the __reduce_ex__(4)
method.
Thia also avoids having to fall into copy.copy() at in Q._combine(),
when combining a Q() with another Q().
Co-authored-by: Keryn Knight <keryn@kerynknight.com>
|
|
We can use copy() in Node.add() instead of create() as we don't need the
children to be cloned via [:] subscript in __init__().
|
|
Node._new_instance() was added in
6dd2b5468fa275d53aa60fdcaff8c28bdc5e9c25 to work around Q.__init__()
having an incompatible signature with Node.__init__().
It was intended as a hook that could be overridden if subclasses needed
to change the behaviour of instantiation of their specialised form of
Node. In practice this doesn't ever seem to have been used for this
purpose and there are very few calls to Node._new_instance() with other
code, e.g. Node.__deepcopy__() calling Node and overriding __class__ as
required.
Rename this to Node.create() to make it a more "official" piece of
private API that we can use to simplify a lot of other areas internally.
The docstring and nearby comment have been reworded to read more
clearly.
|
|
Node.subtree_parents was removed in
d3f00bd5706b35961390d3814dd7e322ead3a9a3. That commit also added
Q.clone() which was identical to WhereNode.clone(), but lacked the
docstring. Q.clone() was later removed in
b454e2cbc95eb26fa0c32b54c53ae24fc40e8c02.
|
|
|
|
|
|
create a shallow copy of children."
This reverts commit e441847ecae99dd1ccd0d9ce76dbcff51afa863c.
A shallow copy is not enough because querysets can be reused and
evaluated in nested nodes, which shouldn't mutate JOIN aliases.
Thanks Michal Čihař for the report.
|
|
|
|
Unnecessary since its introduction in 1df89a60c5b7a28d7fda4c9ba7c07f02fd7de0fa.
|
|
QuerySet.filter().
Thanks Hannes Ljungberg and Simon Charette for reviews.
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
|
|
Co-Authored-By: Simon Charette <charette.s@gmail.com>
|
|
Thanks Gordon Wrigley for the report.
Regression in 8a6df55f2dd5131282084a4edfd48f63fbf8c69a.
|
|
Made sql.Where resolve lhs of its child nodes. This is necessary to
allow filter lookups against nested subquery expressions to properly
resolve their OuterRefs to Cols.
Thanks Oskar Persson for the simplified test case.
|
|
This makes Subquery a thin wrapper over Query and makes sure it respects
the Expression source expression API by accepting the same number of
expressions as it returns. Refs #30188.
It also makes OuterRef usable in Query without Subquery wrapping. This
should allow Query's internals to more easily perform subquery push downs
during split_exclude(). Refs #21703.
|
|
|
|
|
|
This required allowing WhereNode to be provided as When(condition).
This was made possible by cf12257db23fa248c89a3da3f718aa01a50ca659.
|
|
|
|
Thanks Josh Smeaton, Mariusz Felisiak, Sergey Fedoseev, Simon Charettes,
Adam Chainz/Johnson and Tim Graham for comments and reviews and Jamie
Cockburn for initial patch.
|
|
|
|
|
|
Thanks Travis Newport for the tests and Josh Smeaton for contributing
to the patch.
|
|
Thanks Anssi Kääriäinen for the initial patch and Anssi, Simon Charette,
and Josh Smeaton for review.
|
|
Unused since b68212f539f206679580afbfd008e7d329c9cd31.
|
|
This removes the need for some inner imports.
|
|
|
|
|
|
At the same time, made sure that empty nodes in where clause match
everything.
|
|
Instead of splitting filter clauses to where and having parts before
adding them to query.where or query.having, add all filter clauses to
query.where, and when compiling the query split the where to having and
where parts.
|
|
Thanks Anssi Kääriäinen, Marc Tamlyn, and Tim Graham for the reviews.
|
|
|
|
|
|
refs #24031
Thanks to Tim Graham and Michał Modzelewski for the review.
|
|
|
|
|
|
|
|
|
|
|
|
Thanks maciej.pawlisz for the report, and charettes for the review.
|
|
Thanks Anssi Kääriäinen for the idea and Simon Charette for the
review.
|