dongjoon-hyun commented on a change in pull request #27778: [SPARK-31027] [SQL]
Refactor DataSourceStrategy to be more extendable
URL: https://github.com/apache/spark/pull/27778#discussion_r387294541
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceStrategy.scala
##########
@@ -437,61 +437,72 @@ object DataSourceStrategy {
}
}
+ /**
+ * Find the column name of an expression that can be pushed down.
+ */
+ private[sql] def pushDownColName(e: Expression): Option[String] = {
+ def helper(e: Expression): Option[Seq[String]] = e match {
+ case a: Attribute => Some(Seq(a.name))
+ case _ => None
+ }
+ helper(e).flatMap(_.headOption)
Review comment:
Although I know the background, shall we write like the following simpler
way in this PR?
```scala
def helper(e: Expression): Option[String] = e match {
case a: Attribute => Some(a.name)
case _ => None
}
helper(e)
```
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]