You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by kg...@apache.org on 2019/07/16 09:23:09 UTC
[hive] 02/02: HIVE-21972: "show transactions" display the header
twice (Rajkumar Singh via Gopal V)
This is an automated email from the ASF dual-hosted git repository.
kgyrtkirk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hive.git
commit 03b92fc1aa38985901c8939d717aaf0cd7ee532e
Author: Rajkumar Singh <ra...@gmail.com>
AuthorDate: Tue Jul 16 11:14:53 2019 +0200
HIVE-21972: "show transactions" display the header twice (Rajkumar Singh via Gopal V)
Signed-off-by: Zoltan Haindrich <ki...@rxd.hu>
---
.../hadoop/hive/ql/ddl/process/ShowTransactionsOperation.java | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/ddl/process/ShowTransactionsOperation.java b/ql/src/java/org/apache/hadoop/hive/ql/ddl/process/ShowTransactionsOperation.java
index cf3963b..805272e 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/ddl/process/ShowTransactionsOperation.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/ddl/process/ShowTransactionsOperation.java
@@ -30,6 +30,7 @@ import org.apache.hadoop.hive.metastore.api.GetOpenTxnsInfoResponse;
import org.apache.hadoop.hive.metastore.api.TxnInfo;
import org.apache.hadoop.hive.ql.ddl.DDLOperation;
import org.apache.hadoop.hive.ql.metadata.HiveException;
+import org.apache.hadoop.hive.ql.session.SessionState;
/**
* Operation process of showing transactions.
@@ -41,12 +42,15 @@ public class ShowTransactionsOperation extends DDLOperation<ShowTransactionsDesc
@Override
public int execute() throws HiveException {
+ SessionState sessionState = SessionState.get();
// Call the metastore to get the currently queued and running compactions.
GetOpenTxnsInfoResponse rsp = context.getDb().showTransactions();
// Write the results into the file
try (DataOutputStream os = DDLUtils.getOutputStream(new Path(desc.getResFile()), context)) {
- writeHeader(os);
+ if(!sessionState.isHiveServerQuery()) {
+ writeHeader(os);
+ }
for (TxnInfo txn : rsp.getOpen_txns()) {
writeRow(os, txn);