Skip to content

Commit fd2534c

Browse files
committed
Merge remote-tracking branch 'upstream/master' into SPARK-2177
2 parents b9b9aa5 + f14b00a commit fd2534c

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

core/src/main/scala/org/apache/spark/deploy/ClientArguments.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ import scala.collection.mutable.ListBuffer
2121

2222
import org.apache.log4j.Level
2323

24+
import org.apache.spark.util.MemoryParam
25+
2426
/**
2527
* Command-line parser for the driver client.
2628
*/
@@ -51,8 +53,8 @@ private[spark] class ClientArguments(args: Array[String]) {
5153
cores = value.toInt
5254
parse(tail)
5355

54-
case ("--memory" | "-m") :: value :: tail =>
55-
memory = value.toInt
56+
case ("--memory" | "-m") :: MemoryParam(value) :: tail =>
57+
memory = value
5658
parse(tail)
5759

5860
case ("--supervise" | "-s") :: tail =>

sql/hive/src/main/scala/org/apache/spark/sql/hive/execution/hiveOperators.scala

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,12 +346,16 @@ case class InsertIntoHiveTable(
346346
writer.commitJob()
347347
}
348348

349+
override def execute() = result
350+
349351
/**
350352
* Inserts all the rows in the table into Hive. Row objects are properly serialized with the
351353
* `org.apache.hadoop.hive.serde2.SerDe` and the
352354
* `org.apache.hadoop.mapred.OutputFormat` provided by the table definition.
355+
*
356+
* Note: this is run once and then kept to avoid double insertions.
353357
*/
354-
def execute() = {
358+
private lazy val result: RDD[Row] = {
355359
val childRdd = child.execute()
356360
assert(childRdd != null)
357361

sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveQuerySuite.scala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ case class TestData(a: Int, b: String)
3030
*/
3131
class HiveQuerySuite extends HiveComparisonTest {
3232

33+
test("CREATE TABLE AS runs once") {
34+
hql("CREATE TABLE foo AS SELECT 1 FROM src LIMIT 1").collect()
35+
assert(hql("SELECT COUNT(*) FROM foo").collect().head.getLong(0) === 1,
36+
"Incorrect number of rows in created table")
37+
}
38+
3339
createQueryTest("between",
3440
"SELECT * FROM src WHERE key Between 1 and 2")
3541

0 commit comments

Comments
 (0)