Optimize parseTimeUnit() for date expressions

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Fixed
    • Priority: Major - P3
    • 6.1.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Fully Compatible
    • QE 2022-07-11, QE 2022-07-25, QE 2022-08-08
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      The parseTimeUnit() is an expensive operation, which is on the hot path for ExpressionDateDiff and ExpressionDateTrunc. In most queries the time unit is specified as a constant in the query. So the parseTimeUnit() can be invoked during the Expression::optimize() and stored as a member variable. Additionally, the parseTimeUnit() does an extra lookup in the timeUnitNameToTimeUnitMap hash map, which can be avoided.

        1. out.svg
          131 kB

              Assignee:
              Alberto Massari
              Reporter:
              Rui Liu
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: