File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed
main/scala/org/apache/spark/sql
test/scala/org/apache/spark/sql Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -1257,7 +1257,8 @@ class DataFrame private[sql](
12571257 def drop (colNames : String * ): DataFrame = {
12581258 val resolver = sqlContext.analyzer.resolver
12591259 val remainingCols =
1260- schema.filter(f => colNames.forall(n => ! resolver(f.name, n))).map(f => Column (f.name))
1260+ schema.filter(f => colNames.forall(n => ! resolver(f.name, n)))
1261+ .map(f => Column (UnresolvedAttribute (Seq (f.name))))
12611262 if (remainingCols.size == this .schema.size) {
12621263 this
12631264 } else {
Original file line number Diff line number Diff line change @@ -36,6 +36,12 @@ import org.apache.spark.sql.types._
3636class DataFrameSuite extends QueryTest with SharedSQLContext {
3737 import testImplicits ._
3838
39+ test(" SPARK-12987" ) {
40+ val df = Seq ((1 , 1 )).toDF(" a_b" , " a.c" )
41+ val df1 = df.drop(" a_b" )
42+ assert(df1.toString() === " [a.c: int]" )
43+ }
44+
3945 test(" analysis error should be eagerly reported" ) {
4046 // Eager analysis.
4147 withSQLConf(SQLConf .DATAFRAME_EAGER_ANALYSIS .key -> " true" ) {
You can’t perform that action at this time.
0 commit comments