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/11/11 10:02:27 UTC

[GitHub] [hive] vnhive opened a new pull request #1664: HIVE-24370 : Make the GetPartitionsProjectionSpec generic and add bui…

vnhive opened a new pull request #1664:
URL: https://github.com/apache/hive/pull/1664


   …lder methods for tables and partitions in HiveMetaStoreClient
   
   <!--
   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.
   
   -->
   
   HIVE-20306 defines a projection struct called GetPartitionsProjectionSpec While the name has Partition in its name, this is a fairly generic struct with nothing specific to partitions. This should be renamed to a more generic name (GetProjectionSpec ?) and builder methods of this class for tables and partitions must be added to HiveMetaStoreClient.
   
   <!--
   Please clarify what changes you are proposing. The purpose of this section is to outline the changes and how this PR fixes the issue. 
   If possible, please consider writing useful notes for better and faster reviews in your PR. See the examples below.
     1. If you refactor some codes with changing classes, showing the class hierarchy will help reviewers.
     2. If you fix some SQL features, you can provide some references of other DBMSes.
     3. If there is design documentation, please add the link.
     4. If there is a discussion in the mailing list, please add the link.
   -->
   
   
   The changes in this JIRA will help reuse the projection specification for projecting required table columns.
   
   <!--
   Please clarify why the changes are needed. For instance,
     1. If you propose a new API, clarify the use case for a new API.
     2. If you fix a bug, you can clarify why it is a bug.
   -->
   
   
   There are no user facing changes in this patch.
   
   <!--
   Note that it means *any* user-facing change including all aspects such as the documentation fix.
   If yes, please clarify the previous behavior and the change this PR proposes - provide the console output, description, screenshot and/or a reproducable example to show the behavior difference if possible.
   If possible, please also clarify if this is a user-facing change compared to the released Hive versions or within the unreleased branches such as master.
   If no, write 'No'.
   -->
   
   
   The existing tests ran. Since this was only the renaming of a class the fix is expected to be non-intrusive.
   
   <!--
   If tests were added, say they were added here. Please make sure to add some test cases that check the changes thoroughly including negative and positive cases if possible.
   If it was tested in a way different from regular unit tests, please clarify how you tested step by step, ideally copy and paste-able, so that other reviewers can test and check, and descendants can verify in the future.
   If tests were not added, please describe why they were not added and/or why it was difficult to add.
   -->
   


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



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


[GitHub] [hive] vnhive commented on a change in pull request #1664: HIVE-24370 : Make the GetPartitionsProjectionSpec generic and add bui…

Posted by GitBox <gi...@apache.org>.
vnhive commented on a change in pull request #1664:
URL: https://github.com/apache/hive/pull/1664#discussion_r522414108



##########
File path: standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java
##########
@@ -4664,6 +4664,58 @@ public void dropStoredProcedure(StoredProcedureRequest request) throws MetaExcep
     return client.get_all_stored_procedures(request);
   }
 
