Github user dongjoon-hyun commented on a diff in the pull request:

    https://github.com/apache/spark/pull/17266#discussion_r105572627
  
    --- Diff: 
sql/hive/src/main/scala/org/apache/spark/sql/hive/client/HiveShim.scala ---
    @@ -566,13 +566,24 @@ private[client] class Shim_v0_13 extends Shim_v0_12 {
             s"$v ${op.symbol} ${a.name}"
           case op @ BinaryComparison(a: Attribute, Literal(v, _: StringType))
               if !varcharKeys.contains(a.name) =>
    -        s"""${a.name} ${op.symbol} "$v""""
    +        s"""${a.name} ${op.symbol} ${quoteStringLiteral(v.toString)}"""
           case op @ BinaryComparison(Literal(v, _: StringType), a: Attribute)
               if !varcharKeys.contains(a.name) =>
    -        s""""$v" ${op.symbol} ${a.name}"""
    +        s"""${quoteStringLiteral(v.toString)} ${op.symbol} ${a.name}"""
         }.mkString(" and ")
       }
     
    +  private def quoteStringLiteral(str: String): String = {
    +    if (!str.contains("\"")) {
    +      s""""$str""""
    +    } else if (!str.contains("'")) {
    +      s"""'$str'"""
    +    } else {
    +      throw new UnsupportedOperationException(
    +        """Partition filter cannot have both `"` and `'` characters""")
    --- End diff --
    
    Does that return the correct result?


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