File tree Expand file tree Collapse file tree 2 files changed +10
-7
lines changed
sql/core/src/main/scala/org/apache/spark/sql Expand file tree Collapse file tree 2 files changed +10
-7
lines changed Original file line number Diff line number Diff 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 ), _) =>
Original file line number Diff line number Diff 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)
You can’t perform that action at this time.
0 commit comments