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/09/20 03:45:46 UTC

[GitHub] [hive] rkirtir opened a new pull request, #3608: HIVE-13353: SHOW COMPACTIONS should support filtering options

rkirtir opened a new pull request, #3608:
URL: https://github.com/apache/hive/pull/3608

   <!--
   Thanks for sending a pull request!  Here are some tips for you:
     1. If this is your first time, please read our contributor guidelines: https://cwiki.apache.org/confluence/display/Hive/HowToContribute
     2. Ensure that you have created an issue on the Hive project JIRA: https://issues.apache.org/jira/projects/HIVE/summary
     3. Ensure you have added or run the appropriate tests for your PR: 
     4. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP]HIVE-XXXXX:  Your PR title ...'.
     5. Be sure to keep the PR description updated to reflect all changes.
     6. Please write your PR title to summarize what this PR proposes.
     7. If possible, provide a concise example to reproduce the issue for a faster review.
   
   -->
   
   ### What changes were proposed in this pull request?
   
   https://issues.apache.org/jira/browse/HIVE-13353 
   Since we now have historical information in SHOW COMPACTIONS the output can easily become unwieldy. (e.g. 1000 partitions with 3 lines of history each)
   this is a significant usability issue
   Need to add ability to filter by db/table/partition
   Perhaps would also be useful to filter by status
   
   
   ### Why are the changes needed?
   We are now giving flexibility to filter compactions on db,table,partition,type state etc.
   
   
   ### Does this PR introduce _any_ user-facing change?
   no
   
   
   ### How was this patch tested?
   junit
   


-- 
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


[GitHub] [hive] deniskuzZ commented on a diff in pull request #3608: HIVE-13353: SHOW COMPACTIONS should support filtering options

Posted by GitBox <gi...@apache.org>.
deniskuzZ commented on code in PR #3608:
URL: https://github.com/apache/hive/pull/3608#discussion_r1000747667