+  /**
+   * Builder for the GetProjectionsSpec. This is a projection specification for partitions returned from the HMS.
+   */
+  public static class GetPartitionProjectionsSpecBuilder {
+
+    java.util.List<java.lang.String> partitionList = null;

Review comment:
       I agree these should be private. I will change them.




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



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


[GitHub] [hive] nrg4878 commented on pull request #1664: HIVE-24370 : Make the GetPartitionsProjectionSpec generic and add bui…

Posted by GitBox <gi...@apache.org>.
nrg4878 commented on pull request #1664:
URL: https://github.com/apache/hive/pull/1664#issuecomment-725490777


   @pgaref Thanks for the comments. We have given much thought to backward-compatibility. This feature was introduced in Apache Hive 4.0.0. So there has not been an upstream release with this fix. So it should not cause a backward incompatibility. We did not want to do this otherwise. 
   Regarding downstream releases, we have found that there are no clients to this API call yet. So HiveServer and Impala are not using this yet. So we have some freedom to change this before it is adopted.
   
   Please let us know if you still have concerns about backward-compatibility. Thanks
   
   @vnhive  I do not see the builder for the projection spec. What source file is it in? 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



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


[GitHub] [hive] vnhive commented on a change in pull request #1664: HIVE-24370 : Make the GetPartitionsProjectionSpec generic and add bui…

Posted by GitBox <gi...@apache.org>.
vnhive commented on a change in pull request #1664:
URL: https://github.com/apache/hive/pull/1664#discussion_r522414765



##########
File path: standalone-metastore/metastore-common/src/main/thrift/hive_metastore.thrift
##########
@@ -1979,7 +1979,7 @@ struct GetPartitionsRequest {
    4: optional bool withAuth,
    5: optional string user,
    6: optional list<string> groupNames,
-   7: GetPartitionsProjectionSpec projectionSpec
+   7: GetProjectionsSpec projectionSpec
    8: GetPartitionsFilterSpec filterSpec, // TODO not yet implemented. Must be present but ignored

Review comment:
       I generally thought it is forbidden to make changes unrelated to the JIRA in a patch. Ofcourse this is a minor change and I will do as you suggest. Thank you for the comment.




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



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


[GitHub] [hive] vineetgarg02 commented on a change in pull request #1664: HIVE-24370 : Make the GetPartitionsProjectionSpec generic and add bui…

Posted by GitBox <gi...@apache.org>.
vineetgarg02 commented on a change in pull request #1664:
URL: https://github.com/apache/hive/pull/1664#discussion_r522283921



##########
File path: standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java
##########
@@ -4664,6 +4664,58 @@ public void dropStoredProcedure(StoredProcedureRequest request) throws MetaExcep
     return client.get_all_stored_procedures(request);
   }
 
+  /**
+   * Builder for the GetProjectionsSpec. This is a projection specification for partitions returned from the HMS.
+   */
+  public static class GetPartitionProjectionsSpecBuilder {

Review comment:
       Can we create a common interface implementing build and have both of the classes implement it?
   Is it possible to move the builder implementations to separate file? HiveMetaStoreClient is already too big.




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



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


[GitHub] [hive] pgaref commented on pull request #1664: HIVE-24370 : Make the GetPartitionsProjectionSpec generic and add bui…

Posted by GitBox <gi...@apache.org>.
pgaref commented on pull request #1664:
URL: https://github.com/apache/hive/pull/1664#issuecomment-725334010


   Hey @vnhive -- what about GetPartitionsFilterSpec method? If it has the same naming issue it should be probably taken care of along with GetPartitionsProjectionSpec


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



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


[GitHub] [hive] vnhive commented on a change in pull request #1664: HIVE-24370 : Make the GetPartitionsProjectionSpec generic and add bui…

Posted by GitBox <gi...@apache.org>.
vnhive commented on a change in pull request #1664:
URL: https://github.com/apache/hive/pull/1664#discussion_r522413583



##########
File path: standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java
##########
@@ -4664,6 +4664,58 @@ public void dropStoredProcedure(StoredProcedureRequest request) throws MetaExcep
     return client.get_all_stored_procedures(request);
   }
 
+  /**
+   * Builder for the GetProjectionsSpec. This is a projection specification for partitions returned from the HMS.
+   */
+  public static class GetPartitionProjectionsSpecBuilder {

Review comment:
       @vineetgarg02 
   
   Thanks a lot for taking time to review the changes and comment on them.
   
   The builder classes follow the builder pattern who's definition generally calls for the presence of the build() method. I think creating a separate interface with just the build() method that these classes implement carries a slight risk of making them superfluous. I humbly ask you to reconsider this.
   
   I agree that it makes sense to move the builder implementations to a separate file and ease the burden on the large HiveMetaStoreClient file. But I think the change should not be done as part of this JIRA. Do you think I can create a separate JIRA for this and do it there ?
   
   @vihangk1 
   
   Thank you very much for taking the time to review the changes and comment on them.
   
   I agree that we should look at creating builder methods for GetTableRequest and GetPartitionRequest. But I am inclined to push the request builders out of this JIRA. Do you think it would be OK to retain the projection specification builders in this JIRA, create a separate JIRA for the Request builder and handle that once I am done with the parent issue ?
   
   




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



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


[GitHub] [hive] vihangk1 commented on a change in pull request #1664: HIVE-24370 : Make the GetPartitionsProjectionSpec generic and add bui…

Posted by GitBox <gi...@apache.org>.
vihangk1 commented on a change in pull request #1664:
URL: https://github.com/apache/hive/pull/1664#discussion_r522319043



##########
File path: standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java
##########
@@ -4664,6 +4664,58 @@ public void dropStoredProcedure(StoredProcedureRequest request) throws MetaExcep
     return client.get_all_stored_procedures(request);
   }
 
+  /**
+   * Builder for the GetProjectionsSpec. This is a projection specification for partitions returned from the HMS.
+   */
+  public static class GetPartitionProjectionsSpecBuilder {
+
+    java.util.List<java.lang.String> partitionList = null;

Review comment:
       Can we mark these fields as private? Any particular reason they are package private?

##########
File path: standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java
##########
@@ -4664,6 +4664,58 @@ public void dropStoredProcedure(StoredProcedureRequest request) throws MetaExcep
     return client.get_all_stored_procedures(request);
   }
 
+  /**
+   * Builder for the GetProjectionsSpec. This is a projection specification for partitions returned from the HMS.
+   */
+  public static class GetPartitionProjectionsSpecBuilder {
+
+    java.util.List<java.lang.String> partitionList = null;
+    java.lang.String includePartitionPattern = null;
+    java.lang.String excludePartitionPattern = null;
+
+    public void setPartitionList(List<String> partitionList) {
+      this.partitionList = partitionList;
+    }
+
+    public void setIncludePartitionPattern(String includePartitionPattern) {
+      this.includePartitionPattern = includePartitionPattern;
+    }
+
+    public void setExcludePartitionPattern(String excludePartitionPattern) {
+      this.excludePartitionPattern = excludePartitionPattern;
+    }
+
+    public GetProjectionsSpec build() {
+      return new GetProjectionsSpec(partitionList, includePartitionPattern, excludePartitionPattern);
+    }
+  }
+
+  /**
+   * Builder for the GetProjectionsSpec. This is a projection specification for tables returned from the HMS.
+   */
+  public static class GetTableProjectionsSpecBuilder {
+
+    java.util.List<java.lang.String> columnList = null;

Review comment:
       nit, no need to use fully qualified List here. also for String. Same for the earlier builder class as well. Please make these fields private.

##########
File path: standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java
##########
@@ -4664,6 +4664,58 @@ public void dropStoredProcedure(StoredProcedureRequest request) throws MetaExcep
     return client.get_all_stored_procedures(request);
   }
 
+  /**
+   * Builder for the GetProjectionsSpec. This is a projection specification for partitions returned from the HMS.
+   */
+  public static class GetPartitionProjectionsSpecBuilder {

Review comment:
       From a user perspective, I think it would be more user friendly to have builder class for the whole request objects (eg. GetPartitionsRequestBuilder which gives ability to create a projection and filter spec)

##########
File path: standalone-metastore/metastore-common/src/main/thrift/hive_metastore.thrift
##########
@@ -1979,7 +1979,7 @@ struct GetPartitionsRequest {
    4: optional bool withAuth,
    5: optional string user,
    6: optional list<string> groupNames,
-   7: GetPartitionsProjectionSpec projectionSpec
+   7: GetProjectionsSpec projectionSpec
    8: GetPartitionsFilterSpec filterSpec, // TODO not yet implemented. Must be present but ignored

Review comment:
       Not related to your change, but looks like that TODO should be removed since we have the filterspec implemented.




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



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


[GitHub] [hive] vnhive commented on pull request #1664: HIVE-24370 : Make the GetPartitionsProjectionSpec generic and add bui…

Posted by GitBox <gi...@apache.org>.
vnhive commented on pull request #1664:
URL: https://github.com/apache/hive/pull/1664#issuecomment-726331004


   > I think renaming the fields is okay since this API has not been released it. Glad that we are able to generalize this for use for tables as well.
   
   Thank you for the 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.

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] nrg4878 commented on pull request #1664: HIVE-24370 : Make the GetPartitionsProjectionSpec generic and add bui…

Posted by GitBox <gi...@apache.org>.
nrg4878 commented on pull request #1664:
URL: https://github.com/apache/hive/pull/1664#issuecomment-730500913


   @vnhive Fix has now been committed to master. Thank you for the contribution.


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



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


[GitHub] [hive] github-actions[bot] closed pull request #1664: HIVE-24370 : Make the GetPartitionsProjectionSpec generic and add bui…

Posted by GitBox <gi...@apache.org>.
github-actions[bot] closed pull request #1664:
URL: https://github.com/apache/hive/pull/1664


   


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



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


[GitHub] [hive] pgaref edited a comment on pull request #1664: HIVE-24370 : Make the GetPartitionsProjectionSpec generic and add bui…

Posted by GitBox <gi...@apache.org>.
pgaref edited a comment on pull request #1664:
URL: https://github.com/apache/hive/pull/1664#issuecomment-725334010


   Hey @vnhive -- what about GetPartitionsFilterSpec method? If it has the same naming issue it should be probably taken care of along with GetPartitionsProjectionSpec
   
   As a side note, as it changes the metastore thrift specs it probably causes backward incompatibility issues


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



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


[GitHub] [hive] vnhive commented on a change in pull request #1664: HIVE-24370 : Make the GetPartitionsProjectionSpec generic and add bui…

Posted by GitBox <gi...@apache.org>.
vnhive commented on a change in pull request #1664:
URL: https://github.com/apache/hive/pull/1664#discussion_r522414350



##########
File path: standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java
##########
@@ -4664,6 +4664,58 @@ public void dropStoredProcedure(StoredProcedureRequest request) throws MetaExcep
     return client.get_all_stored_procedures(request);
   }
 
+  /**
+   * Builder for the GetProjectionsSpec. This is a projection specification for partitions returned from the HMS.
+   */
+  public static class GetPartitionProjectionsSpecBuilder {
+
+    java.util.List<java.lang.String> partitionList = null;
+    java.lang.String includePartitionPattern = null;
+    java.lang.String excludePartitionPattern = null;
+
+    public void setPartitionList(List<String> partitionList) {
+      this.partitionList = partitionList;
+    }
+
+    public void setIncludePartitionPattern(String includePartitionPattern) {
+      this.includePartitionPattern = includePartitionPattern;
+    }
+
+    public void setExcludePartitionPattern(String excludePartitionPattern) {
+      this.excludePartitionPattern = excludePartitionPattern;
+    }
+
+    public GetProjectionsSpec build() {
+      return new GetProjectionsSpec(partitionList, includePartitionPattern, excludePartitionPattern);
+    }
+  }
+
+  /**
+   * Builder for the GetProjectionsSpec. This is a projection specification for tables returned from the HMS.
+   */
+  public static class GetTableProjectionsSpecBuilder {
+
+    java.util.List<java.lang.String> columnList = null;

Review comment:
       will do. Thank you for pointing these out.




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



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


[GitHub] [hive] github-actions[bot] commented on pull request #1664: HIVE-24370 : Make the GetPartitionsProjectionSpec generic and add bui…

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #1664:
URL: https://github.com/apache/hive/pull/1664#issuecomment-762545183


   This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
   Feel free to reach out on the dev@hive.apache.org list if the patch is in need of reviews.


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



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