python-sql

Bug 67

classification
Title: Window functions are not append to select query for complex columns
Type: crash Severity: major
Components: Versions:
process
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: ced Nosy List: ced, roundup-bot, smn
Priority: high Keywords: patch

Created on 2020-07-31 14:18 by smn, last changed 2020-10-02 23:43 by roundup-bot.

Messages
msg105 Author: [hidden] (smn) Date: 2020-07-31 14:18
The method _window_functions[1] checks if a column is a WindowFunction or Aggregate class. But it does not consider if there is a previous Cast(), or even if the column is a division and divisor is an Aggregate with Window.


[1] https://hg.tryton.org/python-sql/file/tip/sql/__init__.py#l508
msg106 Author: [hidden] (ced) Date: 2020-07-31 15:38
I think it will be better to have the window function explicitly added to the query but keep the current discovery for backward compatibility.
msg107 Author: [hidden] (smn) Date: 2020-07-31 21:05
>  think it will be better to have the window function explicitly added to the query

LGTM, that's the solution I made in a custom class.
msg108 Author: [hidden] (smn) Date: 2020-08-01 00:30
Here is a codereview:
https://codereview.tryton.org/300231002
msg109 Author: [hidden] (ced) Date: 2020-09-29 13:42
Indeed I think explicit argument is not enough (at least to benefit in Tryton) because it requires that the code doing the select knows all the windows used.
So I think it is good to have explicit declaration so we can use aliases for them but we should fallback to set the full partition in the expression if it is not declared.
I will update the review.
msg110 Author: [hidden] (roundup-bot) Date: 2020-10-02 19:03
New changeset 6e294f1af424 by Cédric Krier in branch 'default':
Add explicit window functions to Select
https://hg.tryton.org/public/python-sql/rev/6e294f1af424
msg111 Author: [hidden] (roundup-bot) Date: 2020-10-02 23:43
New changeset 6e294f1af424 by Cédric Krier in branch 'default':
Add explicit window functions to Select
https://hg.tryton.org/python-sql/rev/6e294f1af424
History
Date User Action Args
2020-10-02 23:43:47roundup-botsetstatus: pending -> closed
messages: + msg111
2020-10-02 19:03:10roundup-botsetstatus: open -> pending
nosy: + roundup-bot
messages: + msg110
2020-09-30 13:54:19cedsetkeywords: + patch
2020-09-30 13:54:11cedsetstatus: pending -> open
type: crash
severity: major
2020-09-29 13:44:32cedsetpriority: high
2020-09-29 13:42:46cedsetstatus: new -> pending
assignee: ced
messages: + msg109
2020-08-01 00:30:48smnsetmessages: + msg108
2020-07-31 21:05:25smnsetmessages: + msg107
2020-07-31 15:38:49cedsetnosy: + ced
messages: + msg106
2020-07-31 14:18:29smncreate