[
https://issues.apache.org/jira/browse/HIVE-13353?focusedWorklogId=819683&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-819683
]
ASF GitHub Bot logged work on HIVE-13353:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 24/Oct/22 13:12
Start Date: 24/Oct/22 13:12
Worklog Time Spent: 10m
Work Description: 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
Issue Time Tracking
-------------------
Worklog Id: (was: 819683)
Time Spent: 11h (was: 10h 50m)
> SHOW COMPACTIONS should support filtering options
> -------------------------------------------------
>
> Key: HIVE-13353
> URL: https://issues.apache.org/jira/browse/HIVE-13353
> Project: Hive
> Issue Type: Improvement
> Components: Transactions
> Affects Versions: 1.3.0, 4.0.0
> Reporter: Eugene Koifman
> Assignee: KIRTI RUGE
> Priority: Major
> Labels: pull-request-available
> Fix For: 4.0.0
>
> Attachments: HIVE-13353.01.patch
>
> Time Spent: 11h
> Remaining Estimate: 0h
>
> 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
--
This message was sent by Atlassian Jira
(v8.20.10#820010)