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(
124
124
}
125
125
126
126
/** 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
+ }
131
134
132
135
override def as (name : String ): DataFrame = Subquery (name, logicalPlan)
133
136
134
137
@ 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 {
137
140
case (Column (expr : NamedExpression ), _) =>
138
141
expr
139
142
case (Column (expr : Expression ), _) =>
Original file line number Diff line number Diff line change @@ -85,7 +85,7 @@ trait DataFrameSpecificApi {
85
85
def apply (projection : Product ): DataFrame
86
86
87
87
@ scala.annotation.varargs
88
- def select (col : Column , cols : Column * ): DataFrame
88
+ def select (cols : Column * ): DataFrame
89
89
90
90
/** Filtering */
91
91
def apply (condition : Column ): DataFrame = filter(condition)
You can’t perform that action at this time.
0 commit comments