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 @@ -539,15 +539,15 @@ case class DescribeTableCommand(
throw new AnalysisException(
s"DESC PARTITION is not allowed on a temporary view: ${table.identifier}")
}
describeSchema(catalog.lookupRelation(table).schema, result, header = false)
describeSchema(catalog.lookupRelation(table).schema, result, header = true)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May be should add a configure like hive.cli.print.header.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not worth yet another flag, and this is a behavior change in the output. There's no motivation for this change either.

Copy link
Member

@gatorsmile gatorsmile Feb 9, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For details, see #18203

Copy link
Author

@guoxiaolongzte guoxiaolongzte Feb 11, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Partition Information

col_name data_type comment

Partition information also takes up two rows.
I try to keep the head of the case, let rows number is displayed correctly.

Copy link
Author

@guoxiaolongzte guoxiaolongzte Feb 11, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The snapshot is correct fix code effect, the statistics rows does not contain the head
2

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gatorsmile I wasn't clear -- you're saying this change is wrong because it re-adds a header that was removed in the other PR?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. Hive beeline already hardcoded the header. See the https://issues.apache.org/jira/browse/SPARK-20954

} else {
val metadata = catalog.getTableMetadata(table)
if (metadata.schema.isEmpty) {
// In older version(prior to 2.1) of Spark, the table schema can be empty and should be
// inferred at runtime. We should still support it.
describeSchema(sparkSession.table(metadata.identifier).schema, result, header = false)
} else {
describeSchema(metadata.schema, result, header = false)
describeSchema(metadata.schema, result, header = true)
}

describePartitionInfo(metadata, result)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,9 @@ private[hive] class SparkSQLCLIDriver extends CliDriver with Logging {
try {
while (!out.checkError() && driver.getResults(res)) {
res.asScala.foreach { l =>
counter += 1
if (!l.startsWith("#")) {
counter += 1
}
out.println(l)
}
res.clear()
Expand Down