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

select user(), current_user()

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 0.13.0
    • 1.2.0
    • None
    • None
    • Hide
      Adds a UDF current_user that returns current user name
      Example -
      {code}
      hive> select current_user();
      OK
      thejas
      Time taken: 1.786 seconds, Fetched: 1 row(s)
      {code}
      Show
      Adds a UDF current_user that returns current user name Example - {code} hive> select current_user(); OK thejas Time taken: 1.786 seconds, Fetched: 1 row(s) {code}

    Description

      Feature request to add support for determining in HQL session which user I am currently connected as - an old MySQL ability:

      mysql> select user(), current_user();
      +----------------+----------------+
      | user()         | current_user() |
      +----------------+----------------+
      | root@localhost | root@localhost |
      +----------------+----------------+
      1 row in set (0.00 sec)
      

      which doesn't seem to have a counterpart in Hive at this time:

      0: jdbc:hive2://<host>:100> select user();
      Error: Error while compiling statement: FAILED: SemanticException Line 0:-1 Invalid function 'user' (state=42000,code=40000)
      0: jdbc:hive2://<host>:100> select current_user();
      Error: Error while compiling statement: FAILED: SemanticException [Error 10011]: Line 1:7 Invalid function 'current_user' (state=42000,code=10011)

      Regards,

      Hari Sekhon
      http://www.linkedin.com/in/harisekhon

      Attachments

        1. HIVE-9143.1.patch
          7 kB
          Alexander Pivovarov
        2. HIVE-9143.2.patch
          7 kB
          Alexander Pivovarov
        3. HIVE-9143.3.patch
          7 kB
          Alexander Pivovarov

        Issue Links

          Activity

            People

              apivovarov Alexander Pivovarov
              harisekhon Hari Sekhon
              Votes:
              0 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: