File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed
catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical
core/src/test/scala/org/apache/spark/sql Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -161,7 +161,7 @@ abstract class LogicalPlan extends QueryPlan[LogicalPlan] with Logging {
161161 if (tmp.nonEmpty) throw e
162162 inBacktick = true
163163 } else if (char == '.' ) {
164- if (tmp.isEmpty ) throw e
164+ if (name(i - 1 ) == '.' || i == name.length - 1 ) throw e
165165 nameParts += tmp.mkString
166166 tmp.clear()
167167 } else {
@@ -170,7 +170,7 @@ abstract class LogicalPlan extends QueryPlan[LogicalPlan] with Logging {
170170 }
171171 i += 1
172172 }
173- if (tmp.isEmpty || inBacktick) throw e
173+ if (inBacktick) throw e
174174 nameParts += tmp.mkString
175175 nameParts.toSeq
176176 }
Original file line number Diff line number Diff line change @@ -730,4 +730,11 @@ class DataFrameSuite extends QueryTest {
730730 val res11 = ctx.range(- 1 ).select(" id" )
731731 assert(res11.count == 0 )
732732 }
733+
734+ test(" SPARK-8621: support empty string column name" ) {
735+ val df = Seq (Tuple1 (1 )).toDF(" " ).as(" t" )
736+ // We should allow empty string as column name
737+ df.col(" " )
738+ df.col(" t.``" )
739+ }
733740}
You can’t perform that action at this time.
0 commit comments