title: Spark SQL Timeout
body: <p>I'm trying to run a relatively simple Spark SQL command on a Spark standalone cluster</p>
  
  <pre><code>select a.name, b.name, s.score
  from score s
  inner join A a on a.id = s.a_id
  inner join B b on b.id = s.b_id
  where pmod(a.id, 3) != 3 and pmod(b.id, 3) != 0
  </code></pre>
  
  <p>The table sizes are as follows</p>
  
  <pre><code>A: 25,000
  B: 2,500,000
  score: 25,000,000
  </code></pre>
  
  <p>Therefore, from this I would expect the get a result of 25,000,000 rows.  I want to run this query with Spark SQL and then process each line.  Here is the relevant spark code</p>
  
  <pre><code>val sqlContext = new HiveContext(sc)
  val sql = "&lt;above SQL&gt;"
  sqlContext.sql(sql).first
  </code></pre>
  
  <p>This command runs fine when the size of table score is 200,000, but doesn't run now.  Here are the relevant logs</p>
  
  <pre><code>14/12/04 16:35:14 WARN LazyStruct: Extra bytes detected at the end of the row! Ignoring similar problems.
  14/12/04 16:35:43 WARN LazyStruct: Extra bytes detected at the end of the row! Ignoring similar problems.
  14/12/04 16:36:24 WARN LazyStruct: Extra bytes detected at the end of the row! Ignoring similar problems.
  14/12/04 16:37:11 WARN LazyStruct: Extra bytes detected at the end of the row! Ignoring similar problems.
  14/12/04 16:38:13 WARN LazyStruct: Extra bytes detected at the end of the row! Ignoring similar problems.
  14/12/04 16:39:19 WARN LazyStruct: Extra bytes detected at the end of the row! Ignoring similar problems.
  14/12/04 16:39:48 WARN LazyStruct: Extra bytes detected at the end of the row! Ignoring similar problems.
  14/12/04 16:40:08 WARN MemoryStore: Not enough space to store block broadcast_12 in memory! Free memory is 1938057068 bytes.
  14/12/04 16:40:08 WARN MemoryStore: Persisting block broadcast_12 to disk instead.
  java.util.concurrent.TimeoutException: Futures timed out after [5 minutes]
      at scala.concurrent.impl.Promise$DefaultPromise.ready(Promise.scala:219)
      at scala.concurrent.impl.Promise$DefaultPromise.result(Promise.scala:223)
      at scala.concurrent.Await$$anonfun$result$1.apply(package.scala:107)
      at scala.concurrent.BlockContext$DefaultBlockContext$.blockOn(BlockContext.scala:53)
      at scala.concurrent.Await$.result(package.scala:107)
      at org.apache.spark.sql.execution.BroadcastHashJoin.execute(joins.scala:431)
      at org.apache.spark.sql.execution.Project.execute(basicOperators.scala:42)
      at org.apache.spark.sql.execution.Limit.executeCollect(basicOperators.scala:111)
      at org.apache.spark.sql.SchemaRDD.collect(SchemaRDD.scala:438)
      at org.apache.spark.sql.SchemaRDD.take(SchemaRDD.scala:440)
      at org.apache.spark.sql.SchemaRDD.take(SchemaRDD.scala:103)
      at org.apache.spark.rdd.RDD.first(RDD.scala:1092)
      at $iwC$$iwC$$iwC$$iwC.&lt;init&gt;(&lt;console&gt;:20)
      at $iwC$$iwC$$iwC.&lt;init&gt;(&lt;console&gt;:25)
      at $iwC$$iwC.&lt;init&gt;(&lt;console&gt;:27)
      at $iwC.&lt;init&gt;(&lt;console&gt;:29)
      at &lt;init&gt;(&lt;console&gt;:31)
      at .&lt;init&gt;(&lt;console&gt;:35)
      at .&lt;clinit&gt;(&lt;console&gt;)
      at .&lt;init&gt;(&lt;console&gt;:7)
      at .&lt;clinit&gt;(&lt;console&gt;)
      at $print(&lt;console&gt;)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:606)
      at org.apache.spark.repl.SparkIMain$ReadEvalPrint.call(SparkIMain.scala:789)
      at org.apache.spark.repl.SparkIMain$Request.loadAndRun(SparkIMain.scala:1062)
      at org.apache.spark.repl.SparkIMain.loadAndRunReq$1(SparkIMain.scala:615)
      at org.apache.spark.repl.SparkIMain.interpret(SparkIMain.scala:646)
      at org.apache.spark.repl.SparkIMain.interpret(SparkIMain.scala:610)
      at org.apache.spark.repl.SparkILoop.reallyInterpret$1(SparkILoop.scala:814)
      at org.apache.spark.repl.SparkILoop.interpretStartingWith(SparkILoop.scala:859)
      at org.apache.spark.repl.SparkILoop.command(SparkILoop.scala:771)
      at org.apache.spark.repl.SparkILoop.processLine$1(SparkILoop.scala:616)
      at org.apache.spark.repl.SparkILoop.innerLoop$1(SparkILoop.scala:624)
      at org.apache.spark.repl.SparkILoop.loop(SparkILoop.scala:629)
      at org.apache.spark.repl.SparkILoop$$anonfun$process$1.apply$mcZ$sp(SparkILoop.scala:954)
      at org.apache.spark.repl.SparkILoop$$anonfun$process$1.apply(SparkILoop.scala:902)
      at org.apache.spark.repl.SparkILoop$$anonfun$process$1.apply(SparkILoop.scala:902)
      at scala.tools.nsc.util.ScalaClassLoader$.savingContextLoader(ScalaClassLoader.scala:135)
      at org.apache.spark.repl.SparkILoop.process(SparkILoop.scala:902)
      at org.apache.spark.repl.SparkILoop.process(SparkILoop.scala:997)
      at org.apache.spark.repl.Main$.main(Main.scala:31)
      at org.apache.spark.repl.Main.main(Main.scala)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:606)
      at org.apache.spark.deploy.SparkSubmit$.launch(SparkSubmit.scala:328)
      at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:75)
      at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)
  </code></pre>
  
  <p>My initial thought was to increase this timeout, but this doesn't look possible without recompiling the source as show <a href="https://github.com/apache/spark/blob/master/sql/core/src/main/scala/org/apache/spark/sql/execution/joins/BroadcastHashJoin.scala" rel="nofollow">here</a>.  In the parent directory I also see a few different joins, but I'm not sure how to get spark to use those other types of joins.</p>
  
  <p>I was also trying to fix my first warning about persisting to disk by increasing spark.executor.memory up to 10g, but that didn't solve the problem.</p>
  
  <p>Does anyone know how I can actually run this query?</p>