deniskuzZ commented on code in PR #3625:
URL: https://github.com/apache/hive/pull/3625#discussion_r992433770
##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/TxnHandler.java:
##########
@@ -3908,49 +3908,19 @@ public ShowCompactResponse
showCompact(ShowCompactRequest rqst) throws MetaExcep
ShowCompactResponse response = new ShowCompactResponse(new ArrayList<>());
Connection dbConn = null;
PreparedStatement stmt = null;
+ StringBuilder query = new StringBuilder();
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();
+ query.append(TxnQueries.SHOW_COMPACTION_QUERY);
+ String whereClause = getShowCompactionFilterClause(rqst);
+ if (!whereClause.isEmpty()) {
+ query.append(" where ");
Review Comment:
you are missing the `whereClause`
````
query
.append(getShowCompactionFilterClause(rqst))
.append(TxnQueries.SHOW_COMPACTION_ORDERBY_CLAUSE);
````
in getShowCompactionFilterClause
````
private String getShowCompactionFilterClause(ShowCompactRequest request) {
StringBuilder filter = new StringBuilder();
....
return filter.length() > 0 ? " where "+ filter.toString() :
StringUtils.EMPTY
````
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]