Skip to content

Commit d81ad43

Browse files
committed
fix style
1 parent 11699d6 commit d81ad43

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/unresolved.scala

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,12 @@ case class UnresolvedRelation(
4949
/**
5050
* Holds the name of an attribute that has yet to be resolved.
5151
*/
52-
case class UnresolvedAttribute(nameParts: Seq[String]) extends Attribute with trees.LeafNode[Expression] {
53-
def name = nameParts.map(n => if (n.contains(".")) s"`$n`" else n).mkString(".")
52+
case class UnresolvedAttribute(nameParts: Seq[String])
53+
extends Attribute with trees.LeafNode[Expression] {
54+
55+
def name: String =
56+
nameParts.map(n => if (n.contains(".")) s"`$n`" else n).mkString(".")
57+
5458
override def exprId: ExprId = throw new UnresolvedException(this, "exprId")
5559
override def dataType: DataType = throw new UnresolvedException(this, "dataType")
5660
override def nullable: Boolean = throw new UnresolvedException(this, "nullable")
@@ -70,8 +74,8 @@ case class UnresolvedAttribute(nameParts: Seq[String]) extends Attribute with tr
7074
}
7175

7276
object UnresolvedAttribute {
73-
def apply(name: String) = new UnresolvedAttribute(name.split("\\."))
74-
def quoted(name: String) = new UnresolvedAttribute(Seq(name))
77+
def apply(name: String): UnresolvedAttribute = new UnresolvedAttribute(name.split("\\."))
78+
def quoted(name: String): UnresolvedAttribute = new UnresolvedAttribute(Seq(name))
7579
}
7680

7781
case class UnresolvedFunction(name: String, children: Seq[Expression]) extends Expression {

sql/core/src/test/scala/org/apache/spark/sql/SQLQuerySuite.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1223,7 +1223,8 @@ class SQLQuerySuite extends QueryTest with BeforeAndAfterAll {
12231223

12241224
test("SPARK-6898: complete support for special chars in column names") {
12251225
jsonRDD(sparkContext.makeRDD(
1226-
"""{"a": {"c.b": 1}, "b.$q": [{"a@!.q": 1}], "q.w": {"w.i&": [1]}}""" :: Nil)).registerTempTable("t")
1226+
"""{"a": {"c.b": 1}, "b.$q": [{"a@!.q": 1}], "q.w": {"w.i&": [1]}}""" :: Nil))
1227+
.registerTempTable("t")
12271228

12281229
checkAnswer(sql("SELECT a.`c.b`, `b.$q`[0].`a@!.q`, `q.w`.`w.i&`[0] FROM t"), Row(1, 1, 1))
12291230
}

0 commit comments

Comments
 (0)