[SERVER-51563] Support expression $trim in SBE Created: 14/Oct/20  Updated: 29/Oct/23  Resolved: 11/Jul/23

Status: Closed
Project: Core Server
Component/s: Querying
Affects Version/s: None
Fix Version/s: 7.1.0-rc0

Type: Task Priority: Major - P3
Reporter: Anton Korshunov Assignee: Prithwish Dan (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Problem/Incident
Related
related to SERVER-79595 Add C++ benchmarks for $trunc, $trim,... Closed
Assigned Teams:
Query Execution
Backwards Compatibility: Fully Compatible
Sprint: QE 2023-06-26, QE 2023-07-10, QE 2023-07-24
Participants:
Linked BF Score: 160

 Description   

Classic Engine Evaluation Semantics (vs. failing SBE Semantics):

  • If 'input' is nullish, return a null value (SBE - checked in the builtinTrim function)
  • else if 'input' is not null but is a non-string value, throw an error (SBE - throws an error assuming previous condition is validated)
  • else if 'chars' is not provided, trim with default whitespace characters (SBE - trims with default whitespace characters)
  • else if 'chars' is provided and null, return a null value (SBE INCORRECT - treats this as the same as not providing it at all)
  • else if 'chars' is provided and not a string, throw an error (SBE - throws an error)
  • else perform trim on 'input' with 'chars' (SBE - trims with 'chars')

Fix: Treat null 'chars' as different from no 'chars' given and make sure null 'input' is checking before !isString (completed)



 Comments   
Comment by Githook User [ 11/Jul/23 ]

Author:

{'name': 'Prithwish Dan', 'email': 'prithwish.dan@mongodb.com', 'username': 'pdan-mongodb'}

Message: SERVER-51563 Modified SBE $trim logic to be consistent with classic engine
Branch: master
https://github.com/mongodb/mongo/commit/d759e2d0657960e07df1d6bff77c64ee6f1c9eca

Comment by Githook User [ 06/Jul/23 ]

Author:

{'name': 'Prithwish Dan', 'email': 'prithwish.dan@mongodb.com', 'username': 'pdan-mongodb'}

Message: SERVER-51563 Reverted SBE compatibility for $trim to incompatible
Branch: master
https://github.com/mongodb/mongo/commit/134fca13478861ef85395590e1c356efd5660fcd

Comment by Githook User [ 05/Jul/23 ]

Author:

{'name': 'Prithwish Dan', 'email': 'prithwish.dan@mongodb.com', 'username': 'pdan-mongodb'}

Message: SERVER-51563 Support expression $trim in SBE
Branch: master
https://github.com/mongodb/mongo/commit/ba2bde3cf21560a2b78ac70d71088ce8785fdf21

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