Hello Spark Users, I have a UDF I wrote for use with Spark-SQL that performs a look up. In that look up, I need to get the current sql user so I can validate their permissions. I was using org.apach.spark.sql.util.Utils.getCurrentUserName() to retrieve the current active user from within the UDF but today I discovered that that call returns a different user based on the context:
select myUDF(); returns the SQL user select myUDF() from myTable <where clause>; returns the operating system (application?) user. I can provide a code example if needed, but it's just calling Utils.getCurrentUserName() from within the UDF code. Does this sound like expected behavior or a defect? Is there another way I can get the active SQL user inside a UDF? Thanks in advance, ~ Shawn PS I can't add username as a parameter to the UDF because I can't rely the user to not submit someone else's username. [OSI Logo] Shawn Lavelle Software Development OSI Digital Grid Solutions 4101 Arrowhead Drive Medina, Minnesota 55340-9457 Phone: 763 551 0559 Email: shawn.lave...@osii.com Website: www.osii.com<https://www.osii.com> [Emerson Logo] We are proud to now be a part of Emerson.