-
Notifications
You must be signed in to change notification settings - Fork 706
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
Fix: make some SQL builders pure #1526
Conversation
can you double check and_, not_, or_ and, and paren? |
Yeah will take a look, thanks for reviewing |
>>> import sqlglot
>>> c = sqlglot.exp.Condition(this="x")
>>> a = sqlglot.exp.and_(c, "true")
>>> id(a.this)
4368906528
>>> id(c)
4368906528 Should we add a |
@georgesittas yes, and i'd just double check where it's used and see if we need to put false |
Got it, will look into this soon |
@tobymao can you take another look? Fixed a couple of TPC-DS tests that broke due to these changes. For example, check this part in TPC-DS 53. From what I can understand, the optimizer converts this disjunctive normal form to conjunctive, using the distributive property of the OR / AND operators. The current diff can be seen here. We previously had 7 clauses combined through conjunction in the optimized query, but I think we need 9 of them (the other 2 shown in the diff). A small proof of this claim:
If we substitute The other TPC-DS test had a similar issue. |
* Fix: make some SQL builders pure * Fixup * Fixup * Fixup * Comment * PR feedback, replace slice syntax with .between(low, high, ..) * Add copy arg to some methods, fix tests * Add copy flag to paren too * Use convert instead of maybe_parse for between helper * Fix test * Change isin so that it receives t.Any for expressions
No description provided.