[SERVER-56849] Improve error reporting for $setWindowFields Created: 11/May/21  Updated: 25/Feb/22  Resolved: 07/Jun/21

Status: Closed
Project: Core Server
Component/s: Query Parsing
Affects Version/s: None
Fix Version/s: 5.1.0-rc0

Type: Task Priority: Major - P3
Reporter: Ruslan Abdulkhalikov (Inactive) Assignee: Maddie Zechar
Resolution: Done Votes: 0
Labels: neweng
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Sprint: Query Optimization 2021-05-31, Query Optimization 2021-06-14
Participants:

 Description   

db.blah.aggregate([{$setWindowFields ...
					"obj" : {
						"$shift" : {
							"output" : {
								"$mergeObjects" : [
									"$obj.obj.obj.obj"
								]
...

fails with "errmsg" : "Unrecognized window function"
It should report tried candidates, in this case "$shift"



 Comments   
Comment by Maddie Zechar [ 07/Jun/21 ]

commit queue merge patch succeeded https://spruce.mongodb.com/version/60be4ca1a4cf4749c8188c44/tasks?sorts=STATUS%3AASC%3BBASE_STATUS%3ADESC

Comment by Githook User [ 07/Jun/21 ]

Author:

{'name': 'Maddie Zechar', 'email': 'mez2113@columbia.edu', 'username': 'madelinezec'}

Message: SERVER-56849: Improve error reporting for $setWindowFields
Branch: master
https://github.com/mongodb/mongo/commit/3d4e1c0aa3e446c7f6cbb90b703f33ac25283d53

Comment by David Percy [ 20/May/21 ]

It should probably also tell you what the unrecognized window function is. For example:

db.blah.aggregate({$setWindowFields: {
    output: {
        a: {
            b: {$sum ...}
        }
    }
}})

The parser is expecting "output: { <field name>: <window function> }", so in this example it would fail because it sees "b" where it expected a window function. A better error might say something like "No such window function "b", choices were ...". We could also see what $group does.

Generated at Thu Feb 08 05:40:21 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.