Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1321,11 +1321,11 @@ https://cwiki.apache.org/confluence/display/Hive/Enhanced+Aggregation%2C+Cube%2C
/* Attribute References */
case Token("TOK_TABLE_OR_COL",
Token(name, Nil) :: Nil) =>
UnresolvedAttribute(cleanIdentifier(name))
UnresolvedAttribute.quoted(cleanIdentifier(name))
case Token(".", qualifier :: Token(attr, Nil) :: Nil) =>
nodeToExpr(qualifier) match {
case UnresolvedAttribute(qualifierName) =>
UnresolvedAttribute(qualifierName :+ cleanIdentifier(attr))
case UnresolvedAttribute(nameParts) =>
UnresolvedAttribute(nameParts :+ cleanIdentifier(attr))
case other => UnresolvedExtractValue(other, Literal(attr))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1025,4 +1025,12 @@ class SQLQuerySuite extends QueryTest {
)
TestHive.dropTempTable("test_SPARK8588")
}

test("SPARK-9371: fix the support for special chars in column names for hive context") {
TestHive.read.json(TestHive.sparkContext.makeRDD(
"""{"a": {"c.b": 1}, "b.$q": [{"a@!.q": 1}], "q.w": {"w.i&": [1]}}""" :: Nil))
.registerTempTable("t")

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