Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-18430

Add new determinism category for runtime constants (current_date, current_timestamp)

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.0.0
    • Component/s: UDF
    • Labels:
      None

      Description

      Add a new piece of metadata to the UDFs to specify if whether a UDF is a runtime constant. Runtime constants also exist in SQL Server, and this is similar to Postgres' concept of STABLE functions. This metadata may be useful for materialized views and query caching.

      Some Hive functions such as the ones listed below are currently labelled as deterministic, but really are runtime constants:
      current_timestamp
      current_date
      current_user
      current_database

      The values for these functions are not deterministic between different queries - for example current_timestamp will most likely be different every query executed. This makes these functions ineligible for things like materialized views or cached query results.

      However the value for the current_timestamp should not change during the life of a single query, which allows these values to be used in optimizations such as constant folding.

        Attachments

        1. HIVE-18430.2.patch
          36 kB
          Jason Dere
        2. HIVE-18430.1.patch
          33 kB
          Jason Dere

          Activity

            People

            • Assignee:
              jdere Jason Dere
              Reporter:
              jdere Jason Dere
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: