Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-102703

Investigate behavior of reversed sort order for $minMaxScaler

    • Type: Icon: Task Task
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Integration
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Right now we assume in the $minMaxScaler window function that is always sorted in ascending order ({_id/$x: 1}).

      We also enforce that the document / range based bounds are such that the left bound is never positive, and the right bound is never positive (here)]

      We should investigate in the behavior of specifying a sorting spec on a field in descending order ({_id/$x: -1}). What happens?

      • does the query fail (properly?)
      • does it run and produce incorrect results?

      Its possible that the properly logic/enforcement is provided at the $setWindowFields level and no action is needed. Its possible, but unclear if we can remove the logic in at: https://github.com/10gen/mongo/blob/f391c90af149efd9bb7fd928b3f9e1e2076f6dc2/src/mongo/db/pipeline/window_function/window_function_expression.cpp#L380)]

       

      Ultimately, we the behavior of $minMaxScaler should be in line with other window functions, as this question is not specific to $minMaxScaler (but we need to ensure were releasing this new window function with the expected behavior). We should run other window functions with a reversed sort order and observe the behavior.

       

      Also, add the appropriate test cases (either expecting failure, or expecting correct results) to min_max_scaler_parsing.js / min_max_scaler_output_values.js.

       

      Its possible that the behavior is different between Document and Range based bounds. See related ticket: SERVER-56450

            Assignee:
            Unassigned Unassigned
            Reporter:
            joseph.shalabi@mongodb.com Joe Shalabi
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: