You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@hive.apache.org by GitBox <gi...@apache.org> on 2022/10/05 20:02:11 UTC

[GitHub] [hive] rkirtir commented on a diff in pull request #3625: Hive-26563: Add extra columns in Show Compactions output and sort the output

rkirtir commented on code in PR #3625:
URL: https://github.com/apache/hive/pull/3625#discussion_r985625967


##########
ql/src/java/org/apache/hadoop/hive/ql/ddl/process/show/compactions/ShowCompactionsDesc.java:
##########
@@ -33,8 +33,8 @@ public class ShowCompactionsDesc implements DDLDesc, Serializable {
 
   // @formatter:off
   public static final String SCHEMA =
-      "compactionid,dbname,tabname,partname,type,state,workerhost,workerid,enqueuetime,starttime,duration,hadoopjobid,errormessage,initiatorhost,initiatorid,poolname#" +
-      "string:string:string:string:string:string:string:string:string:string:string:string:string:string:string:string";
+      "compactionid,dbname,tabname,partname,type,state,workerhost,workerid,enqueuetime,starttime,duration,hadoopjobid,errormessage,initiatorhost,initiatorid,poolname,txnid,nexttxnid,committime,hightestWriteID#" +

Review Comment:
   resolved



##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/TxnHandler.java:
##########
@@ -314,6 +314,8 @@ abstract class TxnHandler implements TxnStore, TxnStore.MutexAPI {
   private static final String  EXCL_CTAS_ERR_MSG = 
       "Failed to initiate a concurrent CTAS operation with the same table name, lockInfo : %s";
   private static final String ZERO_WAIT_READ_ERR_MSG = "Unable to acquire read lock due to an existing exclusive lock {%s}";
+  private static String SHOW_COMPACTION_ORDERBY_CLAUSE = "  order by  case when CC_END > CC_START and CC_END > CC_ENQUEUE_TIME then CC_END When CC_START > CC_ENQUEUE_TIME then CC_START Else CC_ENQUEUE_TIME end desc";

Review Comment:
   resolved



##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/TxnHandler.java:
##########
@@ -3871,46 +3873,35 @@ public ShowCompactResponse showCompact(ShowCompactRequest rqst) throws MetaExcep
     PreparedStatement stmt = null;
     try {
       try {
-        StringBuilder sb =new StringBuilder(2048);
-        sb.append(
-            "SELECT " +
-            "  \"CQ_DATABASE\", \"CQ_TABLE\", \"CQ_PARTITION\", \"CQ_STATE\", \"CQ_TYPE\", \"CQ_WORKER_ID\", " +
-            "  \"CQ_START\", -1 \"CC_END\", \"CQ_RUN_AS\", \"CQ_HADOOP_JOB_ID\", \"CQ_ID\", \"CQ_ERROR_MESSAGE\", " +
-            "  \"CQ_ENQUEUE_TIME\", \"CQ_WORKER_VERSION\", \"CQ_INITIATOR_ID\", \"CQ_INITIATOR_VERSION\", " +
-            "  \"CQ_CLEANER_START\", \"CQ_POOL_NAME\"" +
-            "FROM " +
-                "  \"COMPACTION_QUEUE\" "
-        );
-        if (org.apache.commons.lang3.StringUtils.isNotBlank(rqst.getPoolName())) {
-          sb.append("WHERE \"CQ_POOL_NAME\" = ? ");
-        }
-        sb.append(
-            "UNION ALL " +
-            "SELECT " +
-            "  \"CC_DATABASE\", \"CC_TABLE\", \"CC_PARTITION\", \"CC_STATE\", \"CC_TYPE\", \"CC_WORKER_ID\", " +
-            "  \"CC_START\", \"CC_END\", \"CC_RUN_AS\", \"CC_HADOOP_JOB_ID\", \"CC_ID\", \"CC_ERROR_MESSAGE\", " +
-            "  \"CC_ENQUEUE_TIME\", \"CC_WORKER_VERSION\", \"CC_INITIATOR_ID\", \"CC_INITIATOR_VERSION\", " +
-            "  -1 , \"CC_POOL_NAME\"" +
-            "FROM " +
-            "  \"COMPLETED_COMPACTIONS\" "
-        );
-        if (org.apache.commons.lang3.StringUtils.isNotBlank(rqst.getPoolName())) {
-          sb.append("WHERE \"CC_POOL_NAME\" = ?");
-        }
-        //todo: sort by cq_id?
-        //what I want is order by cc_end desc, cc_start asc (but derby has a bug https://issues.apache.org/jira/browse/DERBY-6013)
-        //to sort so that currently running jobs are at the end of the list (bottom of screen)
-        //and currently running ones are in sorted by start time
-        //w/o order by likely currently running compactions will be first (LHS of Union)
-
-        String query = sb.toString();
+        String query = "SELECT XX.* FROM ( SELECT " +

Review Comment:
   Resolved. Added class TxnQueries for related queries



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org