Github user viirya commented on a diff in the pull request:

    https://github.com/apache/spark/pull/10470#discussion_r48586143
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/jdbc/JDBCRDD.scala
 ---
    @@ -295,25 +318,17 @@ private[sql] class JDBCRDD(
       /**
        * `filters`, but as a WHERE clause suitable for injection into a SQL 
query.
        */
    -  private val filterWhereClause: String = {
    -    val filterStrings = filters.map(JDBCRDD.compileFilter).filter(_ != 
null)
    -    if (filterStrings.size > 0) {
    -      val sb = new StringBuilder("WHERE ")
    -      filterStrings.foreach(x => sb.append(x).append(" AND "))
    -      sb.substring(0, sb.length - 5)
    -    } else ""
    -  }
    +  private val filterWhereClause: Seq[Option[String]] = 
filters.map(JDBCRDD.compileFilter)
     
       /**
        * A WHERE clause representing both `filters`, if any, and the current 
partition.
        */
       private def getWhereClause(part: JDBCPartition): String = {
    -    if (part.whereClause != null && filterWhereClause.length > 0) {
    -      filterWhereClause + " AND " + part.whereClause
    -    } else if (part.whereClause != null) {
    -      "WHERE " + part.whereClause
    +    val w = 
filterWhereClause.+:(Option(part.whereClause)).flatten.mkString(" AND ")
    --- End diff --
    
    ok. I revert it back to old code with little difference for the new 
filterWhereClause.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

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

Reply via email to