You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by dongjoon-hyun <gi...@git.apache.org> on 2017/03/13 05:21:08 UTC

[GitHub] spark pull request #17271: [SPARK-19912][SQL][NOT FOR MERGE] String literals...

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

    https://github.com/apache/spark/pull/17271#discussion_r105591776
  
    --- Diff: sql/hive/src/main/scala/org/apache/spark/sql/hive/client/HiveShim.scala ---
    @@ -566,13 +566,17 @@ 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} ${getEscapedString(v.toString)}"""
           case op @ BinaryComparison(Literal(v, _: StringType), a: Attribute)
               if !varcharKeys.contains(a.name) =>
    -        s""""$v" ${op.symbol} ${a.name}"""
    +        s"""${getEscapedString(v.toString)} ${op.symbol} ${a.name}"""
         }.mkString(" and ")
       }
     
    +  private def getEscapedString(str: String): String = {
    +    s""""${str.replaceAll("\"", "\\\"")}""""
    --- End diff --
    
    If this is different from what you thought, please let me know~


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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