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

    https://github.com/apache/spark/pull/10409#discussion_r48225925
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/jdbc/JDBCRDD.scala
 ---
    @@ -262,40 +291,12 @@ private[sql] class JDBCRDD(
         if (sb.length == 0) "1" else sb.substring(1)
       }
     
    -  /**
    -   * Converts value to SQL expression.
    -   */
    -  private def compileValue(value: Any): Any = value match {
    -    case stringValue: String => s"'${escapeSql(stringValue)}'"
    -    case timestampValue: Timestamp => "'" + timestampValue + "'"
    -    case dateValue: Date => "'" + dateValue + "'"
    -    case _ => value
    -  }
    -
    -  private def escapeSql(value: String): String =
    -    if (value == null) null else StringUtils.replace(value, "'", "''")
    -
    -  /**
    -   * Turns a single Filter into a String representing a SQL expression.
    -   * Returns null for an unhandled filter.
    -   */
    -  private def compileFilter(f: Filter): String = f match {
    -    case EqualTo(attr, value) => s"$attr = ${compileValue(value)}"
    -    case Not(EqualTo(attr, value)) => s"$attr != ${compileValue(value)}"
    -    case LessThan(attr, value) => s"$attr < ${compileValue(value)}"
    -    case GreaterThan(attr, value) => s"$attr > ${compileValue(value)}"
    -    case LessThanOrEqual(attr, value) => s"$attr <= ${compileValue(value)}"
    -    case GreaterThanOrEqual(attr, value) => s"$attr >= 
${compileValue(value)}"
    -    case IsNull(attr) => s"$attr IS NULL"
    -    case IsNotNull(attr) => s"$attr IS NOT NULL"
    -    case _ => null
    -  }
     
       /**
        * `filters`, but as a WHERE clause suitable for injection into a SQL 
query.
        */
       private val filterWhereClause: String = {
    -    val filterStrings = filters map compileFilter filter (_ != null)
    +    val filterStrings = filters map JDBCRDD.compileFilter filter (_ != 
null)
    --- End diff --
    
    Okay


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