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 Analytic orderBy and partitionBy to follow the SQL documentation #4602
Conversation
This change is required to do more advanced `row_number,dense_rank, or rank` without doing weird workarounds, as you are not allowed to change the sorting order with the current behavior being ascending only.
Thank you for your contribution! Could you please add integration test for this? |
@wolfcomp Can I help you with writing a test? |
Currently writing the tests. Im also adding it into the |
get to many test errors due to not being connected to a database
@kibertoad if you could start the workflows believe it should work as i cant see it in my terminal window due to me not being able to setup sql server connections on the network im on currently |
Im unsure to why its saying that the formatter is undefined for columnize as the ones that fails seems to have the formatter set. |
formater -> formatter |
🤦 |
Now it should work surprised that I haven't had any errors my self. |
Actually there seems to still be an error as in the project that I use this I did function and not object assign on the parameter. |
@kibertoad now it should all be fixed from what I can see in my terminal window |
@@ -7854,6 +7854,29 @@ describe('QueryBuilder', () => { | |||
); | |||
}); | |||
|
|||
it('row_number with object', function () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you also add an integration test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can try to look into it, haven't really written integration tests before, probably will just copy one of the other ones and get it to fit the function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kibertoad after looking through the test/integration
folder, I can't find anything previously for rowNumber
, denseRank
, rank
in any of the files, so I'm unsure of how I should do it in that case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right, we only have unit tests for analytic functions now
@wolfcomp Are TS types correct now? Could you add a tsd test for this case? |
I can check if the ts files are correct if not correct them fast |
There seems to be no tsd tests for analytic functions at all from what I can find. |
@kibertoad this is what the best I can do from what I can find in the files when it comes to already existing code for testing and documenting knex/documentation#333 the added and corrected functionality |
Released in 0.95.11 |
This is a little annoyance I found while writing query calls using
rowNumber
as the typescript types shows you are allowed to do this but if you try to use an array of objects the SQL request fail withcolumn ?? does not exist
where ?? is the array of objects columnized.