[SERVER-49852] [SBE] Using dot notation with numeric field names (ex. "a.0") is broken in some cases Created: 24/Jul/20  Updated: 06/Dec/22

Status: Backlog
Project: Core Server
Component/s: Querying
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Drew Paroski Assignee: Backlog - Query Execution
Resolution: Unresolved Votes: 0
Labels: qexec-team, sbe-post-v1
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by SERVER-49859 ☂️ Implement positional projection op... Closed
Related
is related to SERVER-54405 Use classic engine for queries with n... Closed
Assigned Teams:
Query Execution
Operating System: ALL
Steps To Reproduce:

 

> db.c.find({}, {_id: 0})
{ "a" : 42 }
{ "a" : [ 42 ] }
{ "a" : { "0" : 42 } }
{ "a" : [ [ 42 ] ] }
{ "a" : [ { "0" : 42 } ] }
{ "a" : { "0" : [ 42 ] } }
{ "a" : { "0" : { "0" : 42 } } }
{ "a" : [ [ [ 42 ] ] ] }
{ "a" : [ [ { "0" : 42 } ] ] }
{ "a" : [ { "0" : [ 42 ] } ] }
{ "a" : [ { "0" : { "0" : 42 } } ] }
{ "a" : { "0" : [ [ 42 ] ] } }
{ "a" : { "0" : [ { "0" : 42 } ] } }
{ "a" : { "0" : { "0" : [ 42 ] } } }
{ "a" : { "0" : { "0" : { "0" : 42 } } } }
{ "a" : [ [ [ [ 42 ] ] ] ] }
{ "a" : [ [ [ { "0" : 42 } ] ] ] }
{ "a" : [ [ { "0" : [ 42 ] } ] ] }
{ "a" : [ [ { "0" : { "0" : 42 } } ] ] }
{ "a" : [ { "0" : [ [ 42 ] ] } ] }
{ "a" : [ { "0" : [ { "0" : 42 } ] } ] }
{ "a" : [ { "0" : { "0" : [ 42 ] } } ] }
{ "a" : [ { "0" : { "0" : { "0" : 42 } } } ] }
{ "a" : { "0" : [ [ [ 42 ] ] ] } }
{ "a" : { "0" : [ [ { "0" : 42 } ] ] } }
{ "a" : { "0" : [ { "0" : [ 42 ] } ] } }
{ "a" : { "0" : [ { "0" : { "0" : 42 } } ] } }
{ "a" : { "0" : { "0" : [ [ 42 ] ] } } }
{ "a" : { "0" : { "0" : [ { "0" : 42 } ] } } }
{ "a" : { "0" : { "0" : { "0" : [ 42 ] } } } }
{ "a" : { "0" : { "0" : { "0" : { "0" : 42 } } } } }

> db.adminCommand({setParameter: 1, internalQueryEnableSlotBasedExecutionEngine: false})
{ "was" : false, "ok" : 1 }
> db.c.find({"a.0": 42}, {_id:0})
{ "a" : [ 42 ] }
{ "a" : { "0" : 42 } }
{ "a" : [ { "0" : 42 } ] }
{ "a" : { "0" : [ 42 ] } }
{ "a" : [ { "0" : [ 42 ] } ] }
> db.c.find({"a.0.0": 42}, {_id:0})
{ "a" : [ [ 42 ] ] }
{ "a" : [ { "0" : 42 } ] }
{ "a" : { "0" : [ 42 ] } }
{ "a" : { "0" : { "0" : 42 } } }
{ "a" : [ [ { "0" : 42 } ] ] }
{ "a" : [ { "0" : [ 42 ] } ] }
{ "a" : [ { "0" : { "0" : 42 } } ] }
{ "a" : { "0" : [ { "0" : 42 } ] } }
{ "a" : { "0" : { "0" : [ 42 ] } } }
{ "a" : [ [ { "0" : [ 42 ] } ] ] }
{ "a" : [ { "0" : [ { "0" : 42 } ] } ] }
{ "a" : [ { "0" : { "0" : [ 42 ] } } ] }
{ "a" : { "0" : [ { "0" : [ 42 ] } ] } }

> db.adminCommand({setParameter: 1, internalQueryEnableSlotBasedExecutionEngine: true})
{ "was" : false, "ok" : 1 }
> db.c.find({"a.0": 42}, {_id:0})
{ "a" : { "0" : 42 } }
{ "a" : [ { "0" : 42 } ] }
{ "a" : { "0" : [ 42 ] } }
{ "a" : [ { "0" : [ 42 ] } ] }
> db.c.find({"a.0.0": 42}, {_id:0})
{ "a" : { "0" : { "0" : 42 } } }
{ "a" : [ { "0" : { "0" : 42 } } ] }
{ "a" : { "0" : [ { "0" : 42 } ] } }
{ "a" : { "0" : { "0" : [ 42 ] } } }
{ "a" : [ { "0" : [ { "0" : 42 } ] } ] }
{ "a" : [ { "0" : { "0" : [ 42 ] } } ] }
{ "a" : { "0" : [ { "0" : [ 42 ] } ] } }

 

 

Sprint: Query 2020-11-02, Query 2020-11-30, Query 2020-12-14, Query 2020-12-28, Query 2021-01-11, Query 2021-01-25
Participants:

 Description   

When SBE mode is enabled, I noticed that when dot notation with numeric field names (ex. "a.0") is used with the find() command it doesn't always return correct results. (This came up while I was working on SERVER-49686 and doing some testing.)

See the "Steps To Reproduce" section for a specific example. It looks like some sort of special handling is required when a field name is numeric.



 Comments   
Comment by Drew Paroski [ 27/Jul/20 ]

David and I talked about this ticket offline. Per David's request, I've closed SERVER-49859 as a duplicate.

Comment by David Storch [ 24/Jul/20 ]

andrew.paroski yeah, we haven't done the work to handle so-called "positional path components" yet. This is tracked by SERVER-49859. It could be a tricky topic.

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