You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by shaolinliu <gi...@git.apache.org> on 2017/04/07 06:54:15 UTC

[GitHub] spark pull request #17561: [SPARK-20248][ SQL]Spark SQL add limit parameter ...

GitHub user shaolinliu opened a pull request:

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

    [SPARK-20248][ SQL]Spark SQL add limit parameter to enhance the reliability.

    
    ## What changes were proposed in this pull request?
    
    Add a parameter "spark.sql.thriftServer.retainedResults" with default value 200, when user run a query without a limit, this will implicitly add a limit to this query. When user run a query with a limit,we do nothing. If this parameter is set to 0,we do nothing too.
    
    ## How was this patch tested?
    
    manual tests

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

    $ git pull https://github.com/shaolinliu/spark liu

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

    https://github.com/apache/spark/pull/17561.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 #17561
    
----
commit b47cf92fee79a57fbec37bbf9c7d35753f5c7d75
Author: liu shaolin <li...@zte.com.cn>
Date:   2017-04-07T05:25:21Z

    	modified:   sql/core/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala
    	modified:   sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkExecuteStatementOperation.scala

----


---
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 #17561: [SPARK-20248][ SQL]Spark SQL add limit parameter ...

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

    https://github.com/apache/spark/pull/17561#discussion_r110333435
  
    --- Diff: sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkExecuteStatementOperation.scala ---
    @@ -121,7 +121,12 @@ private[hive] class SparkExecuteStatementOperation(
             result.toLocalIterator.asScala
           } else {
             if (resultList.isEmpty) {
    -          resultList = Some(result.collect())
    +          val limited = sqlContext.getConf(SQLConf.THRIFTSERVER_RESULT_LIMIT.key).toInt
    +          resultList = if (limited > 0) {
    +            Some(result.take(result.queryExecution.analyzed.maxRows.getOrElse(limited).toInt))
    --- End diff --
    
    Looks here is a compile error:
    ```
    [error] /.../SparkExecuteStatementOperation.scala:126: value toInt is not a member of AnyVal
    [error]             Some(result.take(result.queryExecution.analyzed.maxRows.getOrElse(limited).toInt))
    [error]                                                                                        ^
    ```


---
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 issue #17561: [SPARK-20248][ SQL]Spark SQL add limit parameter to enha...

Posted by ueshin <gi...@git.apache.org>.
Github user ueshin commented on the issue:

    https://github.com/apache/spark/pull/17561
  
    Jenkins, 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.
---

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


[GitHub] spark pull request #17561: [SPARK-20248][ SQL]Spark SQL add limit parameter ...

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

    https://github.com/apache/spark/pull/17561#discussion_r110345702
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala ---
    @@ -359,6 +359,13 @@ object SQLConf {
           .booleanConf
           .createWithDefault(false)
     
    +  val THRIFTSERVER_RESULT_LIMIT =
    +    buildConf("spark.sql.thriftServer.retainedResults")
    +      .internal()
    +      .doc("The number of sql results returned by Thrift Server, and 0 is unlimited.")
    --- End diff --
    
    The doc is not clear. Can you add the relation with limit operator into the doc?


---
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 issue #17561: [SPARK-20248][ SQL]Spark SQL add limit parameter to enha...

Posted by shaolinliu <gi...@git.apache.org>.
Github user shaolinliu commented on the issue:

    https://github.com/apache/spark/pull/17561
  
    @ueshin please take a look at this pr, 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.
---

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


[GitHub] spark issue #17561: [SPARK-20248][ SQL]Spark SQL add limit parameter to enha...

Posted by shaolinliu <gi...@git.apache.org>.
Github user shaolinliu commented on the issue:

    https://github.com/apache/spark/pull/17561
  
    ok.


---
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 #17561: [SPARK-20248][ SQL]Spark SQL add limit parameter ...

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

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


---
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 #17561: [SPARK-20248][ SQL]Spark SQL add limit parameter ...

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

    https://github.com/apache/spark/pull/17561#discussion_r110333569
  
    --- Diff: sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkExecuteStatementOperation.scala ---
    @@ -242,7 +247,12 @@ private[hive] class SparkExecuteStatementOperation(
               resultList = None
               result.toLocalIterator.asScala
             } else {
    -          resultList = Some(result.collect())
    +          val limited = sqlContext.getConf(SQLConf.THRIFTSERVER_RESULT_LIMIT.key).toInt
    +          resultList = if (limited > 0) {
    +            Some(result.take(result.queryExecution.analyzed.maxRows.getOrElse(limited).toInt))
    --- End diff --
    
    And also here:
    ```
    [error] /.../SparkExecuteStatementOperation.scala:252: value toInt is not a member of AnyVal
    [error]             Some(result.take(result.queryExecution.analyzed.maxRows.getOrElse(limited).toInt))
    [error]                                                                                        ^
    ```


---
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 issue #17561: [SPARK-20248][ SQL]Spark SQL add limit parameter to enha...

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

    https://github.com/apache/spark/pull/17561
  
    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.
---

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


[GitHub] spark issue #17561: [SPARK-20248][ SQL]Spark SQL add limit parameter to enha...

Posted by shaolinliu <gi...@git.apache.org>.
Github user shaolinliu commented on the issue:

    https://github.com/apache/spark/pull/17561
  
    has modify the error, and retest the usecase.


---
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 issue #17561: [SPARK-20248][ SQL]Spark SQL add limit parameter to enha...

Posted by ueshin <gi...@git.apache.org>.
Github user ueshin commented on the issue:

    https://github.com/apache/spark/pull/17561
  
    I'm not exactly sure, but doesn't setting `SQLConf.THRIFTSERVER_INCREMENTAL_COLLECT` to `true` work for your purpose?


---
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 issue #17561: [SPARK-20248][ SQL]Spark SQL add limit parameter to enha...

Posted by HyukjinKwon <gi...@git.apache.org>.
Github user HyukjinKwon commented on the issue:

    https://github.com/apache/spark/pull/17561
  
    @ueshin, about Jenkins thing, please refer https://github.com/apache/spark/pull/17469#issuecomment-292663021. It might be helpful.


---
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 issue #17561: [SPARK-20248][ SQL]Spark SQL add limit parameter to enha...

Posted by shaolinliu <gi...@git.apache.org>.
Github user shaolinliu commented on the issue:

    https://github.com/apache/spark/pull/17561
  
    @ueshin the SQLConf.THRIFTSERVER_INCREMENTAL_COLLECT will cause the resource waste of the cluster, because the cluster's resource will release when the query is finish, so the executor's memory and cpu is occupied, in general it is slower.


---
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 issue #17561: [SPARK-20248][ SQL]Spark SQL add limit parameter to enha...

Posted by ueshin <gi...@git.apache.org>.
Github user ueshin commented on the issue:

    https://github.com/apache/spark/pull/17561
  
    ok to test


---
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 #17561: [SPARK-20248][ SQL]Spark SQL add limit parameter ...

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

    https://github.com/apache/spark/pull/17561#discussion_r110346704
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala ---
    @@ -359,6 +359,13 @@ object SQLConf {
           .booleanConf
           .createWithDefault(false)
     
    +  val THRIFTSERVER_RESULT_LIMIT =
    +    buildConf("spark.sql.thriftServer.retainedResults")
    +      .internal()
    +      .doc("The number of sql results returned by Thrift Server, and 0 is unlimited.")
    --- End diff --
    
    ok,i will modify.


---
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 issue #17561: [SPARK-20248][ SQL]Spark SQL add limit parameter to enha...

Posted by ueshin <gi...@git.apache.org>.
Github user ueshin commented on the issue:

    https://github.com/apache/spark/pull/17561
  
    I don't know the reason but Jenkins doesn't work here.
    @shaolinliu Could you close this and send another pr to make Jenkins work?


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