[SERVER-71801] [CQF] Validation for strong double alias Created: 02/Dec/22  Updated: 29/Oct/23  Resolved: 09/May/23

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

Type: Improvement Priority: Major - P3
Reporter: Svilen Mihaylov (Inactive) Assignee: Chi-I Huang
Resolution: Fixed Votes: 0
Labels: bonsai-ce
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Query Optimization
Backwards Compatibility: Fully Compatible
Sprint: QO 2023-05-15
Participants:

 Description   

Follow up to SERVER-71332.

Add validation logic based on Tag (e.g. selectivity clamped to 0-1, CE >= 0)



 Comments   
Comment by Githook User [ 09/May/23 ]

Author:

{'name': 'Chi-I Huang', 'email': 'chiihuang@mongodb.com', 'username': ''}

Message: SERVER-71801 Add validation in StrongDoubleAlias constructors
Branch: master
https://github.com/mongodb/mongo/commit/f9a371951c5572769789e2731e730c36b84bf9eb

Comment by Chi-I Huang [ 03/May/23 ]

Keeping the data type StringDoubleAlias constexpr-friendly with validation is challenging. I tried 2 approaches: # Keep the strong alias constexpr -friendly. See this commit.

    1. Unfortunately, that actually doesn't compile because tassert  cannot be constexpr
    2. To make it compile, instead of asserting, maybe change it to clamping? It's sort of silencing the warning. So we will lose the visibility to capture buggy values.
  1. Move away from constexpr . See this commit
    1. Changes are pervasive. We lose the constexpr compile-time benefit.
    2. And we might need to change the function params, for instance, from CEType to const CEType&
Comment by Chi-I Huang [ 03/May/23 ]

I am working on this ticket now. Right now I am working on keeping the whole struct StrongDoubleAlias as literal type, which is trickier than I expected.

Generated at Thu Feb 08 06:20:00 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.