gaborgsomogyi commented on a change in pull request #27637: [SPARK-30874][SQL] 
Support Postgres Kerberos login in JDBC connector
URL: https://github.com/apache/spark/pull/27637#discussion_r386579806
 
 

 ##########
 File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/jdbc/JDBCOptions.scala
 ##########
 @@ -187,6 +190,22 @@ class JDBCOptions(
 
   // An option to allow/disallow pushing down predicate into JDBC data source
   val pushDownPredicate = parameters.getOrElse(JDBC_PUSHDOWN_PREDICATE, 
"true").toBoolean
+
+  // The local path of user's keytab file, which is assumed to be pre-uploaded 
to all nodes either
+  // by --files option of spark-submit or manually
+  val keytab = {
+    val keytabParam = parameters.getOrElse(JDBC_KEYTAB, null)
+    if (keytabParam != null && FilenameUtils.getPath(keytabParam).isEmpty) {
+      val result = SparkFiles.get(keytabParam)
+      logDebug(s"Keytab path found, assuming --files, file name used on 
executor: $result")
 
 Review comment:
   I've tested it with standalone and worked:
   ```
   20/03/02 19:46:10 INFO SharedState: Warehouse path is 
'file:/Users/gaborsomogyi/spark/spark-warehouse/'.
   Debug is  true storeKey false useTicketCache false useKeyTab true 
doNotPrompt false ticketCache is null isInitiator true KeyTab is 
/private/var/folders/jd/35_sh46s7zq0qc6khfw8hc800000gn/T/spark-31f93ae3-6ca5-42cb-9d52-a6b208abe525/userFiles-10b95f82-3956-448d-a8a8-ef54369757a7/user.keytab
 refreshKrb5Config is false principal is user/example....@example.com 
tryFirstPass is false useFirstPass is false storePass is false clearPass is 
false
   principal is user/example....@example.com
   Will use keytab
   Commit Succeeded 
   
   Found ticket for user/example....@example.com to go to 
krbtgt/example....@example.com expiring on Tue Mar 03 19:46:11 CET 2020
   Entered Krb5Context.initSecContext with state=STATE_NEW
   ```
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to