Skip to content

Commit d35efd5

Browse files
committed
Fixed compilation error.
1 parent ce4a5d2 commit d35efd5

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

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

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -124,16 +124,19 @@ class DataFrame(
124124
}
125125

126126
/** Projection */
127-
override def apply(projection: Product): DataFrame = select(projection.productIterator.map {
128-
case c: Column => c
129-
case o: Any => new Column(Some(sqlContext), None, LiteralExpr(o))
130-
}.toSeq :_*)
127+
override def apply(projection: Product): DataFrame = {
128+
require(projection.productArity >= 1)
129+
select(projection.productIterator.map {
130+
case c: Column => c
131+
case o: Any => new Column(Some(sqlContext), None, LiteralExpr(o))
132+
}.toSeq :_*)
133+
}
131134

132135
override def as(name: String): DataFrame = Subquery(name, logicalPlan)
133136

134137
@scala.annotation.varargs
135-
override def select(col: Column, cols: Column*): DataFrame = {
136-
val exprs = (col +: cols).zipWithIndex.map {
138+
override def select(cols: Column*): DataFrame = {
139+
val exprs = cols.zipWithIndex.map {
137140
case (Column(expr: NamedExpression), _) =>
138141
expr
139142
case (Column(expr: Expression), _) =>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ trait DataFrameSpecificApi {
8585
def apply(projection: Product): DataFrame
8686

8787
@scala.annotation.varargs
88-
def select(col: Column, cols: Column*): DataFrame
88+
def select(cols: Column*): DataFrame
8989

9090
/** Filtering */
9191
def apply(condition: Column): DataFrame = filter(condition)

0 commit comments

Comments
 (0)