spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [spark] dbtsai commented on a change in pull request #27778: [SPARK-31027] [SQL] Refactor DataSourceStrategy to be more extendable
Date Wed, 04 Mar 2020 03:44:54 GMT
dbtsai 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_r387434600
 
 

 ##########
 File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceStrategy.scala
 ##########
 @@ -437,61 +437,76 @@ object DataSourceStrategy {
     }
   }
 
+  /**
+   * Find the column name of an expression that can be pushed down.
+   */
+  private[sql] def pushDownColName(e: Expression): Option[String] = {
 
 Review comment:
   With 
   ```scala
   object PushDownColName {
     def unapply(e: Expression): Option[String] = {
       def helper(e: Expression) = e match {
         case a: Attribute => Some(a.name)
         case _ => None
       }
       helper(e)
     }
   }
   ```
   The following code can be written
   ```scala
       case expressions.EqualTo(PushDownColName(name), Literal(v, t)) =>
         Some(sources.EqualTo(name, convertToScala(v, t)))
   ```
   instead of 
   ```scala
       case expressions.EqualTo(e: Expression, Literal(v, t)) =>
         pushDownColName(e).map(sources.EqualTo(_, convertToScala(v, t)))
   ```
   
   I don't have strong preference about it.  What do others feel?

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

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


Mime
View raw message