srielau commented on code in PR #55717:
URL: https://github.com/apache/spark/pull/55717#discussion_r3196674058


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/connector/catalog/CatalogManager.scala:
##########
@@ -138,8 +171,39 @@ class CatalogManager(
 
   private var _sessionPath: Option[Seq[SessionPathEntry]] = None
 
-  /** Returns the raw stored session path entries, or None if no path is set. 
*/
-  def sessionPathEntries: Option[Seq[SessionPathEntry]] = synchronized { 
_sessionPath }
+  /**
+   * Returns the effective session path entries: the explicit `SET PATH` value 
if stored,
+   * else the parsed [[SQLConf.DEFAULT_PATH]] conf if non-empty (mirroring how
+   * [[currentCatalog]] falls back to [[SQLConf.DEFAULT_CATALOG]]). Returns 
`None` when
+   * [[SQLConf.PATH_ENABLED]] is false or both sources are empty.
+   */
+  def sessionPathEntries: Option[Seq[SessionPathEntry]] = synchronized {
+    if (!conf.pathEnabled) None
+    else _sessionPath.orElse(workspaceDefaultPathEntries)
+  }
+
+  /** Raw `_sessionPath` (post-`SET PATH`), without the 
[[SQLConf.DEFAULT_PATH]] fallback. */
+  def storedSessionPathEntries: Option[Seq[SessionPathEntry]] = synchronized { 
_sessionPath }
+
+  /**
+   * Parsed [[SQLConf.DEFAULT_PATH]] value, or `None` when the conf is empty / 
blank. Reuses
+   * the SET PATH grammar via [[CatalystSqlParser.parseSqlPathElements]] so 
the workspace
+   * default accepts the same syntax as `SET PATH = ...`.
+   *
+   * An inner `DEFAULT_PATH` token inside the conf value resolves to the 
spark-builtin
+   * default ordering rather than recursing back into this method (cycle 
break).
+   */
+  def workspaceDefaultPathEntries: Option[Seq[SessionPathEntry]] = {

Review Comment:
   test 196



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to