You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by sarutak <gi...@git.apache.org> on 2014/10/23 12:14:15 UTC

[GitHub] spark pull request: [SPARK-4061] We cannot use EOL character in th...

GitHub user sarutak opened a pull request:

    https://github.com/apache/spark/pull/2908

    [SPARK-4061] We cannot use EOL character in the operand of LIKE predicate.

    We cannot use EOL character like \n or \r in the operand of LIKE predicate.
    So following condition is never true.
    
        -- someStr is 'hoge\nfuga'
        where someStr LIKE 'hoge_fuga'
    


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/sarutak/spark spark-sql-like-match-modification

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/2908.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #2908
    
----
commit 38f66519ae95ec5d41705fc7777499e2cd658de4
Author: Kousuke Saruta <sa...@oss.nttdata.co.jp>
Date:   2014-10-23T10:07:14Z

    Fixed LIKE predicate so that we can use EOL character as in a operand

----


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


[GitHub] spark pull request: [SPARK-4061][SQL] We cannot use EOL character ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/2908#issuecomment-60475796
  
      [Test build #22205 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/22205/consoleFull) for   PR 2908 at commit [`1051dd0`](https://github.com/apache/spark/commit/1051dd08e2c5ac6aead100404da4139136a42f0a).
     * This patch **fails Spark unit tests**.
     * This patch merges cleanly.
     * This patch adds no public classes.


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


[GitHub] spark pull request: [SPARK-4061][SQL] We cannot use EOL character ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/2908#issuecomment-60536953
  
      [Test build #22260 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/22260/consoleFull) for   PR 2908 at commit [`d15798b`](https://github.com/apache/spark/commit/d15798bc99f816d7c07da9f4c57ff53cb7ce3111).
     * This patch **passes all tests**.
     * This patch merges cleanly.
     * This patch adds no public classes.


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


[GitHub] spark pull request: [SPARK-4061][SQL] We cannot use EOL character ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/2908#issuecomment-60476953
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/22214/
    Test FAILed.


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


[GitHub] spark pull request: [SPARK-4061][SQL] We cannot use EOL character ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/2908#issuecomment-60537003
  
      [Test build #464 has finished](https://amplab.cs.berkeley.edu/jenkins/job/NewSparkPullRequestBuilder/464/consoleFull) for   PR 2908 at commit [`d15798b`](https://github.com/apache/spark/commit/d15798bc99f816d7c07da9f4c57ff53cb7ce3111).
     * This patch **passes all tests**.
     * This patch merges cleanly.
     * This patch adds no public classes.


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


[GitHub] spark pull request: [SPARK-4061][SQL] We cannot use EOL character ...

Posted by liancheng <gi...@git.apache.org>.
Github user liancheng commented on a diff in the pull request:

    https://github.com/apache/spark/pull/2908#discussion_r19327725
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/stringOperations.scala ---
    @@ -102,31 +102,27 @@ case class Like(left: Expression, right: Expression)
     
       // replace the _ with .{1} exactly match 1 time of any character
       // replace the % with .*, match 0 or more times with any character
    -  override def escape(v: String) = {
    -    val sb = new StringBuilder()
    -    var i = 0;
    -    while (i < v.length) {
    -      // Make a special case for "\\_" and "\\%"
    -      val n = v.charAt(i);
    -      if (n == '\\' && i + 1 < v.length && (v.charAt(i + 1) == '_' || v.charAt(i + 1) == '%')) {
    -        sb.append(v.charAt(i + 1))
    -        i += 1
    -      } else {
    -        if (n == '_') {
    -          sb.append(".");
    -        } else if (n == '%') {
    -          sb.append(".*");
    -        } else {
    -          sb.append(Pattern.quote(Character.toString(n)));
    -        }
    -      }
    -
    -      i += 1
    +  override def escape(v: String) =
    +    if (!v.isEmpty) {
    --- End diff --
    
    Ah, good catch for the empty case...


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


[GitHub] spark pull request: [SPARK-4061][SQL] We cannot use EOL character ...

Posted by liancheng <gi...@git.apache.org>.
Github user liancheng commented on the pull request:

    https://github.com/apache/spark/pull/2908#issuecomment-60361563
  
    LGTM, thanks for fixing this!


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


[GitHub] spark pull request: [SPARK-4061][SQL] We cannot use EOL character ...

Posted by sarutak <gi...@git.apache.org>.
Github user sarutak commented on a diff in the pull request:

    https://github.com/apache/spark/pull/2908#discussion_r19328446
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/stringOperations.scala ---
    @@ -102,31 +102,27 @@ case class Like(left: Expression, right: Expression)
     
       // replace the _ with .{1} exactly match 1 time of any character
       // replace the % with .*, match 0 or more times with any character
    -  override def escape(v: String) = {
    -    val sb = new StringBuilder()
    -    var i = 0;
    -    while (i < v.length) {
    -      // Make a special case for "\\_" and "\\%"
    -      val n = v.charAt(i);
    -      if (n == '\\' && i + 1 < v.length && (v.charAt(i + 1) == '_' || v.charAt(i + 1) == '%')) {
    -        sb.append(v.charAt(i + 1))
    -        i += 1
    -      } else {
    -        if (n == '_') {
    -          sb.append(".");
    -        } else if (n == '%') {
    -          sb.append(".*");
    -        } else {
    -          sb.append(Pattern.quote(Character.toString(n)));
    -        }
    -      }
    -
    -      i += 1
    +  override def escape(v: String) =
    +    if (!v.isEmpty) {
    +      "(?s)" + (' ' +: v.init).zip(v).flatMap {
    +        case (prev, '\\') => ""
    +        case ('\\', c) =>
    +          c match {
    +            case '_' => "_"
    +            case '%' => "%"
    +            case _ => Pattern.quote("\\" + c)
    --- End diff --
    
    No problem, thanks for your suggestion.


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


[GitHub] spark pull request: [SPARK-4061][SQL] We cannot use EOL character ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/2908#issuecomment-60518982
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/22245/
    Test FAILed.


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


[GitHub] spark pull request: [SPARK-4061][SQL] We cannot use EOL character ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/2908#issuecomment-60476285
  
      [Test build #22214 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/22214/consoleFull) for   PR 2908 at commit [`1051dd0`](https://github.com/apache/spark/commit/1051dd08e2c5ac6aead100404da4139136a42f0a).
     * This patch merges cleanly.


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


[GitHub] spark pull request: [SPARK-4061][SQL] We cannot use EOL character ...

Posted by sarutak <gi...@git.apache.org>.
Github user sarutak commented on the pull request:

    https://github.com/apache/spark/pull/2908#issuecomment-60528480
  
    Thanks, I'll try to create another branch from master and then push.


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


[GitHub] spark pull request: [SPARK-4061][SQL] We cannot use EOL character ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/2908#issuecomment-60533145
  
      [Test build #453 has started](https://amplab.cs.berkeley.edu/jenkins/job/NewSparkPullRequestBuilder/453/consoleFull) for   PR 2908 at commit [`f99a2f4`](https://github.com/apache/spark/commit/f99a2f4ff1d5464d37687264280bf8d1bf775e7e).
     * This patch merges cleanly.


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


[GitHub] spark pull request: [SPARK-4061][SQL] We cannot use EOL character ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/2908#issuecomment-60536955
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/22260/
    Test PASSed.


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


[GitHub] spark pull request: [SPARK-4061][SQL] We cannot use EOL character ...

Posted by sarutak <gi...@git.apache.org>.
Github user sarutak commented on the pull request:

    https://github.com/apache/spark/pull/2908#issuecomment-60349437
  
    Thanks @liancheng ! I've refactored and added test cases.


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


[GitHub] spark pull request: [SPARK-4061][SQL] We cannot use EOL character ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/2908#issuecomment-60517725
  
      [Test build #22243 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/22243/consoleFull) for   PR 2908 at commit [`1051dd0`](https://github.com/apache/spark/commit/1051dd08e2c5ac6aead100404da4139136a42f0a).
     * This patch **fails Spark unit tests**.
     * This patch merges cleanly.
     * This patch adds no public classes.


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


[GitHub] spark pull request: [SPARK-4061][SQL] We cannot use EOL character ...

Posted by marmbrus <gi...@git.apache.org>.
Github user marmbrus commented on the pull request:

    https://github.com/apache/spark/pull/2908#issuecomment-60538119
  
    Thanks for working on this!  Merged to master.


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


[GitHub] spark pull request: [SPARK-4061] We cannot use EOL character in th...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/2908#issuecomment-60218997
  
      [QA tests have started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/22069/consoleFull) for   PR 2908 at commit [`38f6651`](https://github.com/apache/spark/commit/38f66519ae95ec5d41705fc7777499e2cd658de4).
     * This patch merges cleanly.


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


[GitHub] spark pull request: [SPARK-4061][SQL] We cannot use EOL character ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/2908#issuecomment-60357855
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/22130/
    Test PASSed.


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


[GitHub] spark pull request: [SPARK-4061] We cannot use EOL character in th...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/2908#issuecomment-60223794
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/22069/
    Test PASSed.


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


[GitHub] spark pull request: [SPARK-4061][SQL] We cannot use EOL character ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/2908#issuecomment-60349557
  
      [Test build #22121 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/22121/consoleFull) for   PR 2908 at commit [`d98c99e`](https://github.com/apache/spark/commit/d98c99eec6b8e1b765e77ece8e50c40dc38ea1ef).
     * This patch merges cleanly.


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


[GitHub] spark pull request: [SPARK-4061][SQL] We cannot use EOL character ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/2908#issuecomment-60475797
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/22205/
    Test FAILed.


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


[GitHub] spark pull request: [SPARK-4061][SQL] We cannot use EOL character ...

Posted by sarutak <gi...@git.apache.org>.
Github user sarutak commented on the pull request:

    https://github.com/apache/spark/pull/2908#issuecomment-60516815
  
    retest this please.


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


[GitHub] spark pull request: [SPARK-4061][SQL] We cannot use EOL character ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/2908#issuecomment-60532846
  
      [Test build #22254 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/22254/consoleFull) for   PR 2908 at commit [`f99a2f4`](https://github.com/apache/spark/commit/f99a2f4ff1d5464d37687264280bf8d1bf775e7e).
     * This patch **fails Spark unit tests**.
     * This patch merges cleanly.
     * This patch adds no public classes.


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


[GitHub] spark pull request: [SPARK-4061][SQL] We cannot use EOL character ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/2908#issuecomment-60531675
  
      [Test build #22254 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/22254/consoleFull) for   PR 2908 at commit [`f99a2f4`](https://github.com/apache/spark/commit/f99a2f4ff1d5464d37687264280bf8d1bf775e7e).
     * This patch merges cleanly.


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


[GitHub] spark pull request: [SPARK-4061][SQL] We cannot use EOL character ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/2908#issuecomment-60518980
  
      [Test build #22245 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/22245/consoleFull) for   PR 2908 at commit [`6bc3318`](https://github.com/apache/spark/commit/6bc3318efec3e613f69ba05d4e9a2cfd276ca786).
     * This patch **fails Spark unit tests**.
     * This patch merges cleanly.
     * This patch adds no public classes.


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


[GitHub] spark pull request: [SPARK-4061][SQL] We cannot use EOL character ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/2908#issuecomment-60351486
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/22121/
    Test FAILed.


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


[GitHub] spark pull request: [SPARK-4061][SQL] We cannot use EOL character ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/2908#issuecomment-60357849
  
      [Test build #22130 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/22130/consoleFull) for   PR 2908 at commit [`8a33f91`](https://github.com/apache/spark/commit/8a33f919a7ed56871deb626626bd887964f7bb15).
     * This patch **passes all tests**.
     * This patch merges cleanly.
     * This patch adds no public classes.


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


[GitHub] spark pull request: [SPARK-4061][SQL] We cannot use EOL character ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/2908#issuecomment-60475008
  
      [Test build #22205 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/22205/consoleFull) for   PR 2908 at commit [`1051dd0`](https://github.com/apache/spark/commit/1051dd08e2c5ac6aead100404da4139136a42f0a).
     * This patch merges cleanly.


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


[GitHub] spark pull request: [SPARK-4061][SQL] We cannot use EOL character ...

Posted by liancheng <gi...@git.apache.org>.
Github user liancheng commented on the pull request:

    https://github.com/apache/spark/pull/2908#issuecomment-60256774
  
    Good catch! Would you mind to add a unit test for this?


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


[GitHub] spark pull request: [SPARK-4061][SQL] We cannot use EOL character ...

Posted by liancheng <gi...@git.apache.org>.
Github user liancheng commented on a diff in the pull request:

    https://github.com/apache/spark/pull/2908#discussion_r19327703
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/stringOperations.scala ---
    @@ -102,31 +102,27 @@ case class Like(left: Expression, right: Expression)
     
       // replace the _ with .{1} exactly match 1 time of any character
       // replace the % with .*, match 0 or more times with any character
    -  override def escape(v: String) = {
    -    val sb = new StringBuilder()
    -    var i = 0;
    -    while (i < v.length) {
    -      // Make a special case for "\\_" and "\\%"
    -      val n = v.charAt(i);
    -      if (n == '\\' && i + 1 < v.length && (v.charAt(i + 1) == '_' || v.charAt(i + 1) == '%')) {
    -        sb.append(v.charAt(i + 1))
    -        i += 1
    -      } else {
    -        if (n == '_') {
    -          sb.append(".");
    -        } else if (n == '%') {
    -          sb.append(".*");
    -        } else {
    -          sb.append(Pattern.quote(Character.toString(n)));
    -        }
    -      }
    -
    -      i += 1
    +  override def escape(v: String) =
    +    if (!v.isEmpty) {
    +      "(?s)" + (' ' +: v.init).zip(v).flatMap {
    +        case (prev, '\\') => ""
    --- End diff --
    
    Why do we need this branch?


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


[GitHub] spark pull request: [SPARK-4061][SQL] We cannot use EOL character ...

Posted by liancheng <gi...@git.apache.org>.
Github user liancheng commented on a diff in the pull request:

    https://github.com/apache/spark/pull/2908#discussion_r19328236
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/stringOperations.scala ---
    @@ -102,31 +102,27 @@ case class Like(left: Expression, right: Expression)
     
       // replace the _ with .{1} exactly match 1 time of any character
       // replace the % with .*, match 0 or more times with any character
    -  override def escape(v: String) = {
    -    val sb = new StringBuilder()
    -    var i = 0;
    -    while (i < v.length) {
    -      // Make a special case for "\\_" and "\\%"
    -      val n = v.charAt(i);
    -      if (n == '\\' && i + 1 < v.length && (v.charAt(i + 1) == '_' || v.charAt(i + 1) == '%')) {
    -        sb.append(v.charAt(i + 1))
    -        i += 1
    -      } else {
    -        if (n == '_') {
    -          sb.append(".");
    -        } else if (n == '%') {
    -          sb.append(".*");
    -        } else {
    -          sb.append(Pattern.quote(Character.toString(n)));
    -        }
    -      }
    -
    -      i += 1
    +  override def escape(v: String) =
    +    if (!v.isEmpty) {
    +      "(?s)" + (' ' +: v.init).zip(v).flatMap {
    +        case (prev, '\\') => ""
    +        case ('\\', c) =>
    +          c match {
    +            case '_' => "_"
    +            case '%' => "%"
    +            case _ => Pattern.quote("\\" + c)
    --- End diff --
    
    Sorry for my previous wrong and misleading sample code, you're correct :)


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


[GitHub] spark pull request: [SPARK-4061][SQL] We cannot use EOL character ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/2908#issuecomment-60518095
  
      [Test build #22245 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/22245/consoleFull) for   PR 2908 at commit [`6bc3318`](https://github.com/apache/spark/commit/6bc3318efec3e613f69ba05d4e9a2cfd276ca786).
     * This patch merges cleanly.


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


[GitHub] spark pull request: [SPARK-4061][SQL] We cannot use EOL character ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/2908#issuecomment-60532848
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/22254/
    Test FAILed.


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


[GitHub] spark pull request: [SPARK-4061][SQL] We cannot use EOL character ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/2908#issuecomment-60517727
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/22243/
    Test FAILed.


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


[GitHub] spark pull request: [SPARK-4061][SQL] We cannot use EOL character ...

Posted by sarutak <gi...@git.apache.org>.
Github user sarutak commented on the pull request:

    https://github.com/apache/spark/pull/2908#issuecomment-60533477
  
    Ah, I see. It's related to #2950.


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


[GitHub] spark pull request: [SPARK-4061][SQL] We cannot use EOL character ...

Posted by liancheng <gi...@git.apache.org>.
Github user liancheng commented on a diff in the pull request:

    https://github.com/apache/spark/pull/2908#discussion_r19327837
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/stringOperations.scala ---
    @@ -102,31 +102,27 @@ case class Like(left: Expression, right: Expression)
     
       // replace the _ with .{1} exactly match 1 time of any character
       // replace the % with .*, match 0 or more times with any character
    -  override def escape(v: String) = {
    -    val sb = new StringBuilder()
    -    var i = 0;
    -    while (i < v.length) {
    -      // Make a special case for "\\_" and "\\%"
    -      val n = v.charAt(i);
    -      if (n == '\\' && i + 1 < v.length && (v.charAt(i + 1) == '_' || v.charAt(i + 1) == '%')) {
    -        sb.append(v.charAt(i + 1))
    -        i += 1
    -      } else {
    -        if (n == '_') {
    -          sb.append(".");
    -        } else if (n == '%') {
    -          sb.append(".*");
    -        } else {
    -          sb.append(Pattern.quote(Character.toString(n)));
    -        }
    -      }
    -
    -      i += 1
    +  override def escape(v: String) =
    +    if (!v.isEmpty) {
    +      "(?s)" + (' ' +: v.init).zip(v).flatMap {
    +        case (prev, '\\') => ""
    +        case ('\\', c) =>
    +          c match {
    +            case '_' => "_"
    +            case '%' => "%"
    +            case _ => Pattern.quote("\\" + c)
    --- End diff --
    
    I believe we don't need the `"\\"` here. Other wise `"\\x"` will be transformed into `"\\\\x"`.


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


[GitHub] spark pull request: [SPARK-4061] We cannot use EOL character in th...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/2908#issuecomment-60223791
  
      [QA tests have finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/22069/consoleFull) for   PR 2908 at commit [`38f6651`](https://github.com/apache/spark/commit/38f66519ae95ec5d41705fc7777499e2cd658de4).
     * This patch **passes all tests**.
     * This patch merges cleanly.
     * This patch adds no public classes.


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


[GitHub] spark pull request: [SPARK-4061][SQL] We cannot use EOL character ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/2908#issuecomment-60516907
  
      [Test build #22243 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/22243/consoleFull) for   PR 2908 at commit [`1051dd0`](https://github.com/apache/spark/commit/1051dd08e2c5ac6aead100404da4139136a42f0a).
     * This patch merges cleanly.


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


[GitHub] spark pull request: [SPARK-4061][SQL] We cannot use EOL character ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/2908#issuecomment-60535218
  
      [Test build #464 has started](https://amplab.cs.berkeley.edu/jenkins/job/NewSparkPullRequestBuilder/464/consoleFull) for   PR 2908 at commit [`d15798b`](https://github.com/apache/spark/commit/d15798bc99f816d7c07da9f4c57ff53cb7ce3111).
     * This patch merges cleanly.


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


[GitHub] spark pull request: [SPARK-4061][SQL] We cannot use EOL character ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/2908#issuecomment-60534345
  
      [Test build #453 has finished](https://amplab.cs.berkeley.edu/jenkins/job/NewSparkPullRequestBuilder/453/consoleFull) for   PR 2908 at commit [`f99a2f4`](https://github.com/apache/spark/commit/f99a2f4ff1d5464d37687264280bf8d1bf775e7e).
     * This patch **fails Spark unit tests**.
     * This patch merges cleanly.
     * This patch adds no public classes.


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


[GitHub] spark pull request: [SPARK-4061][SQL] We cannot use EOL character ...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/spark/pull/2908


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


[GitHub] spark pull request: [SPARK-4061][SQL] We cannot use EOL character ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/2908#issuecomment-60351481
  
      [Test build #22121 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/22121/consoleFull) for   PR 2908 at commit [`d98c99e`](https://github.com/apache/spark/commit/d98c99eec6b8e1b765e77ece8e50c40dc38ea1ef).
     * This patch **fails Spark unit tests**.
     * This patch merges cleanly.
     * This patch adds no public classes.


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


[GitHub] spark pull request: [SPARK-4061][SQL] We cannot use EOL character ...

Posted by JoshRosen <gi...@git.apache.org>.
Github user JoshRosen commented on the pull request:

    https://github.com/apache/spark/pull/2908#issuecomment-60524502
  
    It looks like the build configuration for the thriftserver tests may be broken, which is why they're failing:
    
    ```
    [error] Expected ID character
    [error] Not a valid command: hive-thriftserver
    [error] Expected project ID
    [error] Expected configuration
    [error] Expected ':' (if selecting a configuration)
    [error] Expected key
    [error] Not a valid key: hive-thriftserver
    [error] hive-thriftserver/test
    [error]                  ^
    [error] Got a return code of 1 on line 193 of the run-tests script.
    Archiving unit tests logs...
    ```


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


[GitHub] spark pull request: [SPARK-4061][SQL] We cannot use EOL character ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/2908#issuecomment-60476952
  
      [Test build #22214 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/22214/consoleFull) for   PR 2908 at commit [`1051dd0`](https://github.com/apache/spark/commit/1051dd08e2c5ac6aead100404da4139136a42f0a).
     * This patch **fails Spark unit tests**.
     * This patch merges cleanly.
     * This patch adds no public classes.


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


[GitHub] spark pull request: [SPARK-4061][SQL] We cannot use EOL character ...

Posted by sarutak <gi...@git.apache.org>.
Github user sarutak commented on the pull request:

    https://github.com/apache/spark/pull/2908#issuecomment-60476202
  
    retest this please.


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


[GitHub] spark pull request: [SPARK-4061][SQL] We cannot use EOL character ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/2908#issuecomment-60353571
  
      [Test build #22130 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/22130/consoleFull) for   PR 2908 at commit [`8a33f91`](https://github.com/apache/spark/commit/8a33f919a7ed56871deb626626bd887964f7bb15).
     * This patch merges cleanly.


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


[GitHub] spark pull request: [SPARK-4061][SQL] We cannot use EOL character ...

Posted by liancheng <gi...@git.apache.org>.
Github user liancheng commented on a diff in the pull request:

    https://github.com/apache/spark/pull/2908#discussion_r19328214
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/stringOperations.scala ---
    @@ -102,31 +102,27 @@ case class Like(left: Expression, right: Expression)
     
       // replace the _ with .{1} exactly match 1 time of any character
       // replace the % with .*, match 0 or more times with any character
    -  override def escape(v: String) = {
    -    val sb = new StringBuilder()
    -    var i = 0;
    -    while (i < v.length) {
    -      // Make a special case for "\\_" and "\\%"
    -      val n = v.charAt(i);
    -      if (n == '\\' && i + 1 < v.length && (v.charAt(i + 1) == '_' || v.charAt(i + 1) == '%')) {
    -        sb.append(v.charAt(i + 1))
    -        i += 1
    -      } else {
    -        if (n == '_') {
    -          sb.append(".");
    -        } else if (n == '%') {
    -          sb.append(".*");
    -        } else {
    -          sb.append(Pattern.quote(Character.toString(n)));
    -        }
    -      }
    -
    -      i += 1
    +  override def escape(v: String) =
    +    if (!v.isEmpty) {
    +      "(?s)" + (' ' +: v.init).zip(v).flatMap {
    +        case (prev, '\\') => ""
    --- End diff --
    
    Ah, I see, we need to remove leading `\\`.


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


[GitHub] spark pull request: [SPARK-4061][SQL] We cannot use EOL character ...

Posted by liancheng <gi...@git.apache.org>.
Github user liancheng commented on a diff in the pull request:

    https://github.com/apache/spark/pull/2908#discussion_r19284542
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/stringOperations.scala ---
    @@ -103,21 +103,21 @@ case class Like(left: Expression, right: Expression)
       // replace the _ with .{1} exactly match 1 time of any character
       // replace the % with .*, match 0 or more times with any character
       override def escape(v: String) = {
    -    val sb = new StringBuilder()
    -    var i = 0;
    +    val sb = new StringBuilder("""(?s)""")
    +    var i = 0
         while (i < v.length) {
           // Make a special case for "\\_" and "\\%"
    -      val n = v.charAt(i);
    +      val n = v.charAt(i)
           if (n == '\\' && i + 1 < v.length && (v.charAt(i + 1) == '_' || v.charAt(i + 1) == '%')) {
             sb.append(v.charAt(i + 1))
             i += 1
           } else {
             if (n == '_') {
    -          sb.append(".");
    +          sb.append(".")
             } else if (n == '%') {
    -          sb.append(".*");
    +          sb.append(".*")
             } else {
    -          sb.append(Pattern.quote(Character.toString(n)));
    +          sb.append(Pattern.quote(Character.toString(n)))
             }
           }
    --- End diff --
    
    I feel a little complicated about this... This function is not on critical path, so I'd like to refactor it in a more functional and readable (but less efficient) way, for example:
    
    ```scala
      override def escape(v: String) = "(?s)" + (' ' +: v.init).zip(v).flatMap {
        case (prefix, '_') => if (prefix == '\\') "_" else "."
        case (prefix, '%') => if (prefix == '\\') "%" else ".*"
        case (_, ch) => Character.toString(ch)
      }.mkString
    ```


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


[GitHub] spark pull request: [SPARK-4061][SQL] We cannot use EOL character ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/2908#issuecomment-60533825
  
      [Test build #22260 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/22260/consoleFull) for   PR 2908 at commit [`d15798b`](https://github.com/apache/spark/commit/d15798bc99f816d7c07da9f4c57ff53cb7ce3111).
     * This patch merges cleanly.


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