Skip to content

Commit 17f6bae

Browse files
committed
Various fixes.
1 parent b932e86 commit 17f6bae

File tree

4 files changed

+7
-8
lines changed

4 files changed

+7
-8
lines changed

sql/catalyst/src/main/scala/org/apache/spark/sql/types/dataTypes.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -822,7 +822,8 @@ case class StructType(fields: Array[StructField]) extends DataType with Seq[Stru
822822
* have a name matching the given name, `null` will be returned.
823823
*/
824824
def apply(name: String): StructField = {
825-
nameToField.getOrElse(name, throw new IllegalArgumentException(s"Field $name does not exist."))
825+
nameToField.getOrElse(name,
826+
throw new IllegalArgumentException(s"""Field "$name" does not exist."""))
826827
}
827828

828829
/**

sql/core/src/main/scala/org/apache/spark/sql/DataFrame.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import org.apache.spark.sql.types.StructType
3131

3232
private[sql] object DataFrame {
3333
def apply(sqlContext: SQLContext, logicalPlan: LogicalPlan): DataFrame = {
34-
new DataFrameImpl(sqlContext, sqlContext.executePlan(logicalPlan))
34+
new DataFrameImpl(sqlContext, logicalPlan)
3535
}
3636
}
3737

sql/core/src/main/scala/org/apache/spark/sql/DataFrameImpl.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ private[sql] class DataFrameImpl protected[sql](
260260

261261
override def take(n: Int): Array[Row] = head(n)
262262

263-
override def collect(): Array[Row] = rdd.collect()
263+
override def collect(): Array[Row] = queryExecution.executedPlan.executeCollect()
264264

265265
override def collectAsList(): java.util.List[Row] = java.util.Arrays.asList(rdd.collect() :_*)
266266

sql/core/src/test/scala/org/apache/spark/sql/DataFrameSuite.scala

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,9 @@ class DataFrameSuite extends QueryTest {
3636
intercept[Exception] {
3737
testData.groupBy("nonExistentName").agg(Map("key" -> "sum"))
3838
}
39-
40-
// Uncomment the following once we report the errors properly.
41-
// intercept[Exception] {
42-
// testData.groupBy("nonExistentName").agg(Map("key" -> "sum"))
43-
// }
39+
intercept[Exception] {
40+
testData.groupBy($"abcd").agg(Map("key" -> "sum"))
41+
}
4442
}
4543

4644
test("table scan") {

0 commit comments

Comments
 (0)