This is an automated email from the ASF dual-hosted git repository. daijy pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/hive.git
The following commit(s) were added to refs/heads/master by this push: new 67e515f HIVE-21571: SHOW COMPACTIONS shows column names as its first output row (Rajkumar Singh, reviewed by Daniel Dai) 67e515f is described below commit 67e515ffab2744e451752d750c312876c7e602f1 Author: Daniel Dai <da...@cloudera.com> AuthorDate: Sun Jul 7 20:36:40 2019 -0700 HIVE-21571: SHOW COMPACTIONS shows column names as its first output row (Rajkumar Singh, reviewed by Daniel Dai) --- .../hadoop/hive/ql/ddl/process/ShowCompactionsOperation.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ql/src/java/org/apache/hadoop/hive/ql/ddl/process/ShowCompactionsOperation.java b/ql/src/java/org/apache/hadoop/hive/ql/ddl/process/ShowCompactionsOperation.java index 87419be..4bf45fc 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/ddl/process/ShowCompactionsOperation.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/ddl/process/ShowCompactionsOperation.java @@ -29,6 +29,7 @@ import org.apache.hadoop.hive.ql.ddl.DDLOperationContext; import org.apache.hadoop.hive.ql.ddl.DDLUtils; import org.apache.hadoop.hive.ql.exec.Utilities; import org.apache.hadoop.hive.ql.metadata.HiveException; +import org.apache.hadoop.hive.ql.session.SessionState; /** * Operation process of showing compactions. @@ -40,13 +41,16 @@ public class ShowCompactionsOperation extends DDLOperation<ShowCompactionsDesc> @Override public int execute() throws HiveException { + SessionState sessionState = SessionState.get(); // Call the metastore to get the status of all known compactions (completed get purged eventually) ShowCompactResponse rsp = context.getDb().showCompactions(); // Write the results into the file try (DataOutputStream os = DDLUtils.getOutputStream(new Path(desc.getResFile()), context)) { - // Write a header - writeHeader(os); + // Write a header for cliDriver + if(!sessionState.isHiveServerQuery()) { + writeHeader(os); + } if (rsp.getCompacts() != null) { for (ShowCompactResponseElement e : rsp.getCompacts()) {