You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by scwf <gi...@git.apache.org> on 2014/07/30 17:19:42 UTC

[GitHub] spark pull request: [SPARK-2752]spark sql cli should not exit when...

GitHub user scwf opened a pull request:

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

    [SPARK-2752]spark sql cli should not exit when exception

    Spark sql cli now will exit directly when we input a bad sql, fix it by catching the exception and print the error~

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

    $ git pull https://github.com/scwf/spark cli

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

    https://github.com/apache/spark/pull/1661.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 #1661
    
----
commit cc615f49c4604ca95d12b79c646de305b1743c16
Author: scwf <wangfei1.huawei.com>
Date:   2014-07-30T15:03:04Z

    spark sql cli should not exit when exception

----


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

[GitHub] spark pull request: [SPARK-2752]spark sql cli should not exit when...

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

    https://github.com/apache/spark/pull/1661#issuecomment-50829596
  
    @marmbrus Since #1686 can be a cleaner solution for this issue, let's wait a little bit before merging this one. Thanks.


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

[GitHub] spark pull request: [SPARK-2752]spark sql cli should not exit when...

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

    https://github.com/apache/spark/pull/1661#issuecomment-50920268
  
    Has this been fixed by #1686?  If so can we close it?


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

[GitHub] spark pull request: [SPARK-2752]spark sql cli should not exit when...

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

    https://github.com/apache/spark/pull/1661#discussion_r15629155
  
    --- Diff: sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLCLIDriver.scala ---
    @@ -288,33 +288,36 @@ private[hive] class SparkSQLCLIDriver extends CliDriver with Logging {
                 out.println(cmd)
               }
     
    -          ret = driver.run(cmd).getResponseCode
    -          if (ret != 0) {
    -            driver.close()
    -            return ret
    -          }
    -
    -          val res = new JArrayList[String]()
    -
    -          if (HiveConf.getBoolVar(conf, HiveConf.ConfVars.HIVE_CLI_PRINT_HEADER)) {
    -            // Print the column names.
    -            Option(driver.getSchema.getFieldSchemas).map { fields =>
    -              out.println(fields.map(_.getName).mkString("\t"))
    +          try {
    +            ret = driver.run(cmd).getResponseCode
    +            if (ret != 0) {
    +              driver.close()
    +               return ret
    --- End diff --
    
    ok,thanks


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

[GitHub] spark pull request: [SPARK-2752]spark sql cli should not exit when...

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

    https://github.com/apache/spark/pull/1661#issuecomment-50680279
  
    QA tests have started for PR 1661. This patch merges cleanly. <br>View progress: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/17486/consoleFull


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

[GitHub] spark pull request: [SPARK-2752]spark sql cli should not exit when...

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

    https://github.com/apache/spark/pull/1661#issuecomment-50679851
  
    test 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.
---

[GitHub] spark pull request: [SPARK-2752]spark sql cli should not exit when...

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

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


---
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-2752]spark sql cli should not exit when...

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

    https://github.com/apache/spark/pull/1661#issuecomment-50680382
  
    QA results for PR 1661:<br>- This patch FAILED unit tests.<br>- This patch merges cleanly<br>- This patch adds no public classes<br><br>For more information see test ouptut:<br>https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/17486/consoleFull


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

[GitHub] spark pull request: [SPARK-2752]spark sql cli should not exit when...

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

    https://github.com/apache/spark/pull/1661#discussion_r15624277
  
    --- Diff: sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLCLIDriver.scala ---
    @@ -315,6 +315,11 @@ private[hive] class SparkSQLCLIDriver extends CliDriver with Logging {
                        |${org.apache.hadoop.util.StringUtils.stringifyException(e)}
                      """.stripMargin)
                   ret = 1
    +            case e:Exception =>
    +              console.printError(
    +                s"Failed with exception ${e.getClass.getName}: ${e.getMessage}")
    --- End diff --
    
    Don't wrap if the line fits in 100 columns.


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

[GitHub] spark pull request: [SPARK-2752]spark sql cli should not exit when...

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

    https://github.com/apache/spark/pull/1661#issuecomment-50953641
  
    @marmbrus Yes, we can close this. @scwf Thanks all the same for bringing this issue to the table and working on 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.
---

[GitHub] spark pull request: [SPARK-2752]spark sql cli should not exit when...

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

    https://github.com/apache/spark/pull/1661#issuecomment-50808792
  
    QA results for PR 1661:<br>- This patch PASSES unit tests.<br>- This patch merges cleanly<br>- This patch adds no public classes<br><br>For more information see test ouptut:<br>https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/17591/consoleFull


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

[GitHub] spark pull request: [SPARK-2752]spark sql cli should not exit when...

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

    https://github.com/apache/spark/pull/1661#discussion_r15624047
  
    --- Diff: sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLCLIDriver.scala ---
    @@ -288,26 +288,26 @@ private[hive] class SparkSQLCLIDriver extends CliDriver with Logging {
                 out.println(cmd)
               }
     
    -          ret = driver.run(cmd).getResponseCode
    -          if (ret != 0) {
    -            driver.close()
    -            return ret
    -          }
    -
    -          val res = new JArrayList[String]()
    -
    -          if (HiveConf.getBoolVar(conf, HiveConf.ConfVars.HIVE_CLI_PRINT_HEADER)) {
    -            // Print the column names.
    -            Option(driver.getSchema.getFieldSchemas).map { fields =>
    -              out.println(fields.map(_.getName).mkString("\t"))
    -            }
    -          }
    -
               try {
    -            while (!out.checkError() && driver.getResults(res)) {
    -              res.foreach(out.println)
    -              res.clear()
    -            }
    +            ret = driver.run(cmd).getResponseCode
    +            if (ret != 0) {
    +              driver.close()
    +               return ret
    --- End diff --
    
    Please fix indentation from this line to line 310.


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

[GitHub] spark pull request: [SPARK-2752]spark sql cli should not exit when...

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

    https://github.com/apache/spark/pull/1661#issuecomment-50630018
  
    Can one of the admins verify this patch?


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

[GitHub] spark pull request: [SPARK-2752]spark sql cli should not exit when...

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

    https://github.com/apache/spark/pull/1661#issuecomment-50721059
  
    LGTM except some styling issues. Thanks for working on 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.
---

[GitHub] spark pull request: [SPARK-2752]spark sql cli should not exit when...

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

    https://github.com/apache/spark/pull/1661#issuecomment-50799416
  
    test 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.
---

[GitHub] spark pull request: [SPARK-2752]spark sql cli should not exit when...

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

    https://github.com/apache/spark/pull/1661#discussion_r15612315
  
    --- Diff: sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLCLIDriver.scala ---
    @@ -340,5 +345,4 @@ private[hive] class SparkSQLCLIDriver extends CliDriver with Logging {
           ret
         }
       }
    -}
    -
    +}
    --- End diff --
    
    Keep a newline at the end of the file.  Run `sbt/sbt scalastyle` to check style guideline locally.


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

[GitHub] spark pull request: [SPARK-2752]spark sql cli should not exit when...

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

    https://github.com/apache/spark/pull/1661#discussion_r15627597
  
    --- Diff: sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLCLIDriver.scala ---
    @@ -288,33 +288,36 @@ private[hive] class SparkSQLCLIDriver extends CliDriver with Logging {
                 out.println(cmd)
               }
     
    -          ret = driver.run(cmd).getResponseCode
    -          if (ret != 0) {
    -            driver.close()
    -            return ret
    -          }
    -
    -          val res = new JArrayList[String]()
    -
    -          if (HiveConf.getBoolVar(conf, HiveConf.ConfVars.HIVE_CLI_PRINT_HEADER)) {
    -            // Print the column names.
    -            Option(driver.getSchema.getFieldSchemas).map { fields =>
    -              out.println(fields.map(_.getName).mkString("\t"))
    +          try {
    +            ret = driver.run(cmd).getResponseCode
    +            if (ret != 0) {
    +              driver.close()
    +               return ret
    --- End diff --
    
    And they cause compilation failure.


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

[GitHub] spark pull request: [SPARK-2752]spark sql cli should not exit when...

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

    https://github.com/apache/spark/pull/1661#discussion_r15624254
  
    --- Diff: sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLCLIDriver.scala ---
    @@ -315,6 +315,11 @@ private[hive] class SparkSQLCLIDriver extends CliDriver with Logging {
                        |${org.apache.hadoop.util.StringUtils.stringifyException(e)}
                      """.stripMargin)
                   ret = 1
    +            case e:Exception =>
    --- End diff --
    
    Please add a space after `:`, also line 312, thanks.


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

[GitHub] spark pull request: [SPARK-2752]spark sql cli should not exit when...

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

    https://github.com/apache/spark/pull/1661#discussion_r15628242
  
    --- Diff: sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLCLIDriver.scala ---
    @@ -288,33 +288,36 @@ private[hive] class SparkSQLCLIDriver extends CliDriver with Logging {
                 out.println(cmd)
               }
     
    -          ret = driver.run(cmd).getResponseCode
    -          if (ret != 0) {
    -            driver.close()
    -            return ret
    -          }
    -
    -          val res = new JArrayList[String]()
    -
    -          if (HiveConf.getBoolVar(conf, HiveConf.ConfVars.HIVE_CLI_PRINT_HEADER)) {
    -            // Print the column names.
    -            Option(driver.getSchema.getFieldSchemas).map { fields =>
    -              out.println(fields.map(_.getName).mkString("\t"))
    +          try {
    +            ret = driver.run(cmd).getResponseCode
    +            if (ret != 0) {
    +              driver.close()
    +               return ret
                 }
    -          }
    +            val res = new JArrayList[String]()
    +
    +            if (HiveConf.getBoolVar(conf, HiveConf.ConfVars.HIVE_CLI_PRINT_HEADER)) {
    +             // Print the column names.
    +             Option(driver.getSchema.getFieldSchemas).map { fields =>
    +               out.println(fields.map(_.getName).mkString("\t"))
    +             }
    +           }
     
    -          try {
                 while (!out.checkError() && driver.getResults(res)) {
                   res.foreach(out.println)
                   res.clear()
                 }
               } catch {
    -            case e:IOException =>
    +            case e: IOException =>
    --- End diff --
    
    I think we can simply change `IOException` to `Exception` and remove the next `case e: Exception` clause to make this more concise. Also, the `stringifyException(e)` call can be useful for diagnosing SQL statements/scripts.


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

[GitHub] spark pull request: [SPARK-2752]spark sql cli should not exit when...

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

    https://github.com/apache/spark/pull/1661#issuecomment-50799873
  
    QA tests have started for PR 1661. This patch merges cleanly. <br>View progress: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/17591/consoleFull


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

[GitHub] spark pull request: [SPARK-2752]spark sql cli should not exit when...

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

    https://github.com/apache/spark/pull/1661#discussion_r15612294
  
    --- Diff: sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLCLIDriver.scala ---
    @@ -190,12 +190,12 @@ private[hive] object SparkSQLCLIDriver {
             reader.setHistory(new History(new File(historyFile)))
           } else {
             System.err.println("WARNING: Directory for Hive history file: " + historyDirectory +
    -                           " does not exist.   History will not be available during this session.")
    --- End diff --
    
    Avoid reformatting code that doesn't change 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.
---

[GitHub] spark pull request: [SPARK-2752]spark sql cli should not exit when...

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

    https://github.com/apache/spark/pull/1661#issuecomment-50642636
  
    test this please
    
    cc @liancheng


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

[GitHub] spark pull request: [SPARK-2752]spark sql cli should not exit when...

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

    https://github.com/apache/spark/pull/1661#discussion_r15627250
  
    --- Diff: sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLCLIDriver.scala ---
    @@ -288,33 +288,36 @@ private[hive] class SparkSQLCLIDriver extends CliDriver with Logging {
                 out.println(cmd)
               }
     
    -          ret = driver.run(cmd).getResponseCode
    -          if (ret != 0) {
    -            driver.close()
    -            return ret
    -          }
    -
    -          val res = new JArrayList[String]()
    -
    -          if (HiveConf.getBoolVar(conf, HiveConf.ConfVars.HIVE_CLI_PRINT_HEADER)) {
    -            // Print the column names.
    -            Option(driver.getSchema.getFieldSchemas).map { fields =>
    -              out.println(fields.map(_.getName).mkString("\t"))
    +          try {
    +            ret = driver.run(cmd).getResponseCode
    +            if (ret != 0) {
    +              driver.close()
    +               return ret
    --- End diff --
    
    Hey, line 295, 300 to 304 contain illegal *Chinese* full-width space characters.


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