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 2020/04/11 06:08:18 UTC

[GitHub] [hive] dengzhhu653 opened a new pull request #980: HIVE-22458: Add more constraints on showing partitions

dengzhhu653 opened a new pull request #980: HIVE-22458: Add more constraints on showing partitions
URL: https://github.com/apache/hive/pull/980
 
 
   Add where/order by/limit constraints when showing partitions

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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


[GitHub] [hive] miklosgergely commented on a change in pull request #980: HIVE-22458: Add more constraints on showing partitions

Posted by GitBox <gi...@apache.org>.
miklosgergely commented on a change in pull request #980: HIVE-22458: Add more constraints on showing partitions
URL: https://github.com/apache/hive/pull/980#discussion_r407047199
 
 

 ##########
 File path: ql/src/java/org/apache/hadoop/hive/ql/ddl/table/partition/show/ShowPartitionsOperation.java
 ##########
 @@ -44,11 +60,49 @@ public int execute() throws HiveException {
       throw new HiveException(ErrorMsg.TABLE_NOT_PARTITIONED, desc.getTabName());
     }
 
-    List<String> parts = null;
-    if (desc.getPartSpec() != null) {
-      parts = context.getDb().getPartitionNames(tbl.getDbName(), tbl.getTableName(), desc.getPartSpec(), (short) -1);
+    List<String> parts;
+    if (desc.getCond() != null || desc.getOrder() != null) {
+      ExprNodeDesc pred = desc.getCond();
 
 Review comment:
   This is long, please move it to a method.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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


[GitHub] [hive] miklosgergely commented on a change in pull request #980: HIVE-22458: Add more constraints on showing partitions

Posted by GitBox <gi...@apache.org>.
miklosgergely commented on a change in pull request #980: HIVE-22458: Add more constraints on showing partitions
URL: https://github.com/apache/hive/pull/980#discussion_r407046405
 
 

 ##########
 File path: ql/src/java/org/apache/hadoop/hive/ql/ddl/table/partition/show/ShowPartitionAnalyzer.java
 ##########
 @@ -57,10 +67,75 @@ public void analyzeInternal(ASTNode ast) throws SemanticException {
     inputs.add(new ReadEntity(table));
 
     ShowPartitionsDesc desc = new ShowPartitionsDesc(tableName, ctx.getResFile(), partSpec);
+    analyzeShowPartitionsConstraints(ast, table, desc);
     Task<DDLWork> task = TaskFactory.get(new DDLWork(getInputs(), getOutputs(), desc));
     rootTasks.add(task);
 
     task.setFetchSource(true);
     setFetchTask(createFetchTask(ShowPartitionsDesc.SCHEMA));
   }
+
+  private void analyzeShowPartitionsConstraints(ASTNode ast, Table tab,
 
 Review comment:
   Please don't use long methods like this at ddl. Instead  cut it to 3 different methods, similar to getPartitionSpecs, each retrieving one data, returning it to analyzeInternal. Also please don't use setters at ShowPartitionDesc, a desc object at ddl should have final variables set at the constructor, and not by setters. This declares that they may not change later. Thanks.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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


[GitHub] [hive] dengzhhu653 commented on a change in pull request #980: HIVE-22458: Add more constraints on showing partitions

Posted by GitBox <gi...@apache.org>.
dengzhhu653 commented on a change in pull request #980: HIVE-22458: Add more constraints on showing partitions
URL: https://github.com/apache/hive/pull/980#discussion_r407144654
 
 

 ##########
 File path: ql/src/java/org/apache/hadoop/hive/ql/ddl/table/partition/show/ShowPartitionAnalyzer.java
 ##########
 @@ -57,10 +67,75 @@ public void analyzeInternal(ASTNode ast) throws SemanticException {
     inputs.add(new ReadEntity(table));
 
     ShowPartitionsDesc desc = new ShowPartitionsDesc(tableName, ctx.getResFile(), partSpec);
+    analyzeShowPartitionsConstraints(ast, table, desc);
     Task<DDLWork> task = TaskFactory.get(new DDLWork(getInputs(), getOutputs(), desc));
     rootTasks.add(task);
 
     task.setFetchSource(true);
     setFetchTask(createFetchTask(ShowPartitionsDesc.SCHEMA));
   }
+
+  private void analyzeShowPartitionsConstraints(ASTNode ast, Table tab,
 
 Review comment:
   @miklosgergely Thanks for reviewing. Update codes to move the parser into 3 different methods and make the variable in ShowPartitionDesc all 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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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


[GitHub] [hive] dengzhhu653 commented on a change in pull request #980: HIVE-22458: Add more constraints on showing partitions

Posted by GitBox <gi...@apache.org>.
dengzhhu653 commented on a change in pull request #980: HIVE-22458: Add more constraints on showing partitions
URL: https://github.com/apache/hive/pull/980#discussion_r407144701
 
 

 ##########
 File path: ql/src/java/org/apache/hadoop/hive/ql/ddl/table/partition/show/ShowPartitionsOperation.java
 ##########
 @@ -44,11 +60,49 @@ public int execute() throws HiveException {
       throw new HiveException(ErrorMsg.TABLE_NOT_PARTITIONED, desc.getTabName());
     }
 
-    List<String> parts = null;
-    if (desc.getPartSpec() != null) {
-      parts = context.getDb().getPartitionNames(tbl.getDbName(), tbl.getTableName(), desc.getPartSpec(), (short) -1);
+    List<String> parts;
+    if (desc.getCond() != null || desc.getOrder() != null) {
+      ExprNodeDesc pred = desc.getCond();
 
 Review comment:
   Move the logic into method getPartNamesByConstraints alone

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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


[GitHub] [hive] miklosgergely commented on a change in pull request #980: HIVE-22458: Add more constraints on showing partitions

Posted by GitBox <gi...@apache.org>.
miklosgergely commented on a change in pull request #980: HIVE-22458: Add more constraints on showing partitions
URL: https://github.com/apache/hive/pull/980#discussion_r409668346
 
 

 ##########
 File path: ql/src/java/org/apache/hadoop/hive/ql/ddl/table/partition/show/ShowPartitionAnalyzer.java
 ##########
 @@ -89,7 +89,8 @@ public void analyzeInternal(ASTNode ast) throws SemanticException {
     setFetchTask(createFetchTask(ShowPartitionsDesc.SCHEMA));
   }
 
-  private ExprNodeDesc getShowPartitionsFilter(Table table, ASTNode command) throws SemanticException {
+
 
 Review comment:
   Please add @VisibleForTesting

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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


[GitHub] [hive] dengzhhu653 commented on a change in pull request #980: HIVE-22458: Add more constraints on showing partitions

Posted by GitBox <gi...@apache.org>.
dengzhhu653 commented on a change in pull request #980: HIVE-22458: Add more constraints on showing partitions
URL: https://github.com/apache/hive/pull/980#discussion_r409690515
 
 

 ##########
 File path: ql/src/java/org/apache/hadoop/hive/ql/ddl/table/partition/show/ShowPartitionAnalyzer.java
 ##########
 @@ -89,7 +89,8 @@ public void analyzeInternal(ASTNode ast) throws SemanticException {
     setFetchTask(createFetchTask(ShowPartitionsDesc.SCHEMA));
   }
 
-  private ExprNodeDesc getShowPartitionsFilter(Table table, ASTNode command) throws SemanticException {
+
 
 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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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