##########
ql/src/java/org/apache/hadoop/hive/ql/ddl/process/show/compactions/ShowCompactionsAnalyzer.java:
##########
@@ -40,20 +43,44 @@ public ShowCompactionsAnalyzer(QueryState queryState) throws SemanticException {
 
   @Override
   public void analyzeInternal(ASTNode root) throws SemanticException {
+    ctx.setResFile(ctx.getLocalTmpPath());
     String poolName = null;
-    Tree pool = root.getChild(0);
-    if (pool != null) {
-      if (pool.getType() != HiveParser.TOK_COMPACT_POOL) {
-        throw new SemanticException("Unknown token, 'POOL' expected.");
-      } else {
-        poolName = unescapeSQLString(pool.getChild(0).getText());
+    String dbName = null;
+    String tbName = null;
+    String compactionType = null;
+    String compactionStatus = null;
+    Map<String, String> partitionSpec = null;
+    if (root.getChildCount() > 6) {
+      throw new SemanticException(ErrorMsg.INVALID_AST_TREE.getMsg(root.toStringTree()));
+    }
+    if (root.getType() == HiveParser.TOK_SHOW_COMPACTIONS && root.getChildCount() >= 1) {
+      for (int i = 0; i < root.getChildCount(); i++) {
+        ASTNode child = (ASTNode) root.getChild(i);
+        if (child.getType() == HiveParser.TOK_TABTYPE) {
+          tbName = child.getChild(0).getText();
+          // get partition metadata if partition specified
+          if (child.getChildCount() == 2) {
+            if(child.getChild(0) !=null) {
+              dbName = DDLUtils.getFQName((ASTNode) child.getChild(0).getChild(0));

Review Comment:
   should we check if child.getChild(0).getChildCount() == 2?



-- 
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


[GitHub] [hive] rkirtir commented on a diff in pull request #3608: HIVE-13353: SHOW COMPACTIONS should support filtering options

Posted by GitBox <gi...@apache.org>.
rkirtir commented on code in PR #3608:
URL: https://github.com/apache/hive/pull/3608#discussion_r1001380603


##########
ql/src/java/org/apache/hadoop/hive/ql/ddl/process/show/compactions/ShowCompactionsAnalyzer.java:
##########
@@ -40,20 +43,44 @@ public ShowCompactionsAnalyzer(QueryState queryState) throws SemanticException {
 
   @Override
   public void analyzeInternal(ASTNode root) throws SemanticException {
+    ctx.setResFile(ctx.getLocalTmpPath());
     String poolName = null;
-    Tree pool = root.getChild(0);
-    if (pool != null) {
-      if (pool.getType() != HiveParser.TOK_COMPACT_POOL) {
-        throw new SemanticException("Unknown token, 'POOL' expected.");
-      } else {
-        poolName = unescapeSQLString(pool.getChild(0).getText());
+    String dbName = null;
+    String tbName = null;
+    String compactionType = null;
+    String compactionStatus = null;
+    Map<String, String> partitionSpec = null;
+    if (root.getChildCount() > 6) {
+      throw new SemanticException(ErrorMsg.INVALID_AST_TREE.getMsg(root.toStringTree()));
+    }
+    if (root.getType() == HiveParser.TOK_SHOW_COMPACTIONS && root.getChildCount() >= 1) {
+      for (int i = 0; i < root.getChildCount(); i++) {
+        ASTNode child = (ASTNode) root.getChild(i);
+        if (child.getType() == HiveParser.TOK_TABTYPE) {
+          tbName = child.getChild(0).getText();

Review Comment:
   Not required as some cases tbName is null and default is get populated from session in ShowCompactionOperations.



##########
ql/src/java/org/apache/hadoop/hive/ql/ddl/process/show/compactions/ShowCompactionsAnalyzer.java:
##########
@@ -40,20 +43,44 @@ public ShowCompactionsAnalyzer(QueryState queryState) throws SemanticException {
 
   @Override
   public void analyzeInternal(ASTNode root) throws SemanticException {
+    ctx.setResFile(ctx.getLocalTmpPath());
     String poolName = null;
-    Tree pool = root.getChild(0);
-    if (pool != null) {
-      if (pool.getType() != HiveParser.TOK_COMPACT_POOL) {
-        throw new SemanticException("Unknown token, 'POOL' expected.");
-      } else {
-        poolName = unescapeSQLString(pool.getChild(0).getText());
+    String dbName = null;
+    String tbName = null;
+    String compactionType = null;
+    String compactionStatus = null;
+    Map<String, String> partitionSpec = null;
+    if (root.getChildCount() > 6) {
+      throw new SemanticException(ErrorMsg.INVALID_AST_TREE.getMsg(root.toStringTree()));
+    }
+    if (root.getType() == HiveParser.TOK_SHOW_COMPACTIONS && root.getChildCount() >= 1) {
+      for (int i = 0; i < root.getChildCount(); i++) {
+        ASTNode child = (ASTNode) root.getChild(i);
+        if (child.getType() == HiveParser.TOK_TABTYPE) {
+          tbName = child.getChild(0).getText();
+          // get partition metadata if partition specified
+          if (child.getChildCount() == 2) {
+            if(child.getChild(0) !=null) {
+              dbName = DDLUtils.getFQName((ASTNode) child.getChild(0).getChild(0));

Review Comment:
   done



-- 
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


[GitHub] [hive] sonarcloud[bot] commented on pull request #3608: HIVE-13353: SHOW COMPACTIONS should support filtering options

Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on PR #3608:
URL: https://github.com/apache/hive/pull/3608#issuecomment-1287788296

   Kudos, SonarCloud Quality Gate passed!&nbsp; &nbsp; [![Quality Gate passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=3608)
   
   [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=BUG)  
   [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=VULNERABILITY)  
   [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=3608&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=3608&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=3608&resolved=false&types=SECURITY_HOTSPOT)  
   [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=CODE_SMELL) [7 Code Smells](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=CODE_SMELL)
   
   [![No Coverage information](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/NoCoverageInfo-16px.png 'No Coverage information')](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=3608&metric=coverage&view=list) No Coverage information  
   [![No Duplication information](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/NoDuplicationInfo-16px.png 'No Duplication information')](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=3608&metric=duplicated_lines_density&view=list) No Duplication information
   
   


-- 
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


[GitHub] [hive] veghlaci05 commented on a diff in pull request #3608: HIVE-13353: SHOW COMPACTIONS should support filtering options

Posted by GitBox <gi...@apache.org>.
veghlaci05 commented on code in PR #3608:
URL: https://github.com/apache/hive/pull/3608#discussion_r989978699


##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/TxnHandler.java:
##########
@@ -3970,6 +3960,78 @@ public ShowCompactResponse showCompact(ShowCompactRequest rqst) throws MetaExcep
     }
   }
 
+  private List<String> getShowCompactionQueryParamList(ShowCompactRequest request) throws MetaException {
+    String dbName = request.getDbname();
+    String tableName = request.getTablename();
+    String partName = request.getPartitionname();
+    CompactionType type = request.getType();
+    String state = request.getState();
+    String poolName = request.getPoolName();
+    List<String> params = new ArrayList<>();
+    if (dbName != null && !dbName.isEmpty()) {
+      params.add(dbName);
+    }
+    if (tableName != null && !tableName.isEmpty()) {
+      params.add(tableName);
+    }
+    if (partName != null && !partName.isEmpty()) {
+      params.add(partName);
+    }
+    if (state != null && !state.isEmpty()) {
+      params.add(state);
+    }
+    if (type != null) {
+      params.add(thriftCompactionType2DbType(type).toString());
+    }
+    if (org.apache.commons.lang3.StringUtils.isNotBlank(poolName)) {
+      params.add(poolName);
+    }
+    return params;
+  }
+
+  private String getFilterClause(ShowCompactRequest request) {
+    StringBuilder filter = new StringBuilder();
+    String dbName = request.getDbname();
+    String tableName = request.getTablename();
+    String partName = request.getPartitionname();
+    CompactionType type = request.getType();
+    String state = request.getState();
+    String poolName = request.getPoolName();
+    if (dbName != null && !dbName.isEmpty()) {

Review Comment:
   Same as above, Stringutils.isNotBlank() ?



##########
ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java:
##########
@@ -5875,6 +5802,15 @@ public ShowCompactResponse showCompactions(String poolName) throws HiveException
     }
   }
 
+  public ShowCompactResponse showCompactions(ShowCompactRequest request) throws HiveException {

Review Comment:
   ShowCompactResponse showCompactions(String poolName) is no longer used, it can be removed



##########
ql/src/java/org/apache/hadoop/hive/ql/ddl/process/show/compactions/ShowCompactionsOperation.java:
##########
@@ -68,6 +83,71 @@ public int execute() throws HiveException {
     return 0;
   }
 
+  private ShowCompactRequest getShowCompactioRequest(ShowCompactionsDesc desc) throws MetaException, SemanticException {
+    ShowCompactRequest request = new ShowCompactRequest();
+    if (desc.getDbName() == null && desc.getTbName() != null) {

Review Comment:
   StringUtils.isNotBlank()?



##########
ql/src/java/org/apache/hadoop/hive/ql/ddl/process/show/compactions/ShowCompactionsOperation.java:
##########
@@ -68,6 +83,71 @@ public int execute() throws HiveException {
     return 0;
   }
 
+  private ShowCompactRequest getShowCompactioRequest(ShowCompactionsDesc desc) throws MetaException, SemanticException {
+    ShowCompactRequest request = new ShowCompactRequest();
+    if (desc.getDbName() == null && desc.getTbName() != null) {
+      request.setDbname(SessionState.get().getCurrentDatabase());
+    } else {
+      request.setDbname(desc.getDbName());
+    }
+    if (desc.getTbName() != null && !desc.getTbName().isEmpty())
+      request.setTablename(desc.getTbName());
+    if (desc.getPoolName() != null && !desc.getPoolName().isEmpty())
+      request.setPoolName(desc.getPoolName());
+    if (desc.getCompactionType() != null && !desc.getCompactionType().isEmpty())
+      request.setType(inputCompactionType2DBType(desc.getCompactionType()));
+    if (desc.getCompactionStatus() != null && !desc.getCompactionStatus().isEmpty())
+      request.setState(compactorStateFromInput(desc.getCompactionStatus()));
+    if (desc.getPartSpec() != null && !desc.getPartSpec().isEmpty())
+      request.setPartitionname(getPartitionName(desc.getPartSpec()));
+    return request;
+  }
+
+  private String getPartitionName(Map<String, String> partitionSpec) throws SemanticException {
+    String partitionName = null;
+    if (partitionSpec != null) {
+      try {
+        partitionName = Warehouse.makePartName(partitionSpec, false);
+      } catch (MetaException e) {
+        throw new SemanticException("partition " + partitionSpec.toString() + " not found");
+      }
+    }
+    return partitionName;
+  }
+
+  static CompactionType inputCompactionType2DBType(String inputValue) throws MetaException {
+    switch (inputValue.toUpperCase()) {
+      case MAJOR_TYPE:
+        return CompactionType.MAJOR;
+      case MINOR_TYPE:
+        return CompactionType.MINOR;
+      default:
+        throw new MetaException("Unexpected compaction type " + inputValue);
+    }
+  }
+
+  private String compactorStateFromInput(String s) throws MetaException {

Review Comment:
   Same as above, similar to org.apache.hadoop.hive.metastore.txn.TxnHandler.compactorStateToResponse



##########
ql/src/java/org/apache/hadoop/hive/ql/ddl/process/show/compactions/ShowCompactionsAnalyzer.java:
##########
@@ -40,20 +42,41 @@ public ShowCompactionsAnalyzer(QueryState queryState) throws SemanticException {
 
   @Override
   public void analyzeInternal(ASTNode root) throws SemanticException {
+    ctx.setResFile(ctx.getLocalTmpPath());
     String poolName = null;
-    Tree pool = root.getChild(0);
-    if (pool != null) {
-      if (pool.getType() != HiveParser.TOK_COMPACT_POOL) {
-        throw new SemanticException("Unknown token, 'POOL' expected.");
-      } else {
-        poolName = unescapeSQLString(pool.getChild(0).getText());
+    String dbName = null;
+    String tbName = null;
+    String compactionType = null;
+    String compactionStatus = null;
+    Map<String, String> partitionSpec = null;
+    if (root.getChildCount() > 6) {
+      throw new SemanticException(ErrorMsg.INVALID_AST_TREE.getMsg(root.toStringTree()));
+    }
+    if (root.getType() == HiveParser.TOK_SHOW_COMPACTIONS && root.getChildCount() >= 1) {
+      for (int i = 0; i < root.getChildCount(); i++) {
+        ASTNode child = (ASTNode) root.getChild(i);
+        if (child.getType() == HiveParser.TOK_TABTYPE) {
+          tbName = child.getChild(0).getText();
+          // get partition metadata if partition specified
+          if (child.getChildCount() == 2) {
+            dbName = DDLUtils.getFQName((ASTNode) child.getChild(0).getChild(0));

Review Comment:
   no check for child.getChild(0).getChildCount(). Is this safe?



##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/TxnHandler.java:
##########
@@ -3970,6 +3960,78 @@ public ShowCompactResponse showCompact(ShowCompactRequest rqst) throws MetaExcep
     }
   }
 
+  private List<String> getShowCompactionQueryParamList(ShowCompactRequest request) throws MetaException {
+    String dbName = request.getDbname();
+    String tableName = request.getTablename();
+    String partName = request.getPartitionname();
+    CompactionType type = request.getType();
+    String state = request.getState();
+    String poolName = request.getPoolName();
+    List<String> params = new ArrayList<>();
+    if (dbName != null && !dbName.isEmpty()) {
+      params.add(dbName);
+    }
+    if (tableName != null && !tableName.isEmpty()) {

Review Comment:
   Why not use Stringutils.isNotBlank()?



##########
ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java:
##########
@@ -105,10 +105,7 @@
 import org.apache.hadoop.hive.conf.Constants;
 import org.apache.hadoop.hive.conf.HiveConf;
 import org.apache.hadoop.hive.conf.HiveConf.ConfVars;
-import org.apache.hadoop.hive.metastore.api.CompactionRequest;
-import org.apache.hadoop.hive.metastore.api.GetPartitionsByNamesRequest;
-import org.apache.hadoop.hive.metastore.api.GetTableRequest;
-import org.apache.hadoop.hive.metastore.api.UpdateTransactionalStatsRequest;
+import org.apache.hadoop.hive.metastore.api.*;

Review Comment:
   Please restore the original imports, it can cause issues when backporting.



##########
ql/src/java/org/apache/hadoop/hive/ql/ddl/process/show/compactions/ShowCompactionsOperation.java:
##########
@@ -39,16 +43,27 @@
  * Operation process of showing compactions.
  */
 public class ShowCompactionsOperation extends DDLOperation<ShowCompactionsDesc> {
+
+  static final protected String MAJOR_TYPE = "MAJOR";
+  static final protected String MINOR_TYPE = "MINOR";
+  static final char INITIATED_STATE = 'i';

Review Comment:
   Could these be moved to a common place where both TxnHandler and this class can access them? Like TxnStore?



##########
parser/src/test/org/apache/hadoop/hive/ql/parse/TestParseShowCompactions.java:
##########
@@ -0,0 +1,148 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hive.ql.parse;
+
+import org.junit.Test;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+
+public class TestParseShowCompactions {
+    ParseDriver parseDriver = new ParseDriver();
+
+    @Test
+    public void testShowCompactions() throws Exception {
+        ASTNode tree = parseDriver.parse(
+                "SHOW COMPACTIONS", null).getTree();
+
+        assertThat(tree.toStringTree(), is("tok_show_compactions <eof>"));
+    }
+
+    @Test
+    public void testShowCompactionsFilterDb() throws Exception {
+        ASTNode tree = parseDriver.parse(
+                "SHOW COMPACTIONS DATABASE db1", null).getTree();
+
+        assertThat(tree.toStringTree(), is("(tok_show_compactions db1) <eof>"));
+    }
+
+    private static final String EXPECTED_WHEN_FILTER_BY_DB_AND_ALL_AND_ORDER_BY = "\n" +
+            "nil\n" +
+            "   TOK_SHOW_COMPACTIONS\n" +
+            "      db1\n" +
+            "      TOK_COMPACT_POOL\n" +
+            "         'pool0'\n" +
+            "      TOK_COMPACTION_TYPE\n" +
+            "         'minor'\n" +
+            "      TOK_COMPACTION_STATUS\n" +
+            "         'ready for clean'\n" +
+            "      TOK_ORDERBY\n" +
+            "         TOK_TABSORTCOLNAMEDESC\n" +
+            "            TOK_NULLS_FIRST\n" +
+            "               TOK_TABLE_OR_COL\n" +
+            "                  cq_table\n" +
+            "         TOK_TABSORTCOLNAMEASC\n" +
+            "            TOK_NULLS_LAST\n" +
+            "               TOK_TABLE_OR_COL\n" +
+            "                  cq_state\n" +
+            "      TOK_LIMIT\n" +
+            "         42\n" +
+            "   <EOF>\n";
+
+    @Test
+    public void testShowCompactionsFilterDbAndAllAndOrder() throws Exception {
+        ASTNode tree = parseDriver.parse(
+                "SHOW COMPACTIONS DATABASE db1 POOL 'pool0' TYPE 'minor' STATUS 'ready for clean' ORDER BY cq_table DESC, cq_state LIMIT 42", null).getTree();

Review Comment:
   I can see no signs of ORDER BY and LIMIT support for SHOW COMPACTIONS in the code.



##########
ql/src/java/org/apache/hadoop/hive/ql/ddl/process/show/compactions/ShowCompactionsOperation.java:
##########
@@ -68,6 +83,71 @@ public int execute() throws HiveException {
     return 0;
   }
 
+  private ShowCompactRequest getShowCompactioRequest(ShowCompactionsDesc desc) throws MetaException, SemanticException {
+    ShowCompactRequest request = new ShowCompactRequest();
+    if (desc.getDbName() == null && desc.getTbName() != null) {
+      request.setDbname(SessionState.get().getCurrentDatabase());
+    } else {
+      request.setDbname(desc.getDbName());
+    }
+    if (desc.getTbName() != null && !desc.getTbName().isEmpty())
+      request.setTablename(desc.getTbName());
+    if (desc.getPoolName() != null && !desc.getPoolName().isEmpty())
+      request.setPoolName(desc.getPoolName());
+    if (desc.getCompactionType() != null && !desc.getCompactionType().isEmpty())
+      request.setType(inputCompactionType2DBType(desc.getCompactionType()));
+    if (desc.getCompactionStatus() != null && !desc.getCompactionStatus().isEmpty())
+      request.setState(compactorStateFromInput(desc.getCompactionStatus()));
+    if (desc.getPartSpec() != null && !desc.getPartSpec().isEmpty())
+      request.setPartitionname(getPartitionName(desc.getPartSpec()));
+    return request;
+  }
+
+  private String getPartitionName(Map<String, String> partitionSpec) throws SemanticException {
+    String partitionName = null;
+    if (partitionSpec != null) {
+      try {
+        partitionName = Warehouse.makePartName(partitionSpec, false);
+      } catch (MetaException e) {
+        throw new SemanticException("partition " + partitionSpec.toString() + " not found");
+      }
+    }
+    return partitionName;
+  }
+
+  static CompactionType inputCompactionType2DBType(String inputValue) throws MetaException {

Review Comment:
   This is very similar to org.apache.hadoop.hive.metastore.txn.TxnHandler.dbCompactionType2ThriftType and org.apache.hadoop.hive.metastore.txn.TxnHandler.thriftCompactionType2DbType. Could these methods collected to a common place like some utility class?



##########
ql/src/test/org/apache/hadoop/hive/ql/TestTxnCommands.java:
##########
@@ -2117,4 +2121,168 @@ public void testIsRawFormatFile() throws Exception {
     List<String> res = runStatementOnDriver("select * from file_formats");
     Assert.assertEquals(3, res.size());
   }
+  @Test
+  public void testShowCompactions() throws Exception {
+    d.destroy();
+    hiveConf.setVar(HiveConf.ConfVars.DYNAMICPARTITIONINGMODE, "nonstrict");
+    d = new Driver(hiveConf);
+    //generate some compaction history
+    runStatementOnDriver("drop database if exists mydb1 cascade");
+    runStatementOnDriver("create database mydb1");
+    runStatementOnDriver("create table mydb1.tbl0 " + "(a int, b int) partitioned by (p string) clustered by (a) into " +
+      BUCKET_COUNT + " buckets stored as orc TBLPROPERTIES ('transactional'='true')");
+    runStatementOnDriver("insert into mydb1.tbl0" + " PARTITION(p) " +
+      " values(1,2,'p1'),(3,4,'p1'),(1,2,'p2'),(3,4,'p2'),(1,2,'p3'),(3,4,'p3')");
+    runStatementOnDriver("alter table mydb1.tbl0" + " PARTITION(p='p1') compact 'MAJOR'");
+    TestTxnCommands2.runWorker(hiveConf);
+    runStatementOnDriver("alter table mydb1.tbl0" + " PARTITION(p='p2') compact 'MAJOR'");
+    TestTxnCommands2.runWorker(hiveConf);
+    runStatementOnDriver("alter table mydb1.tbl0" + " PARTITION(p='p3') compact 'MAJOR'");
+    TestTxnCommands2.runWorker(hiveConf);
+    runStatementOnDriver("insert into mydb1.tbl0" + " PARTITION(p) " +
+      " values(4,5,'p1'),(6,7,'p1'),(4,5,'p2'),(6,7,'p2'),(4,5,'p3'),(6,7,'p3')");
+    runStatementOnDriver("alter table mydb1.tbl0" + " PARTITION (p='p1') compact 'MAJOR'");
+    TestTxnCommands2.runWorker(hiveConf);
+    runStatementOnDriver("alter table mydb1.tbl0" + " PARTITION (p='p2') compact 'MAJOR'");
+    TestTxnCommands2.runWorker(hiveConf);
+    runStatementOnDriver("alter table mydb1.tbl0" + " PARTITION (p='p3')  compact 'MAJOR' pool 'pool0'");
+    TestTxnCommands2.runWorker(hiveConf);
+    TxnStore txnHandler = TxnUtils.getTxnStore(hiveConf);
+
+    SessionState.get().setCurrentDatabase("mydb1");
+
+    //testing show compaction command
+    ShowCompactResponse rsp = txnHandler.showCompact(new ShowCompactRequest());
+    List<String> r = runStatementOnDriver("SHOW COMPACTIONS");
+    Assert.assertEquals(rsp.getCompacts().size()+1, r.size());//includes Header row
+
+
+    r = runStatementOnDriver("SHOW COMPACTIONS SCHEMA mydb1 STATUS 'ready for cleaning'");
+    Assert.assertEquals(rsp.getCompacts().stream().filter(x->x.getState().equals("ready for cleaning")).count() +1,

Review Comment:
   You are checking the same untouched rsp variable every time after running different commands on the driver. Didn't you want to check the driver command result instead? This also applies to all the blocks below



##########
ql/src/test/org/apache/hadoop/hive/ql/TestTxnCommands2.java:
##########
@@ -3359,7 +3359,58 @@ private void runStatementOnDriverWithAbort(String stmt) {
     } catch (CommandProcessorException e) {
     }
   }
+  @Test
+  public void testShowCompactWithFilterOption() throws Exception {

Review Comment:
   Please also add some tests where there are multiple independent filters set up (like pool and partition name) to check if the filtering works well. You could also check the value in the result if that really matches the filtering criteria. Like if you filter for table = bar1, check it in the result. 



##########
ql/src/test/org/apache/hadoop/hive/ql/TestTxnCommands.java:
##########
@@ -2117,4 +2121,168 @@ public void testIsRawFormatFile() throws Exception {
     List<String> res = runStatementOnDriver("select * from file_formats");
     Assert.assertEquals(3, res.size());
   }
+  @Test
+  public void testShowCompactions() throws Exception {
+    d.destroy();
+    hiveConf.setVar(HiveConf.ConfVars.DYNAMICPARTITIONINGMODE, "nonstrict");
+    d = new Driver(hiveConf);
+    //generate some compaction history
+    runStatementOnDriver("drop database if exists mydb1 cascade");
+    runStatementOnDriver("create database mydb1");
+    runStatementOnDriver("create table mydb1.tbl0 " + "(a int, b int) partitioned by (p string) clustered by (a) into " +
+      BUCKET_COUNT + " buckets stored as orc TBLPROPERTIES ('transactional'='true')");
+    runStatementOnDriver("insert into mydb1.tbl0" + " PARTITION(p) " +
+      " values(1,2,'p1'),(3,4,'p1'),(1,2,'p2'),(3,4,'p2'),(1,2,'p3'),(3,4,'p3')");
+    runStatementOnDriver("alter table mydb1.tbl0" + " PARTITION(p='p1') compact 'MAJOR'");
+    TestTxnCommands2.runWorker(hiveConf);
+    runStatementOnDriver("alter table mydb1.tbl0" + " PARTITION(p='p2') compact 'MAJOR'");
+    TestTxnCommands2.runWorker(hiveConf);
+    runStatementOnDriver("alter table mydb1.tbl0" + " PARTITION(p='p3') compact 'MAJOR'");
+    TestTxnCommands2.runWorker(hiveConf);
+    runStatementOnDriver("insert into mydb1.tbl0" + " PARTITION(p) " +
+      " values(4,5,'p1'),(6,7,'p1'),(4,5,'p2'),(6,7,'p2'),(4,5,'p3'),(6,7,'p3')");
+    runStatementOnDriver("alter table mydb1.tbl0" + " PARTITION (p='p1') compact 'MAJOR'");
+    TestTxnCommands2.runWorker(hiveConf);
+    runStatementOnDriver("alter table mydb1.tbl0" + " PARTITION (p='p2') compact 'MAJOR'");
+    TestTxnCommands2.runWorker(hiveConf);
+    runStatementOnDriver("alter table mydb1.tbl0" + " PARTITION (p='p3')  compact 'MAJOR' pool 'pool0'");
+    TestTxnCommands2.runWorker(hiveConf);
+    TxnStore txnHandler = TxnUtils.getTxnStore(hiveConf);
+
+    SessionState.get().setCurrentDatabase("mydb1");
+
+    //testing show compaction command
+    ShowCompactResponse rsp = txnHandler.showCompact(new ShowCompactRequest());
+    List<String> r = runStatementOnDriver("SHOW COMPACTIONS");
+    Assert.assertEquals(rsp.getCompacts().size()+1, r.size());//includes Header row
+
+
+    r = runStatementOnDriver("SHOW COMPACTIONS SCHEMA mydb1 STATUS 'ready for cleaning'");
+    Assert.assertEquals(rsp.getCompacts().stream().filter(x->x.getState().equals("ready for cleaning")).count() +1,
+      r.size());//includes Header row
+
+    r = runStatementOnDriver("SHOW COMPACTIONS SCHEMA mydb1 TYPE 'MAJOR' ");
+    Assert.assertEquals(rsp.getCompacts().stream().filter(x->x.getDbname().equals("mydb1")).
+      filter(x->x.getType().equals(CompactionType.MAJOR)).count()+1, r.size());//includes Header row
+
+    r = runStatementOnDriver("SHOW COMPACTIONS SCHEMA mydb1 POOL 'poolx' TYPE 'MINOR' ");
+    //includes Header row
+    Assert.assertEquals(rsp.getCompacts().stream().filter(x->x.getDbname().equals("mydb1")).
+      filter(x->x.getPoolName().equals("poolx")).filter(x->x.getType().equals(CompactionType.MAJOR)).count()+1, r.size());
+
+    r = runStatementOnDriver("SHOW COMPACTIONS SCHEMA mydb1 POOL 'pool0' TYPE 'MAJOR'");
+    Assert.assertEquals(2, r.size());//includes Header row
+
+    r = runStatementOnDriver("SHOW COMPACTIONS SCHEMA mydb1 POOL 'pool0'");
+    Assert.assertEquals(rsp.getCompacts().stream().filter(x->x.getDbname().equals("mydb1")).
+      filter(x->x.getPoolName().equals("pool0")).count()+1, r.size());//includes Header row
+
+    r = runStatementOnDriver("SHOW COMPACTIONS DATABASE mydb1 POOL 'pool0'");
+    Assert.assertEquals(2, r.size());//includes Header row
+
+    r = runStatementOnDriver("SHOW COMPACTIONS tbl0 TYPE 'MAJOR' ");

Review Comment:
   Since every other filter criteria is named (like SCHEMA, DATABASE, POOL, etc), I think this one should also looke like SHOW COMPACTIONS TABLE tbl0 TYPE 'MAJOR'.
   This is a bit odd this way.



-- 
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


[GitHub] [hive] rkirtir commented on a diff in pull request #3608: HIVE-13353: SHOW COMPACTIONS should support filtering options

Posted by GitBox <gi...@apache.org>.
rkirtir commented on code in PR #3608:
URL: https://github.com/apache/hive/pull/3608#discussion_r992116476


##########
ql/src/test/org/apache/hadoop/hive/ql/TestTxnCommands2.java:
##########
@@ -3359,7 +3359,58 @@ private void runStatementOnDriverWithAbort(String stmt) {
     } catch (CommandProcessorException e) {
     }
   }
+  @Test
+  public void testShowCompactWithFilterOption() throws Exception {

Review Comment:
   Added these conditions in tests



-- 
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


[GitHub] [hive] sonarcloud[bot] commented on pull request #3608: [WIP] HIVE-13353: SHOW COMPACTIONS should support filtering options

Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on PR #3608:
URL: https://github.com/apache/hive/pull/3608#issuecomment-1260903539

   Kudos, SonarCloud Quality Gate passed!&nbsp; &nbsp; [![Quality Gate passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=3608)
   
   [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=BUG)  
   [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=VULNERABILITY)  
   [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=3608&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=3608&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=3608&resolved=false&types=SECURITY_HOTSPOT)  
   [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=CODE_SMELL) [7 Code Smells](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=CODE_SMELL)
   
   [![No Coverage information](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/NoCoverageInfo-16px.png 'No Coverage information')](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=3608&metric=coverage&view=list) No Coverage information  
   [![No Duplication information](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/NoDuplicationInfo-16px.png 'No Duplication information')](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=3608&metric=duplicated_lines_density&view=list) No Duplication information
   
   


-- 
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


[GitHub] [hive] sonarcloud[bot] commented on pull request #3608: HIVE-13353: SHOW COMPACTIONS should support filtering options

Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on PR #3608:
URL: https://github.com/apache/hive/pull/3608#issuecomment-1287593589

   Kudos, SonarCloud Quality Gate passed!&nbsp; &nbsp; [![Quality Gate passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=3608)
   
   [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=BUG)  
   [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=VULNERABILITY)  
   [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=3608&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=3608&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=3608&resolved=false&types=SECURITY_HOTSPOT)  
   [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=CODE_SMELL) [7 Code Smells](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=CODE_SMELL)
   
   [![No Coverage information](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/NoCoverageInfo-16px.png 'No Coverage information')](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=3608&metric=coverage&view=list) No Coverage information  
   [![No Duplication information](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/NoDuplicationInfo-16px.png 'No Duplication information')](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=3608&metric=duplicated_lines_density&view=list) No Duplication information
   
   


-- 
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


[GitHub] [hive] deniskuzZ commented on a diff in pull request #3608: HIVE-13353: SHOW COMPACTIONS should support filtering options

Posted by GitBox <gi...@apache.org>.
deniskuzZ commented on code in PR #3608:
URL: https://github.com/apache/hive/pull/3608#discussion_r1000728500


##########
ql/src/java/org/apache/hadoop/hive/ql/ddl/process/show/compactions/ShowCompactionsAnalyzer.java:
##########
@@ -40,20 +43,44 @@ public ShowCompactionsAnalyzer(QueryState queryState) throws SemanticException {
 
   @Override
   public void analyzeInternal(ASTNode root) throws SemanticException {
+    ctx.setResFile(ctx.getLocalTmpPath());
     String poolName = null;
-    Tree pool = root.getChild(0);
-    if (pool != null) {
-      if (pool.getType() != HiveParser.TOK_COMPACT_POOL) {
-        throw new SemanticException("Unknown token, 'POOL' expected.");
-      } else {
-        poolName = unescapeSQLString(pool.getChild(0).getText());
+    String dbName = null;
+    String tbName = null;
+    String compactionType = null;
+    String compactionStatus = null;
+    Map<String, String> partitionSpec = null;
+    if (root.getChildCount() > 6) {
+      throw new SemanticException(ErrorMsg.INVALID_AST_TREE.getMsg(root.toStringTree()));
+    }
+    if (root.getType() == HiveParser.TOK_SHOW_COMPACTIONS && root.getChildCount() >= 1) {

Review Comment:
   no need for `root.getChildCount() >= 1` check



##########
ql/src/java/org/apache/hadoop/hive/ql/ddl/process/show/compactions/ShowCompactionsAnalyzer.java:
##########
@@ -40,20 +43,44 @@ public ShowCompactionsAnalyzer(QueryState queryState) throws SemanticException {
 
   @Override
   public void analyzeInternal(ASTNode root) throws SemanticException {
+    ctx.setResFile(ctx.getLocalTmpPath());
     String poolName = null;
-    Tree pool = root.getChild(0);
-    if (pool != null) {
-      if (pool.getType() != HiveParser.TOK_COMPACT_POOL) {
-        throw new SemanticException("Unknown token, 'POOL' expected.");
-      } else {
-        poolName = unescapeSQLString(pool.getChild(0).getText());
+    String dbName = null;
+    String tbName = null;
+    String compactionType = null;
+    String compactionStatus = null;
+    Map<String, String> partitionSpec = null;
+    if (root.getChildCount() > 6) {
+      throw new SemanticException(ErrorMsg.INVALID_AST_TREE.getMsg(root.toStringTree()));
+    }
+    if (root.getType() == HiveParser.TOK_SHOW_COMPACTIONS && root.getChildCount() >= 1) {

Review Comment:
   redundant `root.getChildCount() >= 1` check



-- 
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


[GitHub] [hive] deniskuzZ commented on a diff in pull request #3608: HIVE-13353: SHOW COMPACTIONS should support filtering options

Posted by GitBox <gi...@apache.org>.
deniskuzZ commented on code in PR #3608:
URL: https://github.com/apache/hive/pull/3608#discussion_r1000743039


##########
ql/src/java/org/apache/hadoop/hive/ql/ddl/process/show/compactions/ShowCompactionsAnalyzer.java:
##########
@@ -40,20 +43,44 @@ public ShowCompactionsAnalyzer(QueryState queryState) throws SemanticException {
 
   @Override
   public void analyzeInternal(ASTNode root) throws SemanticException {
+    ctx.setResFile(ctx.getLocalTmpPath());
     String poolName = null;
-    Tree pool = root.getChild(0);
-    if (pool != null) {
-      if (pool.getType() != HiveParser.TOK_COMPACT_POOL) {
-        throw new SemanticException("Unknown token, 'POOL' expected.");
-      } else {
-        poolName = unescapeSQLString(pool.getChild(0).getText());
+    String dbName = null;
+    String tbName = null;
+    String compactionType = null;
+    String compactionStatus = null;
+    Map<String, String> partitionSpec = null;
+    if (root.getChildCount() > 6) {
+      throw new SemanticException(ErrorMsg.INVALID_AST_TREE.getMsg(root.toStringTree()));
+    }
+    if (root.getType() == HiveParser.TOK_SHOW_COMPACTIONS && root.getChildCount() >= 1) {
+      for (int i = 0; i < root.getChildCount(); i++) {
+        ASTNode child = (ASTNode) root.getChild(i);
+        if (child.getType() == HiveParser.TOK_TABTYPE) {
+          tbName = child.getChild(0).getText();

Review Comment:
   should we do a NULL check?



-- 
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


[GitHub] [hive] sonarcloud[bot] commented on pull request #3608: HIVE-13353: SHOW COMPACTIONS should support filtering options

Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on PR #3608:
URL: https://github.com/apache/hive/pull/3608#issuecomment-1289350249

   Kudos, SonarCloud Quality Gate passed!&nbsp; &nbsp; [![Quality Gate passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=3608)
   
   [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=BUG)  
   [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=VULNERABILITY)  
   [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=3608&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=3608&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=3608&resolved=false&types=SECURITY_HOTSPOT)  
   [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=CODE_SMELL) [12 Code Smells](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=CODE_SMELL)
   
   [![No Coverage information](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/NoCoverageInfo-16px.png 'No Coverage information')](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=3608&metric=coverage&view=list) No Coverage information  
   [![No Duplication information](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/NoDuplicationInfo-16px.png 'No Duplication information')](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=3608&metric=duplicated_lines_density&view=list) No Duplication information
   
   


-- 
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


[GitHub] [hive] deniskuzZ commented on a diff in pull request #3608: HIVE-13353: SHOW COMPACTIONS should support filtering options

Posted by GitBox <gi...@apache.org>.
deniskuzZ commented on code in PR #3608:
URL: https://github.com/apache/hive/pull/3608#discussion_r1000764820


##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/TxnStore.java:
##########
@@ -104,6 +104,23 @@ enum MUTEX_KEY {
   String DID_NOT_INITIATE_RESPONSE = "did not initiate";
   String REFUSED_RESPONSE = "refused";
 
+  static final char INITIATED_STATE = 'i';

Review Comment:
   those constants are already present in TxnHandler, did you forget to remove them from the original place



-- 
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


[GitHub] [hive] rkirtir commented on a diff in pull request #3608: HIVE-13353: SHOW COMPACTIONS should support filtering options

Posted by GitBox <gi...@apache.org>.
rkirtir commented on code in PR #3608:
URL: https://github.com/apache/hive/pull/3608#discussion_r990899424


##########
ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java:
##########
@@ -105,10 +105,7 @@
 import org.apache.hadoop.hive.conf.Constants;
 import org.apache.hadoop.hive.conf.HiveConf;
 import org.apache.hadoop.hive.conf.HiveConf.ConfVars;
-import org.apache.hadoop.hive.metastore.api.CompactionRequest;
-import org.apache.hadoop.hive.metastore.api.GetPartitionsByNamesRequest;
-import org.apache.hadoop.hive.metastore.api.GetTableRequest;
-import org.apache.hadoop.hive.metastore.api.UpdateTransactionalStatsRequest;
+import org.apache.hadoop.hive.metastore.api.*;

Review Comment:
   Agree. Addressing the same



-- 
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


[GitHub] [hive] sonarcloud[bot] commented on pull request #3608: HIVE-13353: SHOW COMPACTIONS should support filtering options

Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on PR #3608:
URL: https://github.com/apache/hive/pull/3608#issuecomment-1287978609

   Kudos, SonarCloud Quality Gate passed!&nbsp; &nbsp; [![Quality Gate passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=3608)
   
   [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=BUG)  
   [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=VULNERABILITY)  
   [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=3608&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=3608&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=3608&resolved=false&types=SECURITY_HOTSPOT)  
   [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=CODE_SMELL) [7 Code Smells](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=CODE_SMELL)
   
   [![No Coverage information](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/NoCoverageInfo-16px.png 'No Coverage information')](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=3608&metric=coverage&view=list) No Coverage information  
   [![No Duplication information](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/NoDuplicationInfo-16px.png 'No Duplication information')](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=3608&metric=duplicated_lines_density&view=list) No Duplication information
   
   


-- 
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


[GitHub] [hive] rkirtir commented on a diff in pull request #3608: HIVE-13353: SHOW COMPACTIONS should support filtering options

Posted by GitBox <gi...@apache.org>.
rkirtir commented on code in PR #3608:
URL: https://github.com/apache/hive/pull/3608#discussion_r1001379564


##########
ql/src/java/org/apache/hadoop/hive/ql/ddl/process/show/compactions/ShowCompactionsAnalyzer.java:
##########
@@ -40,20 +43,44 @@ public ShowCompactionsAnalyzer(QueryState queryState) throws SemanticException {
 
   @Override
   public void analyzeInternal(ASTNode root) throws SemanticException {
+    ctx.setResFile(ctx.getLocalTmpPath());
     String poolName = null;
-    Tree pool = root.getChild(0);
-    if (pool != null) {
-      if (pool.getType() != HiveParser.TOK_COMPACT_POOL) {
-        throw new SemanticException("Unknown token, 'POOL' expected.");
-      } else {
-        poolName = unescapeSQLString(pool.getChild(0).getText());
+    String dbName = null;
+    String tbName = null;
+    String compactionType = null;
+    String compactionStatus = null;
+    Map<String, String> partitionSpec = null;
+    if (root.getChildCount() > 6) {
+      throw new SemanticException(ErrorMsg.INVALID_AST_TREE.getMsg(root.toStringTree()));
+    }
+    if (root.getType() == HiveParser.TOK_SHOW_COMPACTIONS && root.getChildCount() >= 1) {
+      for (int i = 0; i < root.getChildCount(); i++) {
+        ASTNode child = (ASTNode) root.getChild(i);
+        if (child.getType() == HiveParser.TOK_TABTYPE) {
+          tbName = child.getChild(0).getText();
+          // get partition metadata if partition specified
+          if (child.getChildCount() == 2) {
+            if(child.getChild(0) !=null) {

Review Comment:
   Agree resolved



-- 
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


[GitHub] [hive] deniskuzZ commented on a diff in pull request #3608: HIVE-13353: SHOW COMPACTIONS should support filtering options

Posted by GitBox <gi...@apache.org>.
deniskuzZ commented on code in PR #3608:
URL: https://github.com/apache/hive/pull/3608#discussion_r1003354559


##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/TxnHandler.java:
##########
@@ -3916,56 +3879,59 @@ public ShowCompactResponse showCompact(ShowCompactRequest rqst) throws MetaExcep
       try (Connection dbConn = getDbConn(Connection.TRANSACTION_READ_COMMITTED);
         PreparedStatement stmt = sqlGenerator.prepareStmtWithParameters(dbConn, query.toString(),
           getShowCompactionQueryParamList(rqst))) {
-          LOG.debug("Going to execute query <" + query + ">");
-          try (ResultSet rs = stmt.executeQuery()) {
-            while (rs.next()) {
-              ShowCompactResponseElement e = new ShowCompactResponseElement();
-              e.setDbname(rs.getString(1));
-              e.setTablename(rs.getString(2));
-              e.setPartitionname(rs.getString(3));
-              e.setState(compactorStateToResponse(rs.getString(4).charAt(0)));
-              try {
-                e.setType(dbCompactionType2ThriftType(rs.getString(5).charAt(0)));
-              } catch (MetaException ex) {
-                //do nothing to handle RU/D if we add another status
-              }
-              e.setWorkerid(rs.getString(6));
-              long start = rs.getLong(7);
-              if (!rs.wasNull()) {
-                e.setStart(start);
-              }
-              long endTime = rs.getLong(8);
-              if (endTime != -1) {
-                e.setEndTime(endTime);
-              }
-              e.setRunAs(rs.getString(9));
-              e.setHadoopJobId(rs.getString(10));
-              e.setId(rs.getLong(11));
-              e.setErrorMessage(rs.getString(12));
-              long enqueueTime = rs.getLong(13);
-              if (!rs.wasNull()) {
-                e.setEnqueueTime(enqueueTime);
-              }
-              e.setWorkerVersion(rs.getString(14));
-              e.setInitiatorId(rs.getString(15));
-              e.setInitiatorVersion(rs.getString(16));
-              long cleanerStart = rs.getLong(17);
-              if (!rs.wasNull() && (cleanerStart != -1)) {
-                e.setCleanerStart(cleanerStart);
-              }
-              String poolName = rs.getString(18);
-              if (isBlank(poolName)) {
-                e.setPoolName(DEFAULT_POOL_NAME);
-              } else {
-                e.setPoolName(poolName);
-              }
-              e.setTxnId(rs.getLong(19));
-              e.setNextTxnId(rs.getLong(20));
-              e.setCommitTime(rs.getLong(21));
-              e.setHightestTxnId(rs.getLong(22));
-              response.addToCompacts(e);
+        if (rqst.isSetId()) {
+          stmt.setLong(getShowCompactionQueryParamList(rqst).size() + 1, rqst.getId());

Review Comment:
   fixed



##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/TxnStore.java:
##########
@@ -104,6 +104,33 @@ enum MUTEX_KEY {
   String DID_NOT_INITIATE_RESPONSE = "did not initiate";
   String REFUSED_RESPONSE = "refused";
 
+  static final char INITIATED_STATE = 'i';
+  static final char WORKING_STATE = 'w';
+  static final char READY_FOR_CLEANING = 'r';
+  static final char FAILED_STATE = 'f';
+  static final char SUCCEEDED_STATE = 's';
+  static final char DID_NOT_INITIATE = 'a';
+  static final char REFUSED_STATE = 'c';
+
+  // Compactor types
+  static final char MAJOR_TYPE = 'a';
+  static final char MINOR_TYPE = 'i';
+
+
+  static final String COMPACTOR_MAJOR_TYPE = "MAJOR";
+  static final String COMPACTOR_MINOR_TYPE = "MINOR";
+
+  static final String TXN_TMP_STATE = "_";
+
+  static final String DEFAULT_POOL_NAME = "default";
+
+
+  // Lock states
+  static final char LOCK_ACQUIRED = 'a';
+  static final  char LOCK_WAITING = 'w';
+
+  static final int ALLOWED_REPEATED_DEADLOCKS = 10;

Review Comment:
   fixed



-- 
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


[GitHub] [hive] deniskuzZ commented on a diff in pull request #3608: HIVE-13353: SHOW COMPACTIONS should support filtering options

Posted by GitBox <gi...@apache.org>.
deniskuzZ commented on code in PR #3608:
URL: https://github.com/apache/hive/pull/3608#discussion_r1003354908


##########
standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java:
##########
@@ -4362,4 +4353,6 @@ ReplicationMetricList getReplicationMetrics(GetReplicationMetricsRequest
    * @throws TException
    */
   List<WriteEventInfo> getAllWriteEventInfo(GetAllWriteEventInfoRequest request) throws TException;
+  ShowCompactResponse showCompactions(ShowCompactRequest request) throws TException;

Review Comment:
   fixed



-- 
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


[GitHub] [hive] rkirtir commented on a diff in pull request #3608: HIVE-13353: SHOW COMPACTIONS should support filtering options

Posted by GitBox <gi...@apache.org>.
rkirtir commented on code in PR #3608:
URL: https://github.com/apache/hive/pull/3608#discussion_r992111411


##########
ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java:
##########
@@ -105,10 +105,7 @@
 import org.apache.hadoop.hive.conf.Constants;
 import org.apache.hadoop.hive.conf.HiveConf;
 import org.apache.hadoop.hive.conf.HiveConf.ConfVars;
-import org.apache.hadoop.hive.metastore.api.CompactionRequest;
-import org.apache.hadoop.hive.metastore.api.GetPartitionsByNamesRequest;
-import org.apache.hadoop.hive.metastore.api.GetTableRequest;
-import org.apache.hadoop.hive.metastore.api.UpdateTransactionalStatsRequest;
+import org.apache.hadoop.hive.metastore.api.*;

Review Comment:
   done



##########
ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java:
##########
@@ -5875,6 +5802,15 @@ public ShowCompactResponse showCompactions(String poolName) throws HiveException
     }
   }
 
+  public ShowCompactResponse showCompactions(ShowCompactRequest request) throws HiveException {

Review Comment:
   resolved



-- 
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


[GitHub] [hive] sonarcloud[bot] commented on pull request #3608: HIVE-13353: SHOW COMPACTIONS should support filtering options

Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on PR #3608:
URL: https://github.com/apache/hive/pull/3608#issuecomment-1284927094

   Kudos, SonarCloud Quality Gate passed!&nbsp; &nbsp; [![Quality Gate passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=3608)
   
   [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=BUG)  
   [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=VULNERABILITY)  
   [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=3608&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=3608&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=3608&resolved=false&types=SECURITY_HOTSPOT)  
   [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=CODE_SMELL) [5 Code Smells](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=CODE_SMELL)
   
   [![No Coverage information](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/NoCoverageInfo-16px.png 'No Coverage information')](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=3608&metric=coverage&view=list) No Coverage information  
   [![No Duplication information](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/NoDuplicationInfo-16px.png 'No Duplication information')](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=3608&metric=duplicated_lines_density&view=list) No Duplication information
   
   


-- 
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


[GitHub] [hive] sonarcloud[bot] commented on pull request #3608: HIVE-13353: SHOW COMPACTIONS should support filtering options

Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on PR #3608:
URL: https://github.com/apache/hive/pull/3608#issuecomment-1285241752

   Kudos, SonarCloud Quality Gate passed!&nbsp; &nbsp; [![Quality Gate passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=3608)
   
   [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=BUG)  
   [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=VULNERABILITY)  
   [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=3608&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=3608&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=3608&resolved=false&types=SECURITY_HOTSPOT)  
   [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=CODE_SMELL) [8 Code Smells](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=CODE_SMELL)
   
   [![No Coverage information](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/NoCoverageInfo-16px.png 'No Coverage information')](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=3608&metric=coverage&view=list) No Coverage information  
   [![No Duplication information](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/NoDuplicationInfo-16px.png 'No Duplication information')](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=3608&metric=duplicated_lines_density&view=list) No Duplication information
   
   


-- 
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


[GitHub] [hive] rkirtir commented on a diff in pull request #3608: HIVE-13353: SHOW COMPACTIONS should support filtering options

Posted by GitBox <gi...@apache.org>.
rkirtir commented on code in PR #3608:
URL: https://github.com/apache/hive/pull/3608#discussion_r1002002999


##########
ql/src/java/org/apache/hadoop/hive/ql/ddl/process/show/compactions/ShowCompactionsOperation.java:
##########
@@ -68,6 +76,37 @@ public int execute() throws HiveException {
     return 0;
   }
 
+  private ShowCompactRequest getShowCompactioRequest(ShowCompactionsDesc desc) throws MetaException, SemanticException {
+    ShowCompactRequest request = new ShowCompactRequest();
+    if (isBlank(desc.getDbName() )&& isNotBlank(desc.getTbName())) {
+      request.setDbname(SessionState.get().getCurrentDatabase());
+    } else {
+      request.setDbname(desc.getDbName());
+    }
+    if (isNotBlank(desc.getTbName()))
+      request.setTablename(desc.getTbName());
+    if (isNotBlank(desc.getPoolName()))
+      request.setPoolName(desc.getPoolName());
+    if (isNotBlank(desc.getCompactionType()))
+      request.setType(TxnUtils.inputCompactionType2DBType(desc.getCompactionType()));
+    if (isNotBlank(desc.getCompactionStatus()))
+      request.setState(TxnUtils.compactorStateFromInput(desc.getCompactionStatus()));
+    if (isNotEmpty(desc.getPartSpec()))
+      request.setPartitionname(getPartitionName(desc.getPartSpec()));
+    return request;
+  }
+
+  private String getPartitionName(Map<String, String> partitionSpec) throws SemanticException {

Review Comment:
   added in AcidUtils



-- 
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


[GitHub] [hive] rkirtir commented on a diff in pull request #3608: HIVE-13353: SHOW COMPACTIONS should support filtering options

Posted by GitBox <gi...@apache.org>.
rkirtir commented on code in PR #3608:
URL: https://github.com/apache/hive/pull/3608#discussion_r1002002776


##########
parser/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g:
##########
@@ -1334,7 +1336,12 @@ showStatement
       |
       (parttype=partTypeExpr)? (isExtended=KW_EXTENDED)? -> ^(TOK_SHOWLOCKS $parttype? $isExtended?)
       )
-    | KW_SHOW KW_COMPACTIONS compactPool? -> ^(TOK_SHOW_COMPACTIONS compactPool?)
+    | KW_SHOW KW_COMPACTIONS

Review Comment:
   added this support



-- 
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


[GitHub] [hive] deniskuzZ commented on a diff in pull request #3608: HIVE-13353: SHOW COMPACTIONS should support filtering options

Posted by GitBox <gi...@apache.org>.
deniskuzZ commented on code in PR #3608:
URL: https://github.com/apache/hive/pull/3608#discussion_r1000751495


##########
ql/src/java/org/apache/hadoop/hive/ql/ddl/process/show/compactions/ShowCompactionsOperation.java:
##########
@@ -68,6 +76,37 @@ public int execute() throws HiveException {
     return 0;
   }
 
+  private ShowCompactRequest getShowCompactioRequest(ShowCompactionsDesc desc) throws MetaException, SemanticException {
+    ShowCompactRequest request = new ShowCompactRequest();
+    if (isBlank(desc.getDbName() )&& isNotBlank(desc.getTbName())) {

Review Comment:
   nit: formatting



-- 
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


[GitHub] [hive] rkirtir commented on a diff in pull request #3608: HIVE-13353: SHOW COMPACTIONS should support filtering options

Posted by GitBox <gi...@apache.org>.
rkirtir commented on code in PR #3608:
URL: https://github.com/apache/hive/pull/3608#discussion_r992111784


##########
ql/src/java/org/apache/hadoop/hive/ql/ddl/process/show/compactions/ShowCompactionsAnalyzer.java:
##########
@@ -40,20 +42,41 @@ public ShowCompactionsAnalyzer(QueryState queryState) throws SemanticException {
 
   @Override
   public void analyzeInternal(ASTNode root) throws SemanticException {
+    ctx.setResFile(ctx.getLocalTmpPath());
     String poolName = null;
-    Tree pool = root.getChild(0);
-    if (pool != null) {
-      if (pool.getType() != HiveParser.TOK_COMPACT_POOL) {
-        throw new SemanticException("Unknown token, 'POOL' expected.");
-      } else {
-        poolName = unescapeSQLString(pool.getChild(0).getText());
+    String dbName = null;
+    String tbName = null;
+    String compactionType = null;
+    String compactionStatus = null;
+    Map<String, String> partitionSpec = null;
+    if (root.getChildCount() > 6) {
+      throw new SemanticException(ErrorMsg.INVALID_AST_TREE.getMsg(root.toStringTree()));
+    }
+    if (root.getType() == HiveParser.TOK_SHOW_COMPACTIONS && root.getChildCount() >= 1) {
+      for (int i = 0; i < root.getChildCount(); i++) {
+        ASTNode child = (ASTNode) root.getChild(i);
+        if (child.getType() == HiveParser.TOK_TABTYPE) {
+          tbName = child.getChild(0).getText();
+          // get partition metadata if partition specified
+          if (child.getChildCount() == 2) {
+            dbName = DDLUtils.getFQName((ASTNode) child.getChild(0).getChild(0));

Review Comment:
   resolved



-- 
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


[GitHub] [hive] sonarcloud[bot] commented on pull request #3608: HIVE-13353: SHOW COMPACTIONS should support filtering options

Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on PR #3608:
URL: https://github.com/apache/hive/pull/3608#issuecomment-1274129207

   Kudos, SonarCloud Quality Gate passed!&nbsp; &nbsp; [![Quality Gate passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=3608)
   
   [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=BUG)  
   [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=VULNERABILITY)  
   [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=3608&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=3608&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=3608&resolved=false&types=SECURITY_HOTSPOT)  
   [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=CODE_SMELL) [6 Code Smells](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=CODE_SMELL)
   
   [![No Coverage information](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/NoCoverageInfo-16px.png 'No Coverage information')](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=3608&metric=coverage&view=list) No Coverage information  
   [![No Duplication information](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/NoDuplicationInfo-16px.png 'No Duplication information')](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=3608&metric=duplicated_lines_density&view=list) No Duplication information
   
   


-- 
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


[GitHub] [hive] deniskuzZ commented on a diff in pull request #3608: HIVE-13353: SHOW COMPACTIONS should support filtering options

Posted by GitBox <gi...@apache.org>.
deniskuzZ commented on code in PR #3608:
URL: https://github.com/apache/hive/pull/3608#discussion_r1000753377


##########
ql/src/java/org/apache/hadoop/hive/ql/ddl/process/show/compactions/ShowCompactionsOperation.java:
##########
@@ -68,6 +76,37 @@ public int execute() throws HiveException {
     return 0;
   }
 
+  private ShowCompactRequest getShowCompactioRequest(ShowCompactionsDesc desc) throws MetaException, SemanticException {
+    ShowCompactRequest request = new ShowCompactRequest();
+    if (isBlank(desc.getDbName() )&& isNotBlank(desc.getTbName())) {
+      request.setDbname(SessionState.get().getCurrentDatabase());
+    } else {
+      request.setDbname(desc.getDbName());
+    }
+    if (isNotBlank(desc.getTbName()))

Review Comment:
   wrap if block with curly braces



-- 
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


[GitHub] [hive] deniskuzZ commented on a diff in pull request #3608: HIVE-13353: SHOW COMPACTIONS should support filtering options

Posted by GitBox <gi...@apache.org>.
deniskuzZ commented on code in PR #3608:
URL: https://github.com/apache/hive/pull/3608#discussion_r1000727581


##########
ql/src/java/org/apache/hadoop/hive/ql/ddl/process/show/compactions/ShowCompactionsAnalyzer.java:
##########
@@ -40,20 +43,44 @@ public ShowCompactionsAnalyzer(QueryState queryState) throws SemanticException {
 
   @Override
   public void analyzeInternal(ASTNode root) throws SemanticException {
+    ctx.setResFile(ctx.getLocalTmpPath());
     String poolName = null;
-    Tree pool = root.getChild(0);
-    if (pool != null) {
-      if (pool.getType() != HiveParser.TOK_COMPACT_POOL) {
-        throw new SemanticException("Unknown token, 'POOL' expected.");
-      } else {
-        poolName = unescapeSQLString(pool.getChild(0).getText());
+    String dbName = null;
+    String tbName = null;
+    String compactionType = null;
+    String compactionStatus = null;
+    Map<String, String> partitionSpec = null;
+    if (root.getChildCount() > 6) {
+      throw new SemanticException(ErrorMsg.INVALID_AST_TREE.getMsg(root.toStringTree()));
+    }
+    if (root.getType() == HiveParser.TOK_SHOW_COMPACTIONS && root.getChildCount() >= 1) {
+      for (int i = 0; i < root.getChildCount(); i++) {
+        ASTNode child = (ASTNode) root.getChild(i);
+        if (child.getType() == HiveParser.TOK_TABTYPE) {

Review Comment:
   could we use `switch` here?



-- 
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


[GitHub] [hive] deniskuzZ commented on a diff in pull request #3608: HIVE-13353: SHOW COMPACTIONS should support filtering options

Posted by GitBox <gi...@apache.org>.
deniskuzZ commented on code in PR #3608:
URL: https://github.com/apache/hive/pull/3608#discussion_r1003296971


##########
ql/src/java/org/apache/hadoop/hive/ql/ddl/process/show/compactions/ShowCompactionsAnalyzer.java:
##########
@@ -40,20 +43,53 @@ public ShowCompactionsAnalyzer(QueryState queryState) throws SemanticException {
 
   @Override
   public void analyzeInternal(ASTNode root) throws SemanticException {
+    ctx.setResFile(ctx.getLocalTmpPath());
     String poolName = null;
-    Tree pool = root.getChild(0);
-    if (pool != null) {
-      if (pool.getType() != HiveParser.TOK_COMPACT_POOL) {
-        throw new SemanticException("Unknown token, 'POOL' expected.");
-      } else {
-        poolName = unescapeSQLString(pool.getChild(0).getText());
+    String dbName = null;
+    String tbName = null;
+    String compactionType = null;
+    String compactionStatus = null;
+    long compactionId = 0;
+    Map<String, String> partitionSpec = null;
+    if (root.getChildCount() > 6) {
+      throw new SemanticException(ErrorMsg.INVALID_AST_TREE.getMsg(root.toStringTree()));
+    }
+    if (root.getType() == HiveParser.TOK_SHOW_COMPACTIONS) {
+      for (int i = 0; i < root.getChildCount(); i++) {
+        ASTNode child = (ASTNode) root.getChild(i);
+        switch (child.getType()) {
+          case HiveParser.TOK_TABTYPE:
+            tbName = child.getChild(0).getText();
+            if (child.getChildCount() == 2) {
+              if (child.getChild(0).getChildCount() == 2) {
+                dbName = DDLUtils.getFQName((ASTNode) child.getChild(0).getChild(0));
+                tbName = DDLUtils.getFQName((ASTNode) child.getChild(0).getChild(1));
+              }
+              ASTNode partitionSpecNode = (ASTNode) child.getChild(1);
+              partitionSpec = getValidatedPartSpec(getTable(dbName, tbName, true), partitionSpecNode, conf, false);
+            }
+            break;
+          case HiveParser.TOK_COMPACT_POOL:
+            poolName = unescapeSQLString(child.getChild(0).getText());
+            break;
+          case HiveParser.TOK_COMPACTION_TYPE:
+            compactionType = unescapeSQLString(child.getChild(0).getText());
+            break;
+          case HiveParser.TOK_COMPACTION_STATUS:
+            compactionStatus = unescapeSQLString(child.getChild(0).getText());
+            break;
+          case HiveParser.TOK_COMPACT_ID:
+           compactionId = Long.parseLong(child.getChild(0).getText());
+           break;
+          default:
+            dbName = child.getText();

Review Comment:
   TOK_TABTYPE won't handle provided SCHEMA, Identity will



-- 
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


[GitHub] [hive] rkirtir commented on a diff in pull request #3608: HIVE-13353: SHOW COMPACTIONS should support filtering options

Posted by GitBox <gi...@apache.org>.
rkirtir commented on code in PR #3608:
URL: https://github.com/apache/hive/pull/3608#discussion_r990899203


##########
ql/src/java/org/apache/hadoop/hive/ql/ddl/process/show/compactions/ShowCompactionsOperation.java:
##########
@@ -39,16 +43,27 @@
  * Operation process of showing compactions.
  */
 public class ShowCompactionsOperation extends DDLOperation<ShowCompactionsDesc> {
+
+  static final protected String MAJOR_TYPE = "MAJOR";
+  static final protected String MINOR_TYPE = "MINOR";
+  static final char INITIATED_STATE = 'i';

Review Comment:
   Agree. Addressing the same



-- 
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


[GitHub] [hive] sonarcloud[bot] commented on pull request #3608: HIVE-13353: SHOW COMPACTIONS should support filtering options

Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on PR #3608:
URL: https://github.com/apache/hive/pull/3608#issuecomment-1290037784

   Kudos, SonarCloud Quality Gate passed!&nbsp; &nbsp; [![Quality Gate passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=3608)
   
   [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=BUG)  
   [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=VULNERABILITY)  
   [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=3608&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=3608&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=3608&resolved=false&types=SECURITY_HOTSPOT)  
   [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=CODE_SMELL) [5 Code Smells](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=CODE_SMELL)
   
   [![No Coverage information](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/NoCoverageInfo-16px.png 'No Coverage information')](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=3608&metric=coverage&view=list) No Coverage information  
   [![No Duplication information](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/NoDuplicationInfo-16px.png 'No Duplication information')](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=3608&metric=duplicated_lines_density&view=list) No Duplication information
   
   


-- 
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


[GitHub] [hive] veghlaci05 commented on pull request #3608: HIVE-13353: SHOW COMPACTIONS should support filtering options

Posted by GitBox <gi...@apache.org>.
veghlaci05 commented on PR #3608:
URL: https://github.com/apache/hive/pull/3608#issuecomment-1271470873

   Please check:
   org/apache/hadoop/hive/ql/ddl/table/storage/compact/AlterTableCompactOperation.java:130


-- 
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


[GitHub] [hive] rkirtir commented on a diff in pull request #3608: HIVE-13353: SHOW COMPACTIONS should support filtering options

Posted by GitBox <gi...@apache.org>.
rkirtir commented on code in PR #3608:
URL: https://github.com/apache/hive/pull/3608#discussion_r990898791


##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/TxnHandler.java:
##########
@@ -3970,6 +3960,78 @@ public ShowCompactResponse showCompact(ShowCompactRequest rqst) throws MetaExcep
     }
   }
 
+  private List<String> getShowCompactionQueryParamList(ShowCompactRequest request) throws MetaException {
+    String dbName = request.getDbname();
+    String tableName = request.getTablename();
+    String partName = request.getPartitionname();
+    CompactionType type = request.getType();
+    String state = request.getState();
+    String poolName = request.getPoolName();
+    List<String> params = new ArrayList<>();
+    if (dbName != null && !dbName.isEmpty()) {
+      params.add(dbName);
+    }
+    if (tableName != null && !tableName.isEmpty()) {

Review Comment:
   Agree. Addressing the same



-- 
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


[GitHub] [hive] rkirtir commented on a diff in pull request #3608: HIVE-13353: SHOW COMPACTIONS should support filtering options

Posted by GitBox <gi...@apache.org>.
rkirtir commented on code in PR #3608:
URL: https://github.com/apache/hive/pull/3608#discussion_r992955835


##########
ql/src/test/org/apache/hadoop/hive/ql/TestTxnCommands.java:
##########
@@ -2117,4 +2121,211 @@ public void testIsRawFormatFile() throws Exception {
     List<String> res = runStatementOnDriver("select * from file_formats");
     Assert.assertEquals(3, res.size());
   }
+  @Test
+  public void testShowCompactions() throws Exception {
+    d.destroy();
+    hiveConf.setVar(HiveConf.ConfVars.DYNAMICPARTITIONINGMODE, "nonstrict");
+    d = new Driver(hiveConf);
+    //generate some compaction history
+    runStatementOnDriver("drop database if exists mydb1 cascade");
+    runStatementOnDriver("create database mydb1");
+    runStatementOnDriver("create table mydb1.tbl0 " + "(a int, b int) partitioned by (p string) clustered by (a) into " +
+      BUCKET_COUNT + " buckets stored as orc TBLPROPERTIES ('transactional'='true')");
+    runStatementOnDriver("insert into mydb1.tbl0" + " PARTITION(p) " +
+      " values(1,2,'p1'),(3,4,'p1'),(1,2,'p2'),(3,4,'p2'),(1,2,'p3'),(3,4,'p3')");
+    runStatementOnDriver("alter table mydb1.tbl0" + " PARTITION(p='p1') compact 'MAJOR'");
+    TestTxnCommands2.runWorker(hiveConf);
+    runStatementOnDriver("alter table mydb1.tbl0" + " PARTITION(p='p2') compact 'MAJOR'");
+    TestTxnCommands2.runWorker(hiveConf);
+    runStatementOnDriver("alter table mydb1.tbl0" + " PARTITION(p='p3') compact 'MAJOR'");
+    TestTxnCommands2.runWorker(hiveConf);
+    runStatementOnDriver("insert into mydb1.tbl0" + " PARTITION(p) " +
+      " values(4,5,'p1'),(6,7,'p1'),(4,5,'p2'),(6,7,'p2'),(4,5,'p3'),(6,7,'p3')");
+    runStatementOnDriver("alter table mydb1.tbl0" + " PARTITION (p='p1') compact 'MAJOR'");
+    TestTxnCommands2.runWorker(hiveConf);
+    runStatementOnDriver("alter table mydb1.tbl0" + " PARTITION (p='p2') compact 'MAJOR'");
+    TestTxnCommands2.runWorker(hiveConf);
+    runStatementOnDriver("alter table mydb1.tbl0" + " PARTITION (p='p3')  compact 'MAJOR' pool 'pool0'");
+    TestTxnCommands2.runWorker(hiveConf);
+    TxnStore txnHandler = TxnUtils.getTxnStore(hiveConf);
+
+    SessionState.get().setCurrentDatabase("mydb1");
+
+    //testing show compaction command
+    ShowCompactResponse rsp = txnHandler.showCompact(new ShowCompactRequest());
+    List<String> r = runStatementOnDriver("SHOW COMPACTIONS");
+    Assert.assertEquals(rsp.getCompacts().size()+1, r.size());//includes Header row
+
+
+    r = runStatementOnDriver("SHOW COMPACTIONS SCHEMA mydb1 STATUS 'ready for cleaning'");
+    Assert.assertEquals(rsp.getCompacts().stream().filter(x->x.getState().equals("ready for cleaning")).count() +1,
+      r.size());//includes Header row
+    r = runStatementOnDriver("SHOW COMPACTIONS SCHEMA mydb1 TYPE 'MAJOR' ");
+    Assert.assertEquals(rsp.getCompacts().stream().filter(x->x.getDbname().equals("mydb1")).
+      filter(x->x.getType().equals(CompactionType.MAJOR)).count()+1, r.size());//includes Header row
+
+    r = runStatementOnDriver("SHOW COMPACTIONS SCHEMA mydb1 POOL 'poolx' TYPE 'MINOR' ");
+    //includes Header row
+    Assert.assertEquals(rsp.getCompacts().stream().filter(x->x.getDbname().equals("mydb1")).
+      filter(x->x.getPoolName().equals("poolx")).filter(x->x.getType().equals(CompactionType.MINOR)).count(),
+      r.stream().filter(x->x.equals("mydb1")).filter(x->x.equals("poolx")).filter(x->x.equals(CompactionType.MINOR)).count());
+
+    r = runStatementOnDriver("SHOW COMPACTIONS SCHEMA mydb1 POOL 'pool0' TYPE 'MAJOR'");
+    Assert.assertEquals(2, r.size());//includes Header row
+
+
+    r = runStatementOnDriver("SHOW COMPACTIONS SCHEMA mydb1 POOL 'pool0'");
+    Assert.assertEquals(rsp.getCompacts().stream().filter(x->x.getDbname().equals("mydb1")).
+      filter(x->x.getPoolName().equals("pool0")).count()+1, r.size());//includes Header row
+    r = runStatementOnDriver("SHOW COMPACTIONS DATABASE mydb1 POOL 'pool0'");
+    Assert.assertEquals(2, r.size());//includes Header row
+
+    r = runStatementOnDriver("SHOW COMPACTIONS tbl0 TYPE 'MAJOR' ");
+    Assert.assertEquals(rsp.getCompacts().stream().filter(x->x.getTablename().equals("tbl0")).
+      filter(x->x.getType().equals(CompactionType.MAJOR)).count()+1, r.size());//includes Header row
+
+    List<String> partitions = runStatementOnDriver("SHOW PARTITIONS mydb1.tbl0 ");

Review Comment:
   I had asserted partitions just to be sure of things. Agree.. removing it



-- 
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


[GitHub] [hive] veghlaci05 commented on a diff in pull request #3608: HIVE-13353: SHOW COMPACTIONS should support filtering options

Posted by GitBox <gi...@apache.org>.
veghlaci05 commented on code in PR #3608:
URL: https://github.com/apache/hive/pull/3608#discussion_r990966219


##########
ql/src/test/org/apache/hadoop/hive/ql/TestTxnCommands.java:
##########
@@ -2117,4 +2121,168 @@ public void testIsRawFormatFile() throws Exception {
     List<String> res = runStatementOnDriver("select * from file_formats");
     Assert.assertEquals(3, res.size());
   }
+  @Test
+  public void testShowCompactions() throws Exception {
+    d.destroy();
+    hiveConf.setVar(HiveConf.ConfVars.DYNAMICPARTITIONINGMODE, "nonstrict");
+    d = new Driver(hiveConf);
+    //generate some compaction history
+    runStatementOnDriver("drop database if exists mydb1 cascade");
+    runStatementOnDriver("create database mydb1");
+    runStatementOnDriver("create table mydb1.tbl0 " + "(a int, b int) partitioned by (p string) clustered by (a) into " +
+      BUCKET_COUNT + " buckets stored as orc TBLPROPERTIES ('transactional'='true')");
+    runStatementOnDriver("insert into mydb1.tbl0" + " PARTITION(p) " +
+      " values(1,2,'p1'),(3,4,'p1'),(1,2,'p2'),(3,4,'p2'),(1,2,'p3'),(3,4,'p3')");
+    runStatementOnDriver("alter table mydb1.tbl0" + " PARTITION(p='p1') compact 'MAJOR'");
+    TestTxnCommands2.runWorker(hiveConf);
+    runStatementOnDriver("alter table mydb1.tbl0" + " PARTITION(p='p2') compact 'MAJOR'");
+    TestTxnCommands2.runWorker(hiveConf);
+    runStatementOnDriver("alter table mydb1.tbl0" + " PARTITION(p='p3') compact 'MAJOR'");
+    TestTxnCommands2.runWorker(hiveConf);
+    runStatementOnDriver("insert into mydb1.tbl0" + " PARTITION(p) " +
+      " values(4,5,'p1'),(6,7,'p1'),(4,5,'p2'),(6,7,'p2'),(4,5,'p3'),(6,7,'p3')");
+    runStatementOnDriver("alter table mydb1.tbl0" + " PARTITION (p='p1') compact 'MAJOR'");
+    TestTxnCommands2.runWorker(hiveConf);
+    runStatementOnDriver("alter table mydb1.tbl0" + " PARTITION (p='p2') compact 'MAJOR'");
+    TestTxnCommands2.runWorker(hiveConf);
+    runStatementOnDriver("alter table mydb1.tbl0" + " PARTITION (p='p3')  compact 'MAJOR' pool 'pool0'");
+    TestTxnCommands2.runWorker(hiveConf);
+    TxnStore txnHandler = TxnUtils.getTxnStore(hiveConf);
+
+    SessionState.get().setCurrentDatabase("mydb1");
+
+    //testing show compaction command
+    ShowCompactResponse rsp = txnHandler.showCompact(new ShowCompactRequest());
+    List<String> r = runStatementOnDriver("SHOW COMPACTIONS");
+    Assert.assertEquals(rsp.getCompacts().size()+1, r.size());//includes Header row
+
+
+    r = runStatementOnDriver("SHOW COMPACTIONS SCHEMA mydb1 STATUS 'ready for cleaning'");
+    Assert.assertEquals(rsp.getCompacts().stream().filter(x->x.getState().equals("ready for cleaning")).count() +1,

Review Comment:
   Your are only checking here that the driver command result contains the same amount of records with ready for cleaning state, than rsp has. You should also compare  (at least partially) the content of the driver result. What if the returned counts are equal but the returned row is something completely different?



##########
ql/src/test/org/apache/hadoop/hive/ql/TestTxnCommands.java:
##########
@@ -2117,4 +2121,168 @@ public void testIsRawFormatFile() throws Exception {
     List<String> res = runStatementOnDriver("select * from file_formats");
     Assert.assertEquals(3, res.size());
   }
+  @Test
+  public void testShowCompactions() throws Exception {
+    d.destroy();
+    hiveConf.setVar(HiveConf.ConfVars.DYNAMICPARTITIONINGMODE, "nonstrict");
+    d = new Driver(hiveConf);
+    //generate some compaction history
+    runStatementOnDriver("drop database if exists mydb1 cascade");
+    runStatementOnDriver("create database mydb1");
+    runStatementOnDriver("create table mydb1.tbl0 " + "(a int, b int) partitioned by (p string) clustered by (a) into " +
+      BUCKET_COUNT + " buckets stored as orc TBLPROPERTIES ('transactional'='true')");
+    runStatementOnDriver("insert into mydb1.tbl0" + " PARTITION(p) " +
+      " values(1,2,'p1'),(3,4,'p1'),(1,2,'p2'),(3,4,'p2'),(1,2,'p3'),(3,4,'p3')");
+    runStatementOnDriver("alter table mydb1.tbl0" + " PARTITION(p='p1') compact 'MAJOR'");
+    TestTxnCommands2.runWorker(hiveConf);
+    runStatementOnDriver("alter table mydb1.tbl0" + " PARTITION(p='p2') compact 'MAJOR'");
+    TestTxnCommands2.runWorker(hiveConf);
+    runStatementOnDriver("alter table mydb1.tbl0" + " PARTITION(p='p3') compact 'MAJOR'");
+    TestTxnCommands2.runWorker(hiveConf);
+    runStatementOnDriver("insert into mydb1.tbl0" + " PARTITION(p) " +
+      " values(4,5,'p1'),(6,7,'p1'),(4,5,'p2'),(6,7,'p2'),(4,5,'p3'),(6,7,'p3')");
+    runStatementOnDriver("alter table mydb1.tbl0" + " PARTITION (p='p1') compact 'MAJOR'");
+    TestTxnCommands2.runWorker(hiveConf);
+    runStatementOnDriver("alter table mydb1.tbl0" + " PARTITION (p='p2') compact 'MAJOR'");
+    TestTxnCommands2.runWorker(hiveConf);
+    runStatementOnDriver("alter table mydb1.tbl0" + " PARTITION (p='p3')  compact 'MAJOR' pool 'pool0'");
+    TestTxnCommands2.runWorker(hiveConf);
+    TxnStore txnHandler = TxnUtils.getTxnStore(hiveConf);
+
+    SessionState.get().setCurrentDatabase("mydb1");
+
+    //testing show compaction command
+    ShowCompactResponse rsp = txnHandler.showCompact(new ShowCompactRequest());
+    List<String> r = runStatementOnDriver("SHOW COMPACTIONS");
+    Assert.assertEquals(rsp.getCompacts().size()+1, r.size());//includes Header row
+
+
+    r = runStatementOnDriver("SHOW COMPACTIONS SCHEMA mydb1 STATUS 'ready for cleaning'");
+    Assert.assertEquals(rsp.getCompacts().stream().filter(x->x.getState().equals("ready for cleaning")).count() +1,
+      r.size());//includes Header row
+
+    r = runStatementOnDriver("SHOW COMPACTIONS SCHEMA mydb1 TYPE 'MAJOR' ");
+    Assert.assertEquals(rsp.getCompacts().stream().filter(x->x.getDbname().equals("mydb1")).
+      filter(x->x.getType().equals(CompactionType.MAJOR)).count()+1, r.size());//includes Header row
+
+    r = runStatementOnDriver("SHOW COMPACTIONS SCHEMA mydb1 POOL 'poolx' TYPE 'MINOR' ");
+    //includes Header row
+    Assert.assertEquals(rsp.getCompacts().stream().filter(x->x.getDbname().equals("mydb1")).
+      filter(x->x.getPoolName().equals("poolx")).filter(x->x.getType().equals(CompactionType.MAJOR)).count()+1, r.size());
+
+    r = runStatementOnDriver("SHOW COMPACTIONS SCHEMA mydb1 POOL 'pool0' TYPE 'MAJOR'");
+    Assert.assertEquals(2, r.size());//includes Header row
+
+    r = runStatementOnDriver("SHOW COMPACTIONS SCHEMA mydb1 POOL 'pool0'");
+    Assert.assertEquals(rsp.getCompacts().stream().filter(x->x.getDbname().equals("mydb1")).
+      filter(x->x.getPoolName().equals("pool0")).count()+1, r.size());//includes Header row
+
+    r = runStatementOnDriver("SHOW COMPACTIONS DATABASE mydb1 POOL 'pool0'");
+    Assert.assertEquals(2, r.size());//includes Header row
+
+    r = runStatementOnDriver("SHOW COMPACTIONS tbl0 TYPE 'MAJOR' ");

Review Comment:
   Ok. Altough I still think this is a bit odd, I discussed it with @kasakrisz and he mentioned that SHOW LOCKS works the same way and you agreed to copy it. For consistency between these similar commands I think it's fine.



-- 
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


[GitHub] [hive] rkirtir commented on a diff in pull request #3608: HIVE-13353: SHOW COMPACTIONS should support filtering options

Posted by GitBox <gi...@apache.org>.
rkirtir commented on code in PR #3608:
URL: https://github.com/apache/hive/pull/3608#discussion_r993012258


##########
ql/src/test/org/apache/hadoop/hive/ql/TestTxnCommands.java:
##########
@@ -2117,4 +2121,211 @@ public void testIsRawFormatFile() throws Exception {
     List<String> res = runStatementOnDriver("select * from file_formats");
     Assert.assertEquals(3, res.size());
   }
+  @Test
+  public void testShowCompactions() throws Exception {
+    d.destroy();
+    hiveConf.setVar(HiveConf.ConfVars.DYNAMICPARTITIONINGMODE, "nonstrict");
+    d = new Driver(hiveConf);
+    //generate some compaction history
+    runStatementOnDriver("drop database if exists mydb1 cascade");
+    runStatementOnDriver("create database mydb1");
+    runStatementOnDriver("create table mydb1.tbl0 " + "(a int, b int) partitioned by (p string) clustered by (a) into " +
+      BUCKET_COUNT + " buckets stored as orc TBLPROPERTIES ('transactional'='true')");
+    runStatementOnDriver("insert into mydb1.tbl0" + " PARTITION(p) " +
+      " values(1,2,'p1'),(3,4,'p1'),(1,2,'p2'),(3,4,'p2'),(1,2,'p3'),(3,4,'p3')");
+    runStatementOnDriver("alter table mydb1.tbl0" + " PARTITION(p='p1') compact 'MAJOR'");
+    TestTxnCommands2.runWorker(hiveConf);
+    runStatementOnDriver("alter table mydb1.tbl0" + " PARTITION(p='p2') compact 'MAJOR'");
+    TestTxnCommands2.runWorker(hiveConf);
+    runStatementOnDriver("alter table mydb1.tbl0" + " PARTITION(p='p3') compact 'MAJOR'");
+    TestTxnCommands2.runWorker(hiveConf);
+    runStatementOnDriver("insert into mydb1.tbl0" + " PARTITION(p) " +
+      " values(4,5,'p1'),(6,7,'p1'),(4,5,'p2'),(6,7,'p2'),(4,5,'p3'),(6,7,'p3')");
+    runStatementOnDriver("alter table mydb1.tbl0" + " PARTITION (p='p1') compact 'MAJOR'");
+    TestTxnCommands2.runWorker(hiveConf);
+    runStatementOnDriver("alter table mydb1.tbl0" + " PARTITION (p='p2') compact 'MAJOR'");
+    TestTxnCommands2.runWorker(hiveConf);
+    runStatementOnDriver("alter table mydb1.tbl0" + " PARTITION (p='p3')  compact 'MAJOR' pool 'pool0'");
+    TestTxnCommands2.runWorker(hiveConf);
+    TxnStore txnHandler = TxnUtils.getTxnStore(hiveConf);
+
+    SessionState.get().setCurrentDatabase("mydb1");
+
+    //testing show compaction command
+    ShowCompactResponse rsp = txnHandler.showCompact(new ShowCompactRequest());
+    List<String> r = runStatementOnDriver("SHOW COMPACTIONS");
+    Assert.assertEquals(rsp.getCompacts().size()+1, r.size());//includes Header row
+
+
+    r = runStatementOnDriver("SHOW COMPACTIONS SCHEMA mydb1 STATUS 'ready for cleaning'");
+    Assert.assertEquals(rsp.getCompacts().stream().filter(x->x.getState().equals("ready for cleaning")).count() +1,
+      r.size());//includes Header row
+    r = runStatementOnDriver("SHOW COMPACTIONS SCHEMA mydb1 TYPE 'MAJOR' ");
+    Assert.assertEquals(rsp.getCompacts().stream().filter(x->x.getDbname().equals("mydb1")).
+      filter(x->x.getType().equals(CompactionType.MAJOR)).count()+1, r.size());//includes Header row
+
+    r = runStatementOnDriver("SHOW COMPACTIONS SCHEMA mydb1 POOL 'poolx' TYPE 'MINOR' ");
+    //includes Header row
+    Assert.assertEquals(rsp.getCompacts().stream().filter(x->x.getDbname().equals("mydb1")).
+      filter(x->x.getPoolName().equals("poolx")).filter(x->x.getType().equals(CompactionType.MINOR)).count(),
+      r.stream().filter(x->x.equals("mydb1")).filter(x->x.equals("poolx")).filter(x->x.equals(CompactionType.MINOR)).count());

Review Comment:
   done all above. While adding these test, I had to add below condition in ShowColumnsAnalyzer
   
   else
             dbName = child.getText();
         }



-- 
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


[GitHub] [hive] sonarcloud[bot] commented on pull request #3608: [WIP] HIVE-13353: SHOW COMPACTIONS should support filtering options

Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on PR #3608:
URL: https://github.com/apache/hive/pull/3608#issuecomment-1263806616

   Kudos, SonarCloud Quality Gate passed!&nbsp; &nbsp; [![Quality Gate passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=3608)
   
   [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=BUG)  
   [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=VULNERABILITY)  
   [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=3608&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=3608&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=3608&resolved=false&types=SECURITY_HOTSPOT)  
   [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=CODE_SMELL) [11 Code Smells](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=CODE_SMELL)
   
   [![No Coverage information](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/NoCoverageInfo-16px.png 'No Coverage information')](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=3608&metric=coverage&view=list) No Coverage information  
   [![No Duplication information](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/NoDuplicationInfo-16px.png 'No Duplication information')](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=3608&metric=duplicated_lines_density&view=list) No Duplication information
   
   


-- 
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


[GitHub] [hive] deniskuzZ commented on a diff in pull request #3608: HIVE-13353: SHOW COMPACTIONS should support filtering options

Posted by GitBox <gi...@apache.org>.
deniskuzZ commented on code in PR #3608:
URL: https://github.com/apache/hive/pull/3608#discussion_r1000765761


##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/TxnUtils.java:
##########
@@ -565,4 +566,75 @@ public static String findUserToRunAs(String location, Table t, Configuration con
         UserGroupInformation.getLoginUser(), t.getOwner());
     throw new IOException("Unable to stat file: " + p);
   }
+
+  public static String compactorStateToResponse(char s) {

Review Comment:
   same methods is in TxnHandler, should we remove it from there?



-- 
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


[GitHub] [hive] sonarcloud[bot] commented on pull request #3608: HIVE-13353: SHOW COMPACTIONS should support filtering options

Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on PR #3608:
URL: https://github.com/apache/hive/pull/3608#issuecomment-1272117682

   Kudos, SonarCloud Quality Gate passed!&nbsp; &nbsp; [![Quality Gate passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=3608)
   
   [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=BUG) [![C](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/C-16px.png 'C')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=BUG) [6 Bugs](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=BUG)  
   [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=VULNERABILITY)  
   [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=3608&resolved=false&types=SECURITY_HOTSPOT) [![E](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/E-16px.png 'E')](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=3608&resolved=false&types=SECURITY_HOTSPOT) [1 Security Hotspot](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=3608&resolved=false&types=SECURITY_HOTSPOT)  
   [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=CODE_SMELL) [74 Code Smells](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=CODE_SMELL)
   
   [![No Coverage information](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/NoCoverageInfo-16px.png 'No Coverage information')](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=3608&metric=coverage&view=list) No Coverage information  
   [![No Duplication information](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/NoDuplicationInfo-16px.png 'No Duplication information')](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=3608&metric=duplicated_lines_density&view=list) No Duplication information
   
   


-- 
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


[GitHub] [hive] sonarcloud[bot] commented on pull request #3608: HIVE-13353: SHOW COMPACTIONS should support filtering options

Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on PR #3608:
URL: https://github.com/apache/hive/pull/3608#issuecomment-1251848310

   Kudos, SonarCloud Quality Gate passed!&nbsp; &nbsp; [![Quality Gate passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=3608)
   
   [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=BUG) [![C](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/C-16px.png 'C')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=BUG) [2 Bugs](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=BUG)  
   [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=VULNERABILITY)  
   [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=3608&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=3608&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=3608&resolved=false&types=SECURITY_HOTSPOT)  
   [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=CODE_SMELL) [10 Code Smells](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=CODE_SMELL)
   
   [![No Coverage information](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/NoCoverageInfo-16px.png 'No Coverage information')](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=3608&metric=coverage&view=list) No Coverage information  
   [![No Duplication information](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/NoDuplicationInfo-16px.png 'No Duplication information')](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=3608&metric=duplicated_lines_density&view=list) No Duplication information
   
   


-- 
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


[GitHub] [hive] rkirtir commented on a diff in pull request #3608: HIVE-13353: SHOW COMPACTIONS should support filtering options

Posted by GitBox <gi...@apache.org>.
rkirtir commented on code in PR #3608:
URL: https://github.com/apache/hive/pull/3608#discussion_r992116708


##########
ql/src/java/org/apache/hadoop/hive/ql/ddl/process/show/compactions/ShowCompactionsOperation.java:
##########
@@ -68,6 +83,71 @@ public int execute() throws HiveException {
     return 0;
   }
 
+  private ShowCompactRequest getShowCompactioRequest(ShowCompactionsDesc desc) throws MetaException, SemanticException {
+    ShowCompactRequest request = new ShowCompactRequest();
+    if (desc.getDbName() == null && desc.getTbName() != null) {
+      request.setDbname(SessionState.get().getCurrentDatabase());
+    } else {
+      request.setDbname(desc.getDbName());
+    }
+    if (desc.getTbName() != null && !desc.getTbName().isEmpty())
+      request.setTablename(desc.getTbName());
+    if (desc.getPoolName() != null && !desc.getPoolName().isEmpty())
+      request.setPoolName(desc.getPoolName());
+    if (desc.getCompactionType() != null && !desc.getCompactionType().isEmpty())
+      request.setType(inputCompactionType2DBType(desc.getCompactionType()));
+    if (desc.getCompactionStatus() != null && !desc.getCompactionStatus().isEmpty())
+      request.setState(compactorStateFromInput(desc.getCompactionStatus()));
+    if (desc.getPartSpec() != null && !desc.getPartSpec().isEmpty())
+      request.setPartitionname(getPartitionName(desc.getPartSpec()));
+    return request;
+  }
+
+  private String getPartitionName(Map<String, String> partitionSpec) throws SemanticException {
+    String partitionName = null;
+    if (partitionSpec != null) {
+      try {
+        partitionName = Warehouse.makePartName(partitionSpec, false);
+      } catch (MetaException e) {
+        throw new SemanticException("partition " + partitionSpec.toString() + " not found");
+      }
+    }
+    return partitionName;
+  }
+
+  static CompactionType inputCompactionType2DBType(String inputValue) throws MetaException {
+    switch (inputValue.toUpperCase()) {
+      case MAJOR_TYPE:
+        return CompactionType.MAJOR;
+      case MINOR_TYPE:
+        return CompactionType.MINOR;
+      default:
+        throw new MetaException("Unexpected compaction type " + inputValue);
+    }
+  }
+
+  private String compactorStateFromInput(String s) throws MetaException {

Review Comment:
   done



-- 
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


[GitHub] [hive] rkirtir commented on a diff in pull request #3608: HIVE-13353: SHOW COMPACTIONS should support filtering options

Posted by GitBox <gi...@apache.org>.
rkirtir commented on code in PR #3608:
URL: https://github.com/apache/hive/pull/3608#discussion_r990898269


##########
ql/src/test/org/apache/hadoop/hive/ql/TestTxnCommands.java:
##########
@@ -2117,4 +2121,168 @@ public void testIsRawFormatFile() throws Exception {
     List<String> res = runStatementOnDriver("select * from file_formats");
     Assert.assertEquals(3, res.size());
   }
+  @Test
+  public void testShowCompactions() throws Exception {
+    d.destroy();
+    hiveConf.setVar(HiveConf.ConfVars.DYNAMICPARTITIONINGMODE, "nonstrict");
+    d = new Driver(hiveConf);
+    //generate some compaction history
+    runStatementOnDriver("drop database if exists mydb1 cascade");
+    runStatementOnDriver("create database mydb1");
+    runStatementOnDriver("create table mydb1.tbl0 " + "(a int, b int) partitioned by (p string) clustered by (a) into " +
+      BUCKET_COUNT + " buckets stored as orc TBLPROPERTIES ('transactional'='true')");
+    runStatementOnDriver("insert into mydb1.tbl0" + " PARTITION(p) " +
+      " values(1,2,'p1'),(3,4,'p1'),(1,2,'p2'),(3,4,'p2'),(1,2,'p3'),(3,4,'p3')");
+    runStatementOnDriver("alter table mydb1.tbl0" + " PARTITION(p='p1') compact 'MAJOR'");
+    TestTxnCommands2.runWorker(hiveConf);
+    runStatementOnDriver("alter table mydb1.tbl0" + " PARTITION(p='p2') compact 'MAJOR'");
+    TestTxnCommands2.runWorker(hiveConf);
+    runStatementOnDriver("alter table mydb1.tbl0" + " PARTITION(p='p3') compact 'MAJOR'");
+    TestTxnCommands2.runWorker(hiveConf);
+    runStatementOnDriver("insert into mydb1.tbl0" + " PARTITION(p) " +
+      " values(4,5,'p1'),(6,7,'p1'),(4,5,'p2'),(6,7,'p2'),(4,5,'p3'),(6,7,'p3')");
+    runStatementOnDriver("alter table mydb1.tbl0" + " PARTITION (p='p1') compact 'MAJOR'");
+    TestTxnCommands2.runWorker(hiveConf);
+    runStatementOnDriver("alter table mydb1.tbl0" + " PARTITION (p='p2') compact 'MAJOR'");
+    TestTxnCommands2.runWorker(hiveConf);
+    runStatementOnDriver("alter table mydb1.tbl0" + " PARTITION (p='p3')  compact 'MAJOR' pool 'pool0'");
+    TestTxnCommands2.runWorker(hiveConf);
+    TxnStore txnHandler = TxnUtils.getTxnStore(hiveConf);
+
+    SessionState.get().setCurrentDatabase("mydb1");
+
+    //testing show compaction command
+    ShowCompactResponse rsp = txnHandler.showCompact(new ShowCompactRequest());
+    List<String> r = runStatementOnDriver("SHOW COMPACTIONS");
+    Assert.assertEquals(rsp.getCompacts().size()+1, r.size());//includes Header row
+
+
+    r = runStatementOnDriver("SHOW COMPACTIONS SCHEMA mydb1 STATUS 'ready for cleaning'");
+    Assert.assertEquals(rsp.getCompacts().stream().filter(x->x.getState().equals("ready for cleaning")).count() +1,

Review Comment:
   rsp is result from  txnHandler.showCompact(new ShowCompactRequest()) 
    and  it is checked against r which is a result of driver command.
   
   
   r = runStatementOnDriver("SHOW COMPACTIONS SCHEMA mydb1 POOL 'poolx' TYPE 'MINOR' ");
       //includes Header row
   Assert.assertEquals(**rsp**.getCompacts().stream().filter(x->x.getDbname().equals("mydb1")).
         filter(x->x.getPoolName().equals("poolx")).filter(x->x.getType().equals(CompactionType.MAJOR)).count()+1, **r**.size());



##########
ql/src/test/org/apache/hadoop/hive/ql/TestTxnCommands.java:
##########
@@ -2117,4 +2121,168 @@ public void testIsRawFormatFile() throws Exception {
     List<String> res = runStatementOnDriver("select * from file_formats");
     Assert.assertEquals(3, res.size());
   }
+  @Test
+  public void testShowCompactions() throws Exception {
+    d.destroy();
+    hiveConf.setVar(HiveConf.ConfVars.DYNAMICPARTITIONINGMODE, "nonstrict");
+    d = new Driver(hiveConf);
+    //generate some compaction history
+    runStatementOnDriver("drop database if exists mydb1 cascade");
+    runStatementOnDriver("create database mydb1");
+    runStatementOnDriver("create table mydb1.tbl0 " + "(a int, b int) partitioned by (p string) clustered by (a) into " +
+      BUCKET_COUNT + " buckets stored as orc TBLPROPERTIES ('transactional'='true')");
+    runStatementOnDriver("insert into mydb1.tbl0" + " PARTITION(p) " +
+      " values(1,2,'p1'),(3,4,'p1'),(1,2,'p2'),(3,4,'p2'),(1,2,'p3'),(3,4,'p3')");
+    runStatementOnDriver("alter table mydb1.tbl0" + " PARTITION(p='p1') compact 'MAJOR'");
+    TestTxnCommands2.runWorker(hiveConf);
+    runStatementOnDriver("alter table mydb1.tbl0" + " PARTITION(p='p2') compact 'MAJOR'");
+    TestTxnCommands2.runWorker(hiveConf);
+    runStatementOnDriver("alter table mydb1.tbl0" + " PARTITION(p='p3') compact 'MAJOR'");
+    TestTxnCommands2.runWorker(hiveConf);
+    runStatementOnDriver("insert into mydb1.tbl0" + " PARTITION(p) " +
+      " values(4,5,'p1'),(6,7,'p1'),(4,5,'p2'),(6,7,'p2'),(4,5,'p3'),(6,7,'p3')");
+    runStatementOnDriver("alter table mydb1.tbl0" + " PARTITION (p='p1') compact 'MAJOR'");
+    TestTxnCommands2.runWorker(hiveConf);
+    runStatementOnDriver("alter table mydb1.tbl0" + " PARTITION (p='p2') compact 'MAJOR'");
+    TestTxnCommands2.runWorker(hiveConf);
+    runStatementOnDriver("alter table mydb1.tbl0" + " PARTITION (p='p3')  compact 'MAJOR' pool 'pool0'");
+    TestTxnCommands2.runWorker(hiveConf);
+    TxnStore txnHandler = TxnUtils.getTxnStore(hiveConf);
+
+    SessionState.get().setCurrentDatabase("mydb1");
+
+    //testing show compaction command
+    ShowCompactResponse rsp = txnHandler.showCompact(new ShowCompactRequest());
+    List<String> r = runStatementOnDriver("SHOW COMPACTIONS");
+    Assert.assertEquals(rsp.getCompacts().size()+1, r.size());//includes Header row
+
+
+    r = runStatementOnDriver("SHOW COMPACTIONS SCHEMA mydb1 STATUS 'ready for cleaning'");
+    Assert.assertEquals(rsp.getCompacts().stream().filter(x->x.getState().equals("ready for cleaning")).count() +1,
+      r.size());//includes Header row
+
+    r = runStatementOnDriver("SHOW COMPACTIONS SCHEMA mydb1 TYPE 'MAJOR' ");
+    Assert.assertEquals(rsp.getCompacts().stream().filter(x->x.getDbname().equals("mydb1")).
+      filter(x->x.getType().equals(CompactionType.MAJOR)).count()+1, r.size());//includes Header row
+
+    r = runStatementOnDriver("SHOW COMPACTIONS SCHEMA mydb1 POOL 'poolx' TYPE 'MINOR' ");
+    //includes Header row
+    Assert.assertEquals(rsp.getCompacts().stream().filter(x->x.getDbname().equals("mydb1")).
+      filter(x->x.getPoolName().equals("poolx")).filter(x->x.getType().equals(CompactionType.MAJOR)).count()+1, r.size());
+
+    r = runStatementOnDriver("SHOW COMPACTIONS SCHEMA mydb1 POOL 'pool0' TYPE 'MAJOR'");
+    Assert.assertEquals(2, r.size());//includes Header row
+
+    r = runStatementOnDriver("SHOW COMPACTIONS SCHEMA mydb1 POOL 'pool0'");
+    Assert.assertEquals(rsp.getCompacts().stream().filter(x->x.getDbname().equals("mydb1")).
+      filter(x->x.getPoolName().equals("pool0")).count()+1, r.size());//includes Header row
+
+    r = runStatementOnDriver("SHOW COMPACTIONS DATABASE mydb1 POOL 'pool0'");
+    Assert.assertEquals(2, r.size());//includes Header row
+
+    r = runStatementOnDriver("SHOW COMPACTIONS tbl0 TYPE 'MAJOR' ");

Review Comment:
   We are following below syntax:
   SHOW COMPACTIONS <[DATABASE|SCHEMA <db>]|[[<db>.]<table> [PARTITION (<partition_spec>)]]> [POOL <pool_name>] [TYPE <type>] [STATE <state>] [ORDER BY <ob clause>] [LIMIT <number>]
   



##########
parser/src/test/org/apache/hadoop/hive/ql/parse/TestParseShowCompactions.java:
##########
@@ -0,0 +1,148 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hive.ql.parse;
+
+import org.junit.Test;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+
+public class TestParseShowCompactions {
+    ParseDriver parseDriver = new ParseDriver();
+
+    @Test
+    public void testShowCompactions() throws Exception {
+        ASTNode tree = parseDriver.parse(
+                "SHOW COMPACTIONS", null).getTree();
+
+        assertThat(tree.toStringTree(), is("tok_show_compactions <eof>"));
+    }
+
+    @Test
+    public void testShowCompactionsFilterDb() throws Exception {
+        ASTNode tree = parseDriver.parse(
+                "SHOW COMPACTIONS DATABASE db1", null).getTree();
+
+        assertThat(tree.toStringTree(), is("(tok_show_compactions db1) <eof>"));
+    }
+
+    private static final String EXPECTED_WHEN_FILTER_BY_DB_AND_ALL_AND_ORDER_BY = "\n" +
+            "nil\n" +
+            "   TOK_SHOW_COMPACTIONS\n" +
+            "      db1\n" +
+            "      TOK_COMPACT_POOL\n" +
+            "         'pool0'\n" +
+            "      TOK_COMPACTION_TYPE\n" +
+            "         'minor'\n" +
+            "      TOK_COMPACTION_STATUS\n" +
+            "         'ready for clean'\n" +
+            "      TOK_ORDERBY\n" +
+            "         TOK_TABSORTCOLNAMEDESC\n" +
+            "            TOK_NULLS_FIRST\n" +
+            "               TOK_TABLE_OR_COL\n" +
+            "                  cq_table\n" +
+            "         TOK_TABSORTCOLNAMEASC\n" +
+            "            TOK_NULLS_LAST\n" +
+            "               TOK_TABLE_OR_COL\n" +
+            "                  cq_state\n" +
+            "      TOK_LIMIT\n" +
+            "         42\n" +
+            "   <EOF>\n";
+
+    @Test
+    public void testShowCompactionsFilterDbAndAllAndOrder() throws Exception {
+        ASTNode tree = parseDriver.parse(
+                "SHOW COMPACTIONS DATABASE db1 POOL 'pool0' TYPE 'minor' STATUS 'ready for clean' ORDER BY cq_table DESC, cq_state LIMIT 42", null).getTree();

Review Comment:
   order by and limit functionality is part of other JIRA
   [HIVE-26580](https://issues.apache.org/jira/browse/HIVE-26580)
   SHOW COMPACTIONS should support ordering and limiting functionality in filtering options



-- 
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


[GitHub] [hive] rkirtir commented on a diff in pull request #3608: HIVE-13353: SHOW COMPACTIONS should support filtering options

Posted by GitBox <gi...@apache.org>.
rkirtir commented on code in PR #3608:
URL: https://github.com/apache/hive/pull/3608#discussion_r990898831


##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/TxnHandler.java:
##########
@@ -3970,6 +3960,78 @@ public ShowCompactResponse showCompact(ShowCompactRequest rqst) throws MetaExcep
     }
   }
 
+  private List<String> getShowCompactionQueryParamList(ShowCompactRequest request) throws MetaException {
+    String dbName = request.getDbname();
+    String tableName = request.getTablename();
+    String partName = request.getPartitionname();
+    CompactionType type = request.getType();
+    String state = request.getState();
+    String poolName = request.getPoolName();
+    List<String> params = new ArrayList<>();
+    if (dbName != null && !dbName.isEmpty()) {
+      params.add(dbName);
+    }
+    if (tableName != null && !tableName.isEmpty()) {
+      params.add(tableName);
+    }
+    if (partName != null && !partName.isEmpty()) {
+      params.add(partName);
+    }
+    if (state != null && !state.isEmpty()) {
+      params.add(state);
+    }
+    if (type != null) {
+      params.add(thriftCompactionType2DbType(type).toString());
+    }
+    if (org.apache.commons.lang3.StringUtils.isNotBlank(poolName)) {
+      params.add(poolName);
+    }
+    return params;
+  }
+
+  private String getFilterClause(ShowCompactRequest request) {
+    StringBuilder filter = new StringBuilder();
+    String dbName = request.getDbname();
+    String tableName = request.getTablename();
+    String partName = request.getPartitionname();
+    CompactionType type = request.getType();
+    String state = request.getState();
+    String poolName = request.getPoolName();
+    if (dbName != null && !dbName.isEmpty()) {

Review Comment:
   Agree. Addressing the same



##########
ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java:
##########
@@ -5875,6 +5802,15 @@ public ShowCompactResponse showCompactions(String poolName) throws HiveException
     }
   }
 
+  public ShowCompactResponse showCompactions(ShowCompactRequest request) throws HiveException {

Review Comment:
   Agree. Addressing the same



-- 
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


[GitHub] [hive] rkirtir commented on a diff in pull request #3608: HIVE-13353: SHOW COMPACTIONS should support filtering options

Posted by GitBox <gi...@apache.org>.
rkirtir commented on code in PR #3608:
URL: https://github.com/apache/hive/pull/3608#discussion_r990899138


##########
ql/src/java/org/apache/hadoop/hive/ql/ddl/process/show/compactions/ShowCompactionsOperation.java:
##########
@@ -39,16 +43,27 @@
  * Operation process of showing compactions.
  */
 public class ShowCompactionsOperation extends DDLOperation<ShowCompactionsDesc> {
+
+  static final protected String MAJOR_TYPE = "MAJOR";
+  static final protected String MINOR_TYPE = "MINOR";
+  static final char INITIATED_STATE = 'i';

Review Comment:
   try to reuse things from TxnStore and move other logic at common place



-- 
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


[GitHub] [hive] rkirtir commented on a diff in pull request #3608: HIVE-13353: SHOW COMPACTIONS should support filtering options

Posted by GitBox <gi...@apache.org>.
rkirtir commented on code in PR #3608:
URL: https://github.com/apache/hive/pull/3608#discussion_r990899289


##########
ql/src/java/org/apache/hadoop/hive/ql/ddl/process/show/compactions/ShowCompactionsOperation.java:
##########
@@ -68,6 +83,71 @@ public int execute() throws HiveException {
     return 0;
   }
 
+  private ShowCompactRequest getShowCompactioRequest(ShowCompactionsDesc desc) throws MetaException, SemanticException {
+    ShowCompactRequest request = new ShowCompactRequest();
+    if (desc.getDbName() == null && desc.getTbName() != null) {
+      request.setDbname(SessionState.get().getCurrentDatabase());
+    } else {
+      request.setDbname(desc.getDbName());
+    }
+    if (desc.getTbName() != null && !desc.getTbName().isEmpty())
+      request.setTablename(desc.getTbName());
+    if (desc.getPoolName() != null && !desc.getPoolName().isEmpty())
+      request.setPoolName(desc.getPoolName());
+    if (desc.getCompactionType() != null && !desc.getCompactionType().isEmpty())
+      request.setType(inputCompactionType2DBType(desc.getCompactionType()));
+    if (desc.getCompactionStatus() != null && !desc.getCompactionStatus().isEmpty())
+      request.setState(compactorStateFromInput(desc.getCompactionStatus()));
+    if (desc.getPartSpec() != null && !desc.getPartSpec().isEmpty())
+      request.setPartitionname(getPartitionName(desc.getPartSpec()));
+    return request;
+  }
+
+  private String getPartitionName(Map<String, String> partitionSpec) throws SemanticException {
+    String partitionName = null;
+    if (partitionSpec != null) {
+      try {
+        partitionName = Warehouse.makePartName(partitionSpec, false);
+      } catch (MetaException e) {
+        throw new SemanticException("partition " + partitionSpec.toString() + " not found");
+      }
+    }
+    return partitionName;
+  }
+
+  static CompactionType inputCompactionType2DBType(String inputValue) throws MetaException {

Review Comment:
   Agree. Addressing the same



-- 
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


[GitHub] [hive] deniskuzZ merged pull request #3608: HIVE-13353: SHOW COMPACTIONS should support filtering options

Posted by GitBox <gi...@apache.org>.
deniskuzZ merged PR #3608:
URL: https://github.com/apache/hive/pull/3608


-- 
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


[GitHub] [hive] veghlaci05 commented on a diff in pull request #3608: HIVE-13353: SHOW COMPACTIONS should support filtering options

Posted by GitBox <gi...@apache.org>.
veghlaci05 commented on code in PR #3608:
URL: https://github.com/apache/hive/pull/3608#discussion_r1003113137


##########
ql/src/java/org/apache/hadoop/hive/ql/ddl/process/show/compactions/ShowCompactionsAnalyzer.java:
##########
@@ -40,20 +43,53 @@ public ShowCompactionsAnalyzer(QueryState queryState) throws SemanticException {
 
   @Override
   public void analyzeInternal(ASTNode root) throws SemanticException {
+    ctx.setResFile(ctx.getLocalTmpPath());
     String poolName = null;
-    Tree pool = root.getChild(0);
-    if (pool != null) {
-      if (pool.getType() != HiveParser.TOK_COMPACT_POOL) {
-        throw new SemanticException("Unknown token, 'POOL' expected.");
-      } else {
-        poolName = unescapeSQLString(pool.getChild(0).getText());
+    String dbName = null;
+    String tbName = null;
+    String compactionType = null;
+    String compactionStatus = null;
+    long compactionId = 0;
+    Map<String, String> partitionSpec = null;
+    if (root.getChildCount() > 6) {
+      throw new SemanticException(ErrorMsg.INVALID_AST_TREE.getMsg(root.toStringTree()));
+    }
+    if (root.getType() == HiveParser.TOK_SHOW_COMPACTIONS) {
+      for (int i = 0; i < root.getChildCount(); i++) {
+        ASTNode child = (ASTNode) root.getChild(i);
+        switch (child.getType()) {
+          case HiveParser.TOK_TABTYPE:
+            tbName = child.getChild(0).getText();
+            if (child.getChildCount() == 2) {
+              if (child.getChild(0).getChildCount() == 2) {
+                dbName = DDLUtils.getFQName((ASTNode) child.getChild(0).getChild(0));
+                tbName = DDLUtils.getFQName((ASTNode) child.getChild(0).getChild(1));
+              }
+              ASTNode partitionSpecNode = (ASTNode) child.getChild(1);
+              partitionSpec = getValidatedPartSpec(getTable(dbName, tbName, true), partitionSpecNode, conf, false);
+            }
+            break;
+          case HiveParser.TOK_COMPACT_POOL:
+            poolName = unescapeSQLString(child.getChild(0).getText());
+            break;
+          case HiveParser.TOK_COMPACTION_TYPE:
+            compactionType = unescapeSQLString(child.getChild(0).getText());
+            break;
+          case HiveParser.TOK_COMPACTION_STATUS:
+            compactionStatus = unescapeSQLString(child.getChild(0).getText());
+            break;
+          case HiveParser.TOK_COMPACT_ID:
+           compactionId = Long.parseLong(child.getChild(0).getText());
+           break;
+          default:
+            dbName = child.getText();

Review Comment:
   case HiveParser.TOK_TABTYPE should handle both simple and DB prefixed tables, is this really required?



##########
standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java:
##########
@@ -4362,4 +4353,6 @@ ReplicationMetricList getReplicationMetrics(GetReplicationMetricsRequest
    * @throws TException
    */
   List<WriteEventInfo> getAllWriteEventInfo(GetAllWriteEventInfoRequest request) throws TException;
+  ShowCompactResponse showCompactions(ShowCompactRequest request) throws TException;

Review Comment:
   I think this should be next to `ShowCompactResponse showCompactions() throws TException;` at line 3501



##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/TxnHandler.java:
##########
@@ -3916,56 +3879,59 @@ public ShowCompactResponse showCompact(ShowCompactRequest rqst) throws MetaExcep
       try (Connection dbConn = getDbConn(Connection.TRANSACTION_READ_COMMITTED);
         PreparedStatement stmt = sqlGenerator.prepareStmtWithParameters(dbConn, query.toString(),
           getShowCompactionQueryParamList(rqst))) {
-          LOG.debug("Going to execute query <" + query + ">");
-          try (ResultSet rs = stmt.executeQuery()) {
-            while (rs.next()) {
-              ShowCompactResponseElement e = new ShowCompactResponseElement();
-              e.setDbname(rs.getString(1));
-              e.setTablename(rs.getString(2));
-              e.setPartitionname(rs.getString(3));
-              e.setState(compactorStateToResponse(rs.getString(4).charAt(0)));
-              try {
-                e.setType(dbCompactionType2ThriftType(rs.getString(5).charAt(0)));
-              } catch (MetaException ex) {
-                //do nothing to handle RU/D if we add another status
-              }
-              e.setWorkerid(rs.getString(6));
-              long start = rs.getLong(7);
-              if (!rs.wasNull()) {
-                e.setStart(start);
-              }
-              long endTime = rs.getLong(8);
-              if (endTime != -1) {
-                e.setEndTime(endTime);
-              }
-              e.setRunAs(rs.getString(9));
-              e.setHadoopJobId(rs.getString(10));
-              e.setId(rs.getLong(11));
-              e.setErrorMessage(rs.getString(12));
-              long enqueueTime = rs.getLong(13);
-              if (!rs.wasNull()) {
-                e.setEnqueueTime(enqueueTime);
-              }
-              e.setWorkerVersion(rs.getString(14));
-              e.setInitiatorId(rs.getString(15));
-              e.setInitiatorVersion(rs.getString(16));
-              long cleanerStart = rs.getLong(17);
-              if (!rs.wasNull() && (cleanerStart != -1)) {
-                e.setCleanerStart(cleanerStart);
-              }
-              String poolName = rs.getString(18);
-              if (isBlank(poolName)) {
-                e.setPoolName(DEFAULT_POOL_NAME);
-              } else {
-                e.setPoolName(poolName);
-              }
-              e.setTxnId(rs.getLong(19));
-              e.setNextTxnId(rs.getLong(20));
-              e.setCommitTime(rs.getLong(21));
-              e.setHightestTxnId(rs.getLong(22));
-              response.addToCompacts(e);
+        if (rqst.isSetId()) {
+          stmt.setLong(getShowCompactionQueryParamList(rqst).size() + 1, rqst.getId());

Review Comment:
   Maybe introducing a QueryBuilder, like for QueryBasedCompaction? All the showCompact related query parts, `getShowCompactionQueryParamList(rqst)` and `getShowCompactionFilterClause(rqst)`, could be extracted from TxnHandler. However, not sure if it worth it. At least the result of `getShowCompactionFilterClause(rqst)` should be stored into a variable to avoid calling it twice.



##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/TxnStore.java:
##########
@@ -104,6 +104,33 @@ enum MUTEX_KEY {
   String DID_NOT_INITIATE_RESPONSE = "did not initiate";
   String REFUSED_RESPONSE = "refused";
 
+  static final char INITIATED_STATE = 'i';
+  static final char WORKING_STATE = 'w';
+  static final char READY_FOR_CLEANING = 'r';
+  static final char FAILED_STATE = 'f';
+  static final char SUCCEEDED_STATE = 's';
+  static final char DID_NOT_INITIATE = 'a';
+  static final char REFUSED_STATE = 'c';
+
+  // Compactor types
+  static final char MAJOR_TYPE = 'a';
+  static final char MINOR_TYPE = 'i';
+
+
+  static final String COMPACTOR_MAJOR_TYPE = "MAJOR";
+  static final String COMPACTOR_MINOR_TYPE = "MINOR";
+
+  static final String TXN_TMP_STATE = "_";
+
+  static final String DEFAULT_POOL_NAME = "default";
+
+
+  // Lock states
+  static final char LOCK_ACQUIRED = 'a';
+  static final  char LOCK_WAITING = 'w';
+
+  static final int ALLOWED_REPEATED_DEADLOCKS = 10;

Review Comment:
   Unnecessary static final



-- 
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


[GitHub] [hive] deniskuzZ commented on a diff in pull request #3608: HIVE-13353: SHOW COMPACTIONS should support filtering options

Posted by GitBox <gi...@apache.org>.
deniskuzZ commented on code in PR #3608:
URL: https://github.com/apache/hive/pull/3608#discussion_r1000750444


##########
parser/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g:
##########
@@ -1334,7 +1336,12 @@ showStatement
       |
       (parttype=partTypeExpr)? (isExtended=KW_EXTENDED)? -> ^(TOK_SHOWLOCKS $parttype? $isExtended?)
       )
-    | KW_SHOW KW_COMPACTIONS compactPool? -> ^(TOK_SHOW_COMPACTIONS compactPool?)
+    | KW_SHOW KW_COMPACTIONS

Review Comment:
   we should also support
   ````
   SHOW COMPACTIONS ID=xxx
   ````



-- 
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


[GitHub] [hive] rkirtir commented on a diff in pull request #3608: HIVE-13353: SHOW COMPACTIONS should support filtering options

Posted by GitBox <gi...@apache.org>.
rkirtir commented on code in PR #3608:
URL: https://github.com/apache/hive/pull/3608#discussion_r1001380736


##########
ql/src/java/org/apache/hadoop/hive/ql/ddl/process/show/compactions/ShowCompactionsOperation.java:
##########
@@ -68,6 +76,37 @@ public int execute() throws HiveException {
     return 0;
   }
 
+  private ShowCompactRequest getShowCompactioRequest(ShowCompactionsDesc desc) throws MetaException, SemanticException {
+    ShowCompactRequest request = new ShowCompactRequest();
+    if (isBlank(desc.getDbName() )&& isNotBlank(desc.getTbName())) {
+      request.setDbname(SessionState.get().getCurrentDatabase());
+    } else {
+      request.setDbname(desc.getDbName());
+    }
+    if (isNotBlank(desc.getTbName()))

Review Comment:
   done



-- 
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


[GitHub] [hive] sonarcloud[bot] commented on pull request #3608: HIVE-13353: SHOW COMPACTIONS should support filtering options

Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on PR #3608:
URL: https://github.com/apache/hive/pull/3608#issuecomment-1287869561

   Kudos, SonarCloud Quality Gate passed!&nbsp; &nbsp; [![Quality Gate passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=3608)
   
   [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=BUG)  
   [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=VULNERABILITY)  
   [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=3608&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=3608&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=3608&resolved=false&types=SECURITY_HOTSPOT)  
   [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=CODE_SMELL) [7 Code Smells](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=CODE_SMELL)
   
   [![No Coverage information](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/NoCoverageInfo-16px.png 'No Coverage information')](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=3608&metric=coverage&view=list) No Coverage information  
   [![No Duplication information](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/NoDuplicationInfo-16px.png 'No Duplication information')](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=3608&metric=duplicated_lines_density&view=list) No Duplication information
   
   


-- 
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


[GitHub] [hive] deniskuzZ commented on a diff in pull request #3608: HIVE-13353: SHOW COMPACTIONS should support filtering options

Posted by GitBox <gi...@apache.org>.
deniskuzZ commented on code in PR #3608:
URL: https://github.com/apache/hive/pull/3608#discussion_r1000740877


##########
ql/src/java/org/apache/hadoop/hive/ql/ddl/process/show/compactions/ShowCompactionsAnalyzer.java:
##########
@@ -40,20 +43,44 @@ public ShowCompactionsAnalyzer(QueryState queryState) throws SemanticException {
 
   @Override
   public void analyzeInternal(ASTNode root) throws SemanticException {
+    ctx.setResFile(ctx.getLocalTmpPath());
     String poolName = null;
-    Tree pool = root.getChild(0);
-    if (pool != null) {
-      if (pool.getType() != HiveParser.TOK_COMPACT_POOL) {
-        throw new SemanticException("Unknown token, 'POOL' expected.");
-      } else {
-        poolName = unescapeSQLString(pool.getChild(0).getText());
+    String dbName = null;
+    String tbName = null;
+    String compactionType = null;
+    String compactionStatus = null;
+    Map<String, String> partitionSpec = null;
+    if (root.getChildCount() > 6) {
+      throw new SemanticException(ErrorMsg.INVALID_AST_TREE.getMsg(root.toStringTree()));
+    }
+    if (root.getType() == HiveParser.TOK_SHOW_COMPACTIONS && root.getChildCount() >= 1) {
+      for (int i = 0; i < root.getChildCount(); i++) {
+        ASTNode child = (ASTNode) root.getChild(i);
+        if (child.getType() == HiveParser.TOK_TABTYPE) {
+          tbName = child.getChild(0).getText();
+          // get partition metadata if partition specified
+          if (child.getChildCount() == 2) {

Review Comment:
   shouldn't it be `child.getChild(0).getChildCount()` ?



-- 
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


[GitHub] [hive] deniskuzZ commented on a diff in pull request #3608: HIVE-13353: SHOW COMPACTIONS should support filtering options

Posted by GitBox <gi...@apache.org>.
deniskuzZ commented on code in PR #3608:
URL: https://github.com/apache/hive/pull/3608#discussion_r1000739212


##########
ql/src/java/org/apache/hadoop/hive/ql/ddl/process/show/compactions/ShowCompactionsAnalyzer.java:
##########
@@ -40,20 +43,44 @@ public ShowCompactionsAnalyzer(QueryState queryState) throws SemanticException {
 
   @Override
   public void analyzeInternal(ASTNode root) throws SemanticException {
+    ctx.setResFile(ctx.getLocalTmpPath());
     String poolName = null;
-    Tree pool = root.getChild(0);
-    if (pool != null) {
-      if (pool.getType() != HiveParser.TOK_COMPACT_POOL) {
-        throw new SemanticException("Unknown token, 'POOL' expected.");
-      } else {
-        poolName = unescapeSQLString(pool.getChild(0).getText());
+    String dbName = null;
+    String tbName = null;
+    String compactionType = null;
+    String compactionStatus = null;
+    Map<String, String> partitionSpec = null;
+    if (root.getChildCount() > 6) {
+      throw new SemanticException(ErrorMsg.INVALID_AST_TREE.getMsg(root.toStringTree()));
+    }
+    if (root.getType() == HiveParser.TOK_SHOW_COMPACTIONS && root.getChildCount() >= 1) {
+      for (int i = 0; i < root.getChildCount(); i++) {
+        ASTNode child = (ASTNode) root.getChild(i);
+        if (child.getType() == HiveParser.TOK_TABTYPE) {
+          tbName = child.getChild(0).getText();
+          // get partition metadata if partition specified
+          if (child.getChildCount() == 2) {
+            if(child.getChild(0) !=null) {

Review Comment:
   why is this null check required?



-- 
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


[GitHub] [hive] veghlaci05 commented on pull request #3608: HIVE-13353: SHOW COMPACTIONS should support filtering options

Posted by GitBox <gi...@apache.org>.
veghlaci05 commented on PR #3608:
URL: https://github.com/apache/hive/pull/3608#issuecomment-1252066788

   The changes are not reflected in the SHOW COMPACTIONS command itself.
   You need to add the possiblity to supply the new filter criteria through SHOW COMPACTIONS, otherwise the new filters will never be used.


-- 
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


[GitHub] [hive] veghlaci05 commented on a diff in pull request #3608: HIVE-13353: SHOW COMPACTIONS should support filtering options

Posted by GitBox <gi...@apache.org>.
veghlaci05 commented on code in PR #3608:
URL: https://github.com/apache/hive/pull/3608#discussion_r992100677


##########
ql/src/test/org/apache/hadoop/hive/ql/TestTxnCommands.java:
##########
@@ -2117,4 +2121,211 @@ public void testIsRawFormatFile() throws Exception {
     List<String> res = runStatementOnDriver("select * from file_formats");
     Assert.assertEquals(3, res.size());
   }
+  @Test
+  public void testShowCompactions() throws Exception {
+    d.destroy();
+    hiveConf.setVar(HiveConf.ConfVars.DYNAMICPARTITIONINGMODE, "nonstrict");
+    d = new Driver(hiveConf);
+    //generate some compaction history
+    runStatementOnDriver("drop database if exists mydb1 cascade");
+    runStatementOnDriver("create database mydb1");
+    runStatementOnDriver("create table mydb1.tbl0 " + "(a int, b int) partitioned by (p string) clustered by (a) into " +
+      BUCKET_COUNT + " buckets stored as orc TBLPROPERTIES ('transactional'='true')");
+    runStatementOnDriver("insert into mydb1.tbl0" + " PARTITION(p) " +
+      " values(1,2,'p1'),(3,4,'p1'),(1,2,'p2'),(3,4,'p2'),(1,2,'p3'),(3,4,'p3')");
+    runStatementOnDriver("alter table mydb1.tbl0" + " PARTITION(p='p1') compact 'MAJOR'");
+    TestTxnCommands2.runWorker(hiveConf);
+    runStatementOnDriver("alter table mydb1.tbl0" + " PARTITION(p='p2') compact 'MAJOR'");
+    TestTxnCommands2.runWorker(hiveConf);
+    runStatementOnDriver("alter table mydb1.tbl0" + " PARTITION(p='p3') compact 'MAJOR'");
+    TestTxnCommands2.runWorker(hiveConf);
+    runStatementOnDriver("insert into mydb1.tbl0" + " PARTITION(p) " +
+      " values(4,5,'p1'),(6,7,'p1'),(4,5,'p2'),(6,7,'p2'),(4,5,'p3'),(6,7,'p3')");
+    runStatementOnDriver("alter table mydb1.tbl0" + " PARTITION (p='p1') compact 'MAJOR'");
+    TestTxnCommands2.runWorker(hiveConf);
+    runStatementOnDriver("alter table mydb1.tbl0" + " PARTITION (p='p2') compact 'MAJOR'");
+    TestTxnCommands2.runWorker(hiveConf);
+    runStatementOnDriver("alter table mydb1.tbl0" + " PARTITION (p='p3')  compact 'MAJOR' pool 'pool0'");
+    TestTxnCommands2.runWorker(hiveConf);
+    TxnStore txnHandler = TxnUtils.getTxnStore(hiveConf);
+
+    SessionState.get().setCurrentDatabase("mydb1");
+
+    //testing show compaction command
+    ShowCompactResponse rsp = txnHandler.showCompact(new ShowCompactRequest());
+    List<String> r = runStatementOnDriver("SHOW COMPACTIONS");
+    Assert.assertEquals(rsp.getCompacts().size()+1, r.size());//includes Header row
+
+
+    r = runStatementOnDriver("SHOW COMPACTIONS SCHEMA mydb1 STATUS 'ready for cleaning'");
+    Assert.assertEquals(rsp.getCompacts().stream().filter(x->x.getState().equals("ready for cleaning")).count() +1,
+      r.size());//includes Header row
+    r = runStatementOnDriver("SHOW COMPACTIONS SCHEMA mydb1 TYPE 'MAJOR' ");
+    Assert.assertEquals(rsp.getCompacts().stream().filter(x->x.getDbname().equals("mydb1")).
+      filter(x->x.getType().equals(CompactionType.MAJOR)).count()+1, r.size());//includes Header row
+
+    r = runStatementOnDriver("SHOW COMPACTIONS SCHEMA mydb1 POOL 'poolx' TYPE 'MINOR' ");
+    //includes Header row
+    Assert.assertEquals(rsp.getCompacts().stream().filter(x->x.getDbname().equals("mydb1")).
+      filter(x->x.getPoolName().equals("poolx")).filter(x->x.getType().equals(CompactionType.MINOR)).count(),
+      r.stream().filter(x->x.equals("mydb1")).filter(x->x.equals("poolx")).filter(x->x.equals(CompactionType.MINOR)).count());
+
+    r = runStatementOnDriver("SHOW COMPACTIONS SCHEMA mydb1 POOL 'pool0' TYPE 'MAJOR'");
+    Assert.assertEquals(2, r.size());//includes Header row
+
+
+    r = runStatementOnDriver("SHOW COMPACTIONS SCHEMA mydb1 POOL 'pool0'");
+    Assert.assertEquals(rsp.getCompacts().stream().filter(x->x.getDbname().equals("mydb1")).
+      filter(x->x.getPoolName().equals("pool0")).count()+1, r.size());//includes Header row
+    r = runStatementOnDriver("SHOW COMPACTIONS DATABASE mydb1 POOL 'pool0'");
+    Assert.assertEquals(2, r.size());//includes Header row
+
+    r = runStatementOnDriver("SHOW COMPACTIONS tbl0 TYPE 'MAJOR' ");
+    Assert.assertEquals(rsp.getCompacts().stream().filter(x->x.getTablename().equals("tbl0")).
+      filter(x->x.getType().equals(CompactionType.MAJOR)).count()+1, r.size());//includes Header row
+
+    List<String> partitions = runStatementOnDriver("SHOW PARTITIONS mydb1.tbl0 ");

Review Comment:
   Is this intended? Shouldn't it be rather SHOW COMPACTIONS with partition filtering?



##########
ql/src/test/org/apache/hadoop/hive/ql/TestTxnCommands.java:
##########
@@ -2117,4 +2121,211 @@ public void testIsRawFormatFile() throws Exception {
     List<String> res = runStatementOnDriver("select * from file_formats");
     Assert.assertEquals(3, res.size());
   }
+  @Test
+  public void testShowCompactions() throws Exception {
+    d.destroy();
+    hiveConf.setVar(HiveConf.ConfVars.DYNAMICPARTITIONINGMODE, "nonstrict");
+    d = new Driver(hiveConf);
+    //generate some compaction history
+    runStatementOnDriver("drop database if exists mydb1 cascade");
+    runStatementOnDriver("create database mydb1");
+    runStatementOnDriver("create table mydb1.tbl0 " + "(a int, b int) partitioned by (p string) clustered by (a) into " +
+      BUCKET_COUNT + " buckets stored as orc TBLPROPERTIES ('transactional'='true')");
+    runStatementOnDriver("insert into mydb1.tbl0" + " PARTITION(p) " +
+      " values(1,2,'p1'),(3,4,'p1'),(1,2,'p2'),(3,4,'p2'),(1,2,'p3'),(3,4,'p3')");
+    runStatementOnDriver("alter table mydb1.tbl0" + " PARTITION(p='p1') compact 'MAJOR'");
+    TestTxnCommands2.runWorker(hiveConf);
+    runStatementOnDriver("alter table mydb1.tbl0" + " PARTITION(p='p2') compact 'MAJOR'");
+    TestTxnCommands2.runWorker(hiveConf);
+    runStatementOnDriver("alter table mydb1.tbl0" + " PARTITION(p='p3') compact 'MAJOR'");
+    TestTxnCommands2.runWorker(hiveConf);
+    runStatementOnDriver("insert into mydb1.tbl0" + " PARTITION(p) " +
+      " values(4,5,'p1'),(6,7,'p1'),(4,5,'p2'),(6,7,'p2'),(4,5,'p3'),(6,7,'p3')");
+    runStatementOnDriver("alter table mydb1.tbl0" + " PARTITION (p='p1') compact 'MAJOR'");
+    TestTxnCommands2.runWorker(hiveConf);
+    runStatementOnDriver("alter table mydb1.tbl0" + " PARTITION (p='p2') compact 'MAJOR'");
+    TestTxnCommands2.runWorker(hiveConf);
+    runStatementOnDriver("alter table mydb1.tbl0" + " PARTITION (p='p3')  compact 'MAJOR' pool 'pool0'");
+    TestTxnCommands2.runWorker(hiveConf);
+    TxnStore txnHandler = TxnUtils.getTxnStore(hiveConf);
+
+    SessionState.get().setCurrentDatabase("mydb1");
+
+    //testing show compaction command
+    ShowCompactResponse rsp = txnHandler.showCompact(new ShowCompactRequest());
+    List<String> r = runStatementOnDriver("SHOW COMPACTIONS");
+    Assert.assertEquals(rsp.getCompacts().size()+1, r.size());//includes Header row
+
+
+    r = runStatementOnDriver("SHOW COMPACTIONS SCHEMA mydb1 STATUS 'ready for cleaning'");
+    Assert.assertEquals(rsp.getCompacts().stream().filter(x->x.getState().equals("ready for cleaning")).count() +1,
+      r.size());//includes Header row
+    r = runStatementOnDriver("SHOW COMPACTIONS SCHEMA mydb1 TYPE 'MAJOR' ");
+    Assert.assertEquals(rsp.getCompacts().stream().filter(x->x.getDbname().equals("mydb1")).
+      filter(x->x.getType().equals(CompactionType.MAJOR)).count()+1, r.size());//includes Header row
+
+    r = runStatementOnDriver("SHOW COMPACTIONS SCHEMA mydb1 POOL 'poolx' TYPE 'MINOR' ");
+    //includes Header row
+    Assert.assertEquals(rsp.getCompacts().stream().filter(x->x.getDbname().equals("mydb1")).
+      filter(x->x.getPoolName().equals("poolx")).filter(x->x.getType().equals(CompactionType.MINOR)).count(),
+      r.stream().filter(x->x.equals("mydb1")).filter(x->x.equals("poolx")).filter(x->x.equals(CompactionType.MINOR)).count());

Review Comment:
   Please use this technique for the remaining cases as well



-- 
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


[GitHub] [hive] rkirtir commented on a diff in pull request #3608: HIVE-13353: SHOW COMPACTIONS should support filtering options

Posted by GitBox <gi...@apache.org>.
rkirtir commented on code in PR #3608:
URL: https://github.com/apache/hive/pull/3608#discussion_r1001380892


##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/TxnStore.java:
##########
@@ -104,6 +104,23 @@ enum MUTEX_KEY {
   String DID_NOT_INITIATE_RESPONSE = "did not initiate";
   String REFUSED_RESPONSE = "refused";
 
+  static final char INITIATED_STATE = 'i';

Review Comment:
   my bad. done now



-- 
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


[GitHub] [hive] sonarcloud[bot] commented on pull request #3608: HIVE-13353: SHOW COMPACTIONS should support filtering options

Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on PR #3608:
URL: https://github.com/apache/hive/pull/3608#issuecomment-1287483424

   Kudos, SonarCloud Quality Gate passed!&nbsp; &nbsp; [![Quality Gate passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=3608)
   
   [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=BUG)  
   [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=VULNERABILITY)  
   [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=3608&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=3608&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=3608&resolved=false&types=SECURITY_HOTSPOT)  
   [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=CODE_SMELL) [7 Code Smells](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=CODE_SMELL)
   
   [![No Coverage information](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/NoCoverageInfo-16px.png 'No Coverage information')](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=3608&metric=coverage&view=list) No Coverage information  
   [![No Duplication information](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/NoDuplicationInfo-16px.png 'No Duplication information')](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=3608&metric=duplicated_lines_density&view=list) No Duplication information
   
   


-- 
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


[GitHub] [hive] rkirtir commented on a diff in pull request #3608: HIVE-13353: SHOW COMPACTIONS should support filtering options

Posted by GitBox <gi...@apache.org>.
rkirtir commented on code in PR #3608:
URL: https://github.com/apache/hive/pull/3608#discussion_r992110946


##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/TxnHandler.java:
##########
@@ -3970,6 +3960,78 @@ public ShowCompactResponse showCompact(ShowCompactRequest rqst) throws MetaExcep
     }
   }
 
+  private List<String> getShowCompactionQueryParamList(ShowCompactRequest request) throws MetaException {
+    String dbName = request.getDbname();
+    String tableName = request.getTablename();
+    String partName = request.getPartitionname();
+    CompactionType type = request.getType();
+    String state = request.getState();
+    String poolName = request.getPoolName();
+    List<String> params = new ArrayList<>();
+    if (dbName != null && !dbName.isEmpty()) {
+      params.add(dbName);
+    }
+    if (tableName != null && !tableName.isEmpty()) {

Review Comment:
   resolved



##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/TxnHandler.java:
##########
@@ -3970,6 +3960,78 @@ public ShowCompactResponse showCompact(ShowCompactRequest rqst) throws MetaExcep
     }
   }
 
+  private List<String> getShowCompactionQueryParamList(ShowCompactRequest request) throws MetaException {
+    String dbName = request.getDbname();
+    String tableName = request.getTablename();
+    String partName = request.getPartitionname();
+    CompactionType type = request.getType();
+    String state = request.getState();
+    String poolName = request.getPoolName();
+    List<String> params = new ArrayList<>();
+    if (dbName != null && !dbName.isEmpty()) {
+      params.add(dbName);
+    }
+    if (tableName != null && !tableName.isEmpty()) {
+      params.add(tableName);
+    }
+    if (partName != null && !partName.isEmpty()) {
+      params.add(partName);
+    }
+    if (state != null && !state.isEmpty()) {
+      params.add(state);
+    }
+    if (type != null) {
+      params.add(thriftCompactionType2DbType(type).toString());
+    }
+    if (org.apache.commons.lang3.StringUtils.isNotBlank(poolName)) {
+      params.add(poolName);
+    }
+    return params;
+  }
+
+  private String getFilterClause(ShowCompactRequest request) {
+    StringBuilder filter = new StringBuilder();
+    String dbName = request.getDbname();
+    String tableName = request.getTablename();
+    String partName = request.getPartitionname();
+    CompactionType type = request.getType();
+    String state = request.getState();
+    String poolName = request.getPoolName();
+    if (dbName != null && !dbName.isEmpty()) {

Review Comment:
   resolved



-- 
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


[GitHub] [hive] deniskuzZ commented on a diff in pull request #3608: HIVE-13353: SHOW COMPACTIONS should support filtering options

Posted by GitBox <gi...@apache.org>.
deniskuzZ commented on code in PR #3608:
URL: https://github.com/apache/hive/pull/3608#discussion_r1000759228


##########
ql/src/java/org/apache/hadoop/hive/ql/ddl/process/show/compactions/ShowCompactionsOperation.java:
##########
@@ -68,6 +76,37 @@ public int execute() throws HiveException {
     return 0;
   }
 
+  private ShowCompactRequest getShowCompactioRequest(ShowCompactionsDesc desc) throws MetaException, SemanticException {
+    ShowCompactRequest request = new ShowCompactRequest();
+    if (isBlank(desc.getDbName() )&& isNotBlank(desc.getTbName())) {
+      request.setDbname(SessionState.get().getCurrentDatabase());
+    } else {
+      request.setDbname(desc.getDbName());
+    }
+    if (isNotBlank(desc.getTbName()))
+      request.setTablename(desc.getTbName());
+    if (isNotBlank(desc.getPoolName()))
+      request.setPoolName(desc.getPoolName());
+    if (isNotBlank(desc.getCompactionType()))
+      request.setType(TxnUtils.inputCompactionType2DBType(desc.getCompactionType()));
+    if (isNotBlank(desc.getCompactionStatus()))
+      request.setState(TxnUtils.compactorStateFromInput(desc.getCompactionStatus()));
+    if (isNotEmpty(desc.getPartSpec()))
+      request.setPartitionname(getPartitionName(desc.getPartSpec()));
+    return request;
+  }
+
+  private String getPartitionName(Map<String, String> partitionSpec) throws SemanticException {

Review Comment:
   same method exists in AlterTableUpdateColumnStatistictAnalyzer, could we move it to utils class?



-- 
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


[GitHub] [hive] rkirtir commented on a diff in pull request #3608: HIVE-13353: SHOW COMPACTIONS should support filtering options

Posted by GitBox <gi...@apache.org>.
rkirtir commented on code in PR #3608:
URL: https://github.com/apache/hive/pull/3608#discussion_r1001386178


##########
ql/src/java/org/apache/hadoop/hive/ql/ddl/process/show/compactions/ShowCompactionsOperation.java:
##########
@@ -68,6 +76,37 @@ public int execute() throws HiveException {
     return 0;
   }
 
+  private ShowCompactRequest getShowCompactioRequest(ShowCompactionsDesc desc) throws MetaException, SemanticException {
+    ShowCompactRequest request = new ShowCompactRequest();
+    if (isBlank(desc.getDbName() )&& isNotBlank(desc.getTbName())) {

Review Comment:
   done



-- 
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


[GitHub] [hive] sonarcloud[bot] commented on pull request #3608: HIVE-13353: SHOW COMPACTIONS should support filtering options

Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on PR #3608:
URL: https://github.com/apache/hive/pull/3608#issuecomment-1288192173

   Kudos, SonarCloud Quality Gate passed!&nbsp; &nbsp; [![Quality Gate passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=3608)
   
   [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=BUG)  
   [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=VULNERABILITY)  
   [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=3608&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=3608&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=3608&resolved=false&types=SECURITY_HOTSPOT)  
   [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=CODE_SMELL) [7 Code Smells](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=CODE_SMELL)
   
   [![No Coverage information](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/NoCoverageInfo-16px.png 'No Coverage information')](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=3608&metric=coverage&view=list) No Coverage information  
   [![No Duplication information](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/NoDuplicationInfo-16px.png 'No Duplication information')](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=3608&metric=duplicated_lines_density&view=list) No Duplication information
   
   


-- 
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


[GitHub] [hive] sonarcloud[bot] commented on pull request #3608: HIVE-13353: SHOW COMPACTIONS should support filtering options

Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on PR #3608:
URL: https://github.com/apache/hive/pull/3608#issuecomment-1272875244

   Kudos, SonarCloud Quality Gate passed!&nbsp; &nbsp; [![Quality Gate passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=3608)
   
   [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=BUG) [![C](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/C-16px.png 'C')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=BUG) [6 Bugs](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=BUG)  
   [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=VULNERABILITY)  
   [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=3608&resolved=false&types=SECURITY_HOTSPOT) [![E](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/E-16px.png 'E')](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=3608&resolved=false&types=SECURITY_HOTSPOT) [1 Security Hotspot](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=3608&resolved=false&types=SECURITY_HOTSPOT)  
   [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=CODE_SMELL) [74 Code Smells](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=CODE_SMELL)
   
   [![No Coverage information](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/NoCoverageInfo-16px.png 'No Coverage information')](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=3608&metric=coverage&view=list) No Coverage information  
   [![No Duplication information](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/NoDuplicationInfo-16px.png 'No Duplication information')](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=3608&metric=duplicated_lines_density&view=list) No Duplication information
   
   


-- 
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


[GitHub] [hive] sonarcloud[bot] commented on pull request #3608: HIVE-13353: SHOW COMPACTIONS should support filtering options

Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on PR #3608:
URL: https://github.com/apache/hive/pull/3608#issuecomment-1276472782

   Kudos, SonarCloud Quality Gate passed!&nbsp; &nbsp; [![Quality Gate passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=3608)
   
   [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=BUG)  
   [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=VULNERABILITY)  
   [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=3608&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=3608&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=3608&resolved=false&types=SECURITY_HOTSPOT)  
   [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=CODE_SMELL) [8 Code Smells](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=CODE_SMELL)
   
   [![No Coverage information](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/NoCoverageInfo-16px.png 'No Coverage information')](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=3608&metric=coverage&view=list) No Coverage information  
   [![No Duplication information](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/NoDuplicationInfo-16px.png 'No Duplication information')](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=3608&metric=duplicated_lines_density&view=list) No Duplication information
   
   


-- 
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


[GitHub] [hive] rkirtir commented on a diff in pull request #3608: HIVE-13353: SHOW COMPACTIONS should support filtering options

Posted by GitBox <gi...@apache.org>.
rkirtir commented on code in PR #3608:
URL: https://github.com/apache/hive/pull/3608#discussion_r990898905


##########
ql/src/java/org/apache/hadoop/hive/ql/ddl/process/show/compactions/ShowCompactionsAnalyzer.java:
##########
@@ -40,20 +42,41 @@ public ShowCompactionsAnalyzer(QueryState queryState) throws SemanticException {
 
   @Override
   public void analyzeInternal(ASTNode root) throws SemanticException {
+    ctx.setResFile(ctx.getLocalTmpPath());
     String poolName = null;
-    Tree pool = root.getChild(0);
-    if (pool != null) {
-      if (pool.getType() != HiveParser.TOK_COMPACT_POOL) {
-        throw new SemanticException("Unknown token, 'POOL' expected.");
-      } else {
-        poolName = unescapeSQLString(pool.getChild(0).getText());
+    String dbName = null;
+    String tbName = null;
+    String compactionType = null;
+    String compactionStatus = null;
+    Map<String, String> partitionSpec = null;
+    if (root.getChildCount() > 6) {
+      throw new SemanticException(ErrorMsg.INVALID_AST_TREE.getMsg(root.toStringTree()));
+    }
+    if (root.getType() == HiveParser.TOK_SHOW_COMPACTIONS && root.getChildCount() >= 1) {
+      for (int i = 0; i < root.getChildCount(); i++) {
+        ASTNode child = (ASTNode) root.getChild(i);
+        if (child.getType() == HiveParser.TOK_TABTYPE) {
+          tbName = child.getChild(0).getText();
+          // get partition metadata if partition specified
+          if (child.getChildCount() == 2) {
+            dbName = DDLUtils.getFQName((ASTNode) child.getChild(0).getChild(0));

Review Comment:
   Agree. Addressing the same



-- 
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


[GitHub] [hive] deniskuzZ commented on a diff in pull request #3608: HIVE-13353: SHOW COMPACTIONS should support filtering options

Posted by GitBox <gi...@apache.org>.
deniskuzZ commented on code in PR #3608:
URL: https://github.com/apache/hive/pull/3608#discussion_r1000765761


##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/TxnUtils.java:
##########
@@ -565,4 +566,75 @@ public static String findUserToRunAs(String location, Table t, Configuration con
         UserGroupInformation.getLoginUser(), t.getOwner());
     throw new IOException("Unable to stat file: " + p);
   }
+
+  public static String compactorStateToResponse(char s) {

Review Comment:
   same method is in TxnHandler, should we remove it from there?



-- 
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


[GitHub] [hive] deniskuzZ commented on a diff in pull request #3608: HIVE-13353: SHOW COMPACTIONS should support filtering options

Posted by GitBox <gi...@apache.org>.
deniskuzZ commented on code in PR #3608:
URL: https://github.com/apache/hive/pull/3608#discussion_r1000765761


##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/TxnUtils.java:
##########
@@ -565,4 +566,75 @@ public static String findUserToRunAs(String location, Table t, Configuration con
         UserGroupInformation.getLoginUser(), t.getOwner());
     throw new IOException("Unable to stat file: " + p);
   }
+
+  public static String compactorStateToResponse(char s) {

Review Comment:
   same methods are in TxnHandler, should we remove it from there?



-- 
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


[GitHub] [hive] rkirtir commented on a diff in pull request #3608: HIVE-13353: SHOW COMPACTIONS should support filtering options

Posted by GitBox <gi...@apache.org>.
rkirtir commented on code in PR #3608:
URL: https://github.com/apache/hive/pull/3608#discussion_r992115856


##########
ql/src/test/org/apache/hadoop/hive/ql/TestTxnCommands.java:
##########
@@ -2117,4 +2121,168 @@ public void testIsRawFormatFile() throws Exception {
     List<String> res = runStatementOnDriver("select * from file_formats");
     Assert.assertEquals(3, res.size());
   }
+  @Test
+  public void testShowCompactions() throws Exception {
+    d.destroy();
+    hiveConf.setVar(HiveConf.ConfVars.DYNAMICPARTITIONINGMODE, "nonstrict");
+    d = new Driver(hiveConf);
+    //generate some compaction history
+    runStatementOnDriver("drop database if exists mydb1 cascade");
+    runStatementOnDriver("create database mydb1");
+    runStatementOnDriver("create table mydb1.tbl0 " + "(a int, b int) partitioned by (p string) clustered by (a) into " +
+      BUCKET_COUNT + " buckets stored as orc TBLPROPERTIES ('transactional'='true')");
+    runStatementOnDriver("insert into mydb1.tbl0" + " PARTITION(p) " +
+      " values(1,2,'p1'),(3,4,'p1'),(1,2,'p2'),(3,4,'p2'),(1,2,'p3'),(3,4,'p3')");
+    runStatementOnDriver("alter table mydb1.tbl0" + " PARTITION(p='p1') compact 'MAJOR'");
+    TestTxnCommands2.runWorker(hiveConf);
+    runStatementOnDriver("alter table mydb1.tbl0" + " PARTITION(p='p2') compact 'MAJOR'");
+    TestTxnCommands2.runWorker(hiveConf);
+    runStatementOnDriver("alter table mydb1.tbl0" + " PARTITION(p='p3') compact 'MAJOR'");
+    TestTxnCommands2.runWorker(hiveConf);
+    runStatementOnDriver("insert into mydb1.tbl0" + " PARTITION(p) " +
+      " values(4,5,'p1'),(6,7,'p1'),(4,5,'p2'),(6,7,'p2'),(4,5,'p3'),(6,7,'p3')");
+    runStatementOnDriver("alter table mydb1.tbl0" + " PARTITION (p='p1') compact 'MAJOR'");
+    TestTxnCommands2.runWorker(hiveConf);
+    runStatementOnDriver("alter table mydb1.tbl0" + " PARTITION (p='p2') compact 'MAJOR'");
+    TestTxnCommands2.runWorker(hiveConf);
+    runStatementOnDriver("alter table mydb1.tbl0" + " PARTITION (p='p3')  compact 'MAJOR' pool 'pool0'");
+    TestTxnCommands2.runWorker(hiveConf);
+    TxnStore txnHandler = TxnUtils.getTxnStore(hiveConf);
+
+    SessionState.get().setCurrentDatabase("mydb1");
+
+    //testing show compaction command
+    ShowCompactResponse rsp = txnHandler.showCompact(new ShowCompactRequest());
+    List<String> r = runStatementOnDriver("SHOW COMPACTIONS");
+    Assert.assertEquals(rsp.getCompacts().size()+1, r.size());//includes Header row
+
+
+    r = runStatementOnDriver("SHOW COMPACTIONS SCHEMA mydb1 STATUS 'ready for cleaning'");
+    Assert.assertEquals(rsp.getCompacts().stream().filter(x->x.getState().equals("ready for cleaning")).count() +1,

Review Comment:
   done.. Added asserts for parameters



-- 
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


[GitHub] [hive] rkirtir commented on a diff in pull request #3608: HIVE-13353: SHOW COMPACTIONS should support filtering options

Posted by GitBox <gi...@apache.org>.
rkirtir commented on code in PR #3608:
URL: https://github.com/apache/hive/pull/3608#discussion_r992119900


##########
ql/src/java/org/apache/hadoop/hive/ql/ddl/process/show/compactions/ShowCompactionsOperation.java:
##########
@@ -39,16 +43,27 @@
  * Operation process of showing compactions.
  */
 public class ShowCompactionsOperation extends DDLOperation<ShowCompactionsDesc> {
+
+  static final protected String MAJOR_TYPE = "MAJOR";
+  static final protected String MINOR_TYPE = "MINOR";
+  static final char INITIATED_STATE = 'i';

Review Comment:
   done. Added constants in TxnStore and moved methods in TxnUtil



##########
ql/src/java/org/apache/hadoop/hive/ql/ddl/process/show/compactions/ShowCompactionsOperation.java:
##########
@@ -68,6 +83,71 @@ public int execute() throws HiveException {
     return 0;
   }
 
+  private ShowCompactRequest getShowCompactioRequest(ShowCompactionsDesc desc) throws MetaException, SemanticException {
+    ShowCompactRequest request = new ShowCompactRequest();
+    if (desc.getDbName() == null && desc.getTbName() != null) {

Review Comment:
   done



-- 
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


[GitHub] [hive] sonarcloud[bot] commented on pull request #3608: HIVE-13353: SHOW COMPACTIONS should support filtering options

Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on PR #3608:
URL: https://github.com/apache/hive/pull/3608#issuecomment-1286210526

   Kudos, SonarCloud Quality Gate passed!&nbsp; &nbsp; [![Quality Gate passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=3608)
   
   [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=BUG)  
   [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=VULNERABILITY)  
   [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=3608&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=3608&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=3608&resolved=false&types=SECURITY_HOTSPOT)  
   [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=CODE_SMELL) [8 Code Smells](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=CODE_SMELL)
   
   [![No Coverage information](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/NoCoverageInfo-16px.png 'No Coverage information')](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=3608&metric=coverage&view=list) No Coverage information  
   [![No Duplication information](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/NoDuplicationInfo-16px.png 'No Duplication information')](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=3608&metric=duplicated_lines_density&view=list) No Duplication information
   
   


-- 
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


[GitHub] [hive] rkirtir commented on a diff in pull request #3608: HIVE-13353: SHOW COMPACTIONS should support filtering options

Posted by GitBox <gi...@apache.org>.
rkirtir commented on code in PR #3608:
URL: https://github.com/apache/hive/pull/3608#discussion_r1001379455


##########
ql/src/java/org/apache/hadoop/hive/ql/ddl/process/show/compactions/ShowCompactionsAnalyzer.java:
##########
@@ -40,20 +43,44 @@ public ShowCompactionsAnalyzer(QueryState queryState) throws SemanticException {
 
   @Override
   public void analyzeInternal(ASTNode root) throws SemanticException {
+    ctx.setResFile(ctx.getLocalTmpPath());
     String poolName = null;
-    Tree pool = root.getChild(0);
-    if (pool != null) {
-      if (pool.getType() != HiveParser.TOK_COMPACT_POOL) {
-        throw new SemanticException("Unknown token, 'POOL' expected.");
-      } else {
-        poolName = unescapeSQLString(pool.getChild(0).getText());
+    String dbName = null;
+    String tbName = null;
+    String compactionType = null;
+    String compactionStatus = null;
+    Map<String, String> partitionSpec = null;
+    if (root.getChildCount() > 6) {
+      throw new SemanticException(ErrorMsg.INVALID_AST_TREE.getMsg(root.toStringTree()));
+    }
+    if (root.getType() == HiveParser.TOK_SHOW_COMPACTIONS && root.getChildCount() >= 1) {
+      for (int i = 0; i < root.getChildCount(); i++) {
+        ASTNode child = (ASTNode) root.getChild(i);
+        if (child.getType() == HiveParser.TOK_TABTYPE) {

Review Comment:
   Agree and added



-- 
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


[GitHub] [hive] rkirtir commented on a diff in pull request #3608: HIVE-13353: SHOW COMPACTIONS should support filtering options

Posted by GitBox <gi...@apache.org>.
rkirtir commented on code in PR #3608:
URL: https://github.com/apache/hive/pull/3608#discussion_r1001380045


##########
ql/src/java/org/apache/hadoop/hive/ql/ddl/process/show/compactions/ShowCompactionsAnalyzer.java:
##########
@@ -40,20 +43,44 @@ public ShowCompactionsAnalyzer(QueryState queryState) throws SemanticException {
 
   @Override
   public void analyzeInternal(ASTNode root) throws SemanticException {
+    ctx.setResFile(ctx.getLocalTmpPath());
     String poolName = null;
-    Tree pool = root.getChild(0);
-    if (pool != null) {
-      if (pool.getType() != HiveParser.TOK_COMPACT_POOL) {
-        throw new SemanticException("Unknown token, 'POOL' expected.");
-      } else {
-        poolName = unescapeSQLString(pool.getChild(0).getText());
+    String dbName = null;
+    String tbName = null;
+    String compactionType = null;
+    String compactionStatus = null;
+    Map<String, String> partitionSpec = null;
+    if (root.getChildCount() > 6) {
+      throw new SemanticException(ErrorMsg.INVALID_AST_TREE.getMsg(root.toStringTree()));
+    }
+    if (root.getType() == HiveParser.TOK_SHOW_COMPACTIONS && root.getChildCount() >= 1) {

Review Comment:
   Agree. Done



-- 
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


[GitHub] [hive] sonarcloud[bot] commented on pull request #3608: HIVE-13353: SHOW COMPACTIONS should support filtering options

Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on PR #3608:
URL: https://github.com/apache/hive/pull/3608#issuecomment-1288144753

   Kudos, SonarCloud Quality Gate passed!&nbsp; &nbsp; [![Quality Gate passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=3608)
   
   [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=BUG)  
   [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=VULNERABILITY)  
   [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=3608&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=3608&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=3608&resolved=false&types=SECURITY_HOTSPOT)  
   [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=CODE_SMELL) [7 Code Smells](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=CODE_SMELL)
   
   [![No Coverage information](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/NoCoverageInfo-16px.png 'No Coverage information')](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=3608&metric=coverage&view=list) No Coverage information  
   [![No Duplication information](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/NoDuplicationInfo-16px.png 'No Duplication information')](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=3608&metric=duplicated_lines_density&view=list) No Duplication information
   
   


-- 
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


[GitHub] [hive] sonarcloud[bot] commented on pull request #3608: HIVE-13353: SHOW COMPACTIONS should support filtering options

Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on PR #3608:
URL: https://github.com/apache/hive/pull/3608#issuecomment-1288353911

   Kudos, SonarCloud Quality Gate passed!&nbsp; &nbsp; [![Quality Gate passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=3608)
   
   [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=BUG)  
   [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=VULNERABILITY)  
   [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=3608&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=3608&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=3608&resolved=false&types=SECURITY_HOTSPOT)  
   [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=CODE_SMELL) [7 Code Smells](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=CODE_SMELL)
   
   [![No Coverage information](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/NoCoverageInfo-16px.png 'No Coverage information')](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=3608&metric=coverage&view=list) No Coverage information  
   [![No Duplication information](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/NoDuplicationInfo-16px.png 'No Duplication information')](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=3608&metric=duplicated_lines_density&view=list) No Duplication information
   
   


-- 
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


[GitHub] [hive] sonarcloud[bot] commented on pull request #3608: HIVE-13353: SHOW COMPACTIONS should support filtering options

Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on PR #3608:
URL: https://github.com/apache/hive/pull/3608#issuecomment-1289637363

   Kudos, SonarCloud Quality Gate passed!&nbsp; &nbsp; [![Quality Gate passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=3608)
   
   [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=BUG)  
   [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=VULNERABILITY)  
   [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=3608&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=3608&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=3608&resolved=false&types=SECURITY_HOTSPOT)  
   [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=CODE_SMELL) [5 Code Smells](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=3608&resolved=false&types=CODE_SMELL)
   
   [![No Coverage information](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/NoCoverageInfo-16px.png 'No Coverage information')](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=3608&metric=coverage&view=list) No Coverage information  
   [![No Duplication information](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/NoDuplicationInfo-16px.png 'No Duplication information')](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=3608&metric=duplicated_lines_density&view=list) No Duplication information
   
   


-- 
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