anishshri-db commented on code in PR #54373:
URL: https://github.com/apache/spark/pull/54373#discussion_r2844058904
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/streaming/StreamingSourceIdentifyingName.scala:
##########
@@ -47,6 +47,32 @@ sealed trait StreamingSourceIdentifyingName {
case FlowAssigned(name) => s"""name="$name""""
case Unassigned => "name=<Unassigned>"
}
+
+ /**
+ * Extracts only user-provided names, filtering out flow-assigned or
unassigned sources.
+ * Used when narrowing to explicitly user-specified names (e.g., when
passing to DataSource).
+ *
+ * @return Some(UserProvided) if this is a user-provided name, None otherwise
Review Comment:
lets reword this a bit ?
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/streaming/StreamingSourceIdentifyingName.scala:
##########
@@ -47,6 +47,32 @@ sealed trait StreamingSourceIdentifyingName {
case FlowAssigned(name) => s"""name="$name""""
case Unassigned => "name=<Unassigned>"
}
+
+ /**
+ * Extracts only user-provided names, filtering out flow-assigned or
unassigned sources.
+ * Used when narrowing to explicitly user-specified names (e.g., when
passing to DataSource).
+ *
+ * @return Some(UserProvided) if this is a user-provided name, None otherwise
+ */
+ def toUserProvided: Option[UserProvided] = this match {
+ case up: UserProvided => Some(up)
+ case _ => None
+ }
+
+ /**
+ * Extracts the name string from named sources (UserProvided or
FlowAssigned).
+ * Returns None for Unassigned sources.
+ *
+ * Useful for pattern matching when both UserProvided and FlowAssigned
should be
+ * treated identically (e.g., when computing metadata paths or building
sourceIdMap).
+ *
+ * @return Some(name) for named sources, None for Unassigned
Review Comment:
same here
--
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]