Github user andrewor14 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/8635#discussion_r39002189
  
    --- Diff: 
sql/core/src/test/scala/org/apache/spark/sql/MiniSparkSQLClusterSuite.scala ---
    @@ -0,0 +1,68 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.sql
    +
    +import org.apache.spark.{SparkFunSuite, SparkContext, SparkConf}
    +
    +class MiniSparkSQLClusterSuite extends SparkFunSuite {
    +  /**
    +   * Create a spark context with specified configuration.
    +   */
    +  protected def withSparkConf(sparkConfs: (String, String)*)(f: 
(SQLContext) => Unit): Unit = {
    +    val (keys, values) = sparkConfs.unzip
    +    val conf = new SparkConf()
    +      .setMaster("local[1]")
    +      .setAppName("testing")
    +
    +    (keys, values).zipped.foreach(conf.set)
    +    val sc = new SparkContext(conf)
    +
    +    try f(createSQLContext(sc)) finally {
    +      sc.stop()
    +    }
    +  }
    +
    +  /**
    +   * Sets all SQL configurations specified in `pairs`, and then calls `f`
    +   */
    +  protected def withSQLConf(pairs: (String, String)*)
    +     (f: SQLContext => Unit)
    +     (sqlContext: SQLContext): Unit = {
    +    val (keys, values) = pairs.unzip
    +
    +    (keys, values).zipped.foreach(sqlContext.conf.setConfString)
    +
    +    f(sqlContext)
    +  }
    +
    +  protected def createSQLContext(sc: SparkContext): SQLContext = {
    +    new SQLContext(sc)
    +  }
    +
    +  test("SPARK-10466 mapside external sorting for UnsafeRow") {
    +    withSparkConf(
    +      ("spark.shuffle.sort.bypassMergeThreshold", "1"),
    +      ("spark.shuffle.memoryFraction", "0.005")) {
    +      withSQLConf(SQLConf.SHUFFLE_PARTITIONS.key -> "2") { sqlContext =>
    +        import sqlContext.implicits._
    +        sqlContext.sparkContext.parallelize(1 to 10000000, 5) // hopefully 
big enough for data spill
    --- End diff --
    
    also, you probably don't need to explicitly set the SQL shuffle partitions. 
Just set the `bypassMergeThreshold` to 0.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to