Skip to content

Commit b9b9aa5

Browse files
committed
rxin's comments.
1 parent e7c4e72 commit b9b9aa5

File tree

4 files changed

+8
-9
lines changed

4 files changed

+8
-9
lines changed

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/commands.scala

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,7 @@ case class ExplainCommand(plan: LogicalPlan) extends Command {
6262
case class CacheCommand(tableName: String, doCache: Boolean) extends Command
6363

6464
/**
65-
* Returned for the "DESCRIBE tableName" command.
66-
*/
67-
68-
/**
69-
* Returned for the "DESCRIBE tableName" command.
65+
* Returned for the "DESCRIBE [EXTENDED] [dbName.]tableName" command.
7066
* @param table The table to be described.
7167
* @param isExtended True if "DESCRIBE EXTENDED" is used. Otherwise, false.
7268
* It is effective only when the table is a Hive table.

sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveQl.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,7 @@ private[hive] object HiveQl {
403403
nameParts.head match {
404404
case Token(".", dbName :: tableName :: Nil) =>
405405
// It is describing a table with the format like "describe db.table".
406+
// TODO: Actually, a user may mean tableName.columnName. Need to resolve this issue.
406407
val (db, tableName) = extractDbNameTableName(nameParts.head)
407408
DescribeCommand(
408409
UnresolvedRelation(db, tableName, None), extended.isDefined)

sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveComparisonTest.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,11 @@ abstract class HiveComparisonTest
145145
case _: LogicalNativeCommand => answer.filterNot(nonDeterministicLine).filterNot(_ == "")
146146
case _: ExplainCommand => answer
147147
case _: DescribeCommand =>
148+
// Filter out non-deterministic lines and lines which do not have actual results but
149+
// can introduce problems because of the way Hive formats these lines.
150+
// Then, remove empty lines. Do not sort the results.
148151
answer.filterNot(
149-
r => nonDeterministicLine(r) || ignoredLine(r)).map(_.trim).filterNot(
150-
r => r == "" || r == "\n")
152+
r => nonDeterministicLine(r) || ignoredLine(r)).map(_.trim).filterNot(_ == "")
151153
case plan => if (isSorted(plan)) answer else answer.sorted
152154
}
153155
orderedAnswer.map(cleanPaths)

sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveCompatibilitySuite.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class HiveCompatibilitySuite extends HiveQueryFileTest with BeforeAndAfter {
7878
"alter_merge",
7979
"alter_concatenate_indexed_table",
8080
"protectmode2",
81-
"describe_table",
81+
//"describe_table",
8282
"describe_comment_nonascii",
8383
"udf5",
8484
"udf_java_method",
@@ -185,7 +185,7 @@ class HiveCompatibilitySuite extends HiveQueryFileTest with BeforeAndAfter {
185185
"describe_formatted_view_partitioned_json",
186186

187187
// Hive returns the results of describe as plain text. Comments with multiple lines
188-
// introduce extra in the Hive results, which make the result comparison fail.
188+
// introduce extra lines in the Hive results, which make the result comparison fail.
189189
"describe_comment_indent"
190190
)
191191

0 commit comments

Comments
 (0)