Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-26929

table owner should use user instead of principal when use kerberos

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.3.0, 2.3.1, 2.3.2, 2.3.3, 2.4.0
    • 3.0.0
    • SQL
    • None

    Description

      In kerberos cluster, when use spark-sql or beeline to create table,  the owner will be whole info of principal. the issue  was fixed in SPARK-19970 and modify by SPARK-22846, so it occur again. It will causes some problems when using role., and this time should resolved two issues together.

      Use  org.apache.hadoop.hive.shims.Utils.getUGI  directly to get ugi.getShortUserName

      instead of use  conf.getUser which return principal info.

      Code change

      private val userName: String = try {
      val ugi = HiveUtils.getUGI
      ugi.getShortUserName
      } catch {
      case e: LoginException => throw new IOException(e)
      }
      

      Berfore

      scala> sql("create table t(a int)").show
       scala> sql("desc formatted t").show(false)
       ...
      |Owner:|spark@EXAMPLE.COM| |
      

      After:

       scala> sql("create table t(a int)").show
       scala> sql("desc formatted t").show(false)
       ...
      |Owner:|spark| |
      

      Attachments

        Issue Links

          Activity

            People

              hongdongdong hong dongdong
              hongdongdong hong dongdong
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: