You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2020/08/15 15:08:07 UTC

[GitHub] [flink] SteNicholas opened a new pull request #13157: [FLINK-18900][hive] HiveCatalog should error out when listing partitions with an invalid spec

SteNicholas opened a new pull request #13157:
URL: https://github.com/apache/flink/pull/13157


   ## What is the purpose of the change
   
   *Currently `HiveCatalog` could return all partitions of table for `SHOW PARTITIONS` with an invalid spec, which is wrong. `HiveCatalog` should error out when listing partitions with an invalid spec.*
   
   ## Brief change log
   
     - *`HiveCatalog` throws `PartitionNotExistException ` after calling `HiveReflectionUtils.getPvals` with an invalid spec.*
   
   ## Verifying this change
   
     - *Method `testShowPartitions` of `HiveDialectITCase` add case for executing `SHOW PARTITIONS` with an invalid spec.*
   
   ## Does this pull request potentially affect one of the following parts:
   
     - Dependencies (does it add or upgrade a dependency): (yes / **no**)
     - The public API, i.e., is any changed class annotated with `@Public(Evolving)`: (yes / **no**)
     - The serializers: (yes / **no** / don't know)
     - The runtime per-record code paths (performance sensitive): (yes / **no** / don't know)
     - Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn/Mesos, ZooKeeper: (yes / **no** / don't know)
     - The S3 file system connector: (yes / **no** / don't know)
   
   ## Documentation
   
     - Does this pull request introduce a new feature? (yes / **no**)
     - If yes, how is the feature documented? (**not applicable** / docs / JavaDocs / not documented)


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



[GitHub] [flink] flinkbot commented on pull request #13157: [FLINK-18900][hive] HiveCatalog should error out when listing partitions with an invalid spec

Posted by GitBox <gi...@apache.org>.
flinkbot commented on pull request #13157:
URL: https://github.com/apache/flink/pull/13157#issuecomment-674409505


   Thanks a lot for your contribution to the Apache Flink project. I'm the @flinkbot. I help the community
   to review your pull request. We will use this comment to track the progress of the review.
   
   
   ## Automated Checks
   Last check on commit b64a33a3e57e4af2522aeaf274c4711ddb2b00ef (Sat Aug 15 15:09:50 UTC 2020)
   
   **Warnings:**
    * No documentation files were touched! Remember to keep the Flink docs up to date!
   
   
   <sub>Mention the bot in a comment to re-run the automated checks.</sub>
   ## Review Progress
   
   * ❓ 1. The [description] looks good.
   * ❓ 2. There is [consensus] that the contribution should go into to Flink.
   * ❓ 3. Needs [attention] from.
   * ❓ 4. The change fits into the overall [architecture].
   * ❓ 5. Overall code [quality] is good.
   
   Please see the [Pull Request Review Guide](https://flink.apache.org/contributing/reviewing-prs.html) for a full explanation of the review process.<details>
    The Bot is tracking the review progress through labels. Labels are applied according to the order of the review items. For consensus, approval by a Flink committer of PMC member is required <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot approve description` to approve one or more aspects (aspects: `description`, `consensus`, `architecture` and `quality`)
    - `@flinkbot approve all` to approve all aspects
    - `@flinkbot approve-until architecture` to approve everything until `architecture`
    - `@flinkbot attention @username1 [@username2 ..]` to require somebody's attention
    - `@flinkbot disapprove architecture` to remove an approval you gave earlier
   </details>


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



[GitHub] [flink] lirui-apache commented on a change in pull request #13157: [FLINK-18900][hive] HiveCatalog should error out when listing partitions with an invalid spec

Posted by GitBox <gi...@apache.org>.
lirui-apache commented on a change in pull request #13157:
URL: https://github.com/apache/flink/pull/13157#discussion_r473905054



##########
File path: flink-connectors/flink-connector-hive/src/main/java/org/apache/flink/table/catalog/hive/HiveCatalog.java
##########
@@ -777,8 +777,11 @@ public void dropPartition(ObjectPath tablePath, CatalogPartitionSpec partitionSp
 			// partition spec can be partial
 			List<String> partialVals = HiveReflectionUtils.getPvals(hiveShim, hiveTable.getPartitionKeys(),
 				partitionSpec.getPartitionSpec());
+			checkValidPartitionSpec(partitionSpec, getFieldNames(hiveTable.getPartitionKeys()), tablePath);
 			return client.listPartitionNames(tablePath.getDatabaseName(), tablePath.getObjectName(), partialVals,
 				(short) -1).stream().map(HiveCatalog::createPartitionSpec).collect(Collectors.toList());
+		} catch (PartitionSpecInvalidException e) {

Review comment:
       Why do we need to catch the exception and throw another one?

##########
File path: flink-connectors/flink-connector-hive/src/main/java/org/apache/flink/table/catalog/hive/HiveCatalog.java
##########
@@ -777,8 +777,11 @@ public void dropPartition(ObjectPath tablePath, CatalogPartitionSpec partitionSp
 			// partition spec can be partial
 			List<String> partialVals = HiveReflectionUtils.getPvals(hiveShim, hiveTable.getPartitionKeys(),
 				partitionSpec.getPartitionSpec());
+			checkValidPartitionSpec(partitionSpec, getFieldNames(hiveTable.getPartitionKeys()), tablePath);

Review comment:
       This should be done before we call `HiveReflectionUtils.getPvals`




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



[GitHub] [flink] lirui-apache commented on pull request #13157: [FLINK-18900][hive] HiveCatalog should error out when listing partitions with an invalid spec

Posted by GitBox <gi...@apache.org>.
lirui-apache commented on pull request #13157:
URL: https://github.com/apache/flink/pull/13157#issuecomment-674685364


   @SteNicholas Thanks for working on this issue. Left some comments.


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



[GitHub] [flink] JingsongLi merged pull request #13157: [FLINK-18900][hive] HiveCatalog should error out when listing partitions with an invalid spec

Posted by GitBox <gi...@apache.org>.
JingsongLi merged pull request #13157:
URL: https://github.com/apache/flink/pull/13157


   


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



[GitHub] [flink] flinkbot edited a comment on pull request #13157: [FLINK-18900][hive] HiveCatalog should error out when listing partitions with an invalid spec

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #13157:
URL: https://github.com/apache/flink/pull/13157#issuecomment-674410767


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "b64a33a3e57e4af2522aeaf274c4711ddb2b00ef",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5554",
       "triggerID" : "b64a33a3e57e4af2522aeaf274c4711ddb2b00ef",
       "triggerType" : "PUSH"
     }, {
       "hash" : "f77481fbdf9900bd2f411ef045cd91985ebb1085",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "f77481fbdf9900bd2f411ef045cd91985ebb1085",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * b64a33a3e57e4af2522aeaf274c4711ddb2b00ef Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5554) 
   * f77481fbdf9900bd2f411ef045cd91985ebb1085 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


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



[GitHub] [flink] flinkbot edited a comment on pull request #13157: [FLINK-18900][hive] HiveCatalog should error out when listing partitions with an invalid spec

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #13157:
URL: https://github.com/apache/flink/pull/13157#issuecomment-674410767


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "b64a33a3e57e4af2522aeaf274c4711ddb2b00ef",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5554",
       "triggerID" : "b64a33a3e57e4af2522aeaf274c4711ddb2b00ef",
       "triggerType" : "PUSH"
     }, {
       "hash" : "f77481fbdf9900bd2f411ef045cd91985ebb1085",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5707",
       "triggerID" : "f77481fbdf9900bd2f411ef045cd91985ebb1085",
       "triggerType" : "PUSH"
     }, {
       "hash" : "bb82e904f49ed492fe36badf6a44bed3267b687c",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "bb82e904f49ed492fe36badf6a44bed3267b687c",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * f77481fbdf9900bd2f411ef045cd91985ebb1085 Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5707) 
   * bb82e904f49ed492fe36badf6a44bed3267b687c UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


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



[GitHub] [flink] flinkbot commented on pull request #13157: [FLINK-18900][hive] HiveCatalog should error out when listing partitions with an invalid spec

Posted by GitBox <gi...@apache.org>.
flinkbot commented on pull request #13157:
URL: https://github.com/apache/flink/pull/13157#issuecomment-674410767


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "b64a33a3e57e4af2522aeaf274c4711ddb2b00ef",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "b64a33a3e57e4af2522aeaf274c4711ddb2b00ef",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * b64a33a3e57e4af2522aeaf274c4711ddb2b00ef UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


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



[GitHub] [flink] flinkbot edited a comment on pull request #13157: [FLINK-18900][hive] HiveCatalog should error out when listing partitions with an invalid spec

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #13157:
URL: https://github.com/apache/flink/pull/13157#issuecomment-674410767


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "b64a33a3e57e4af2522aeaf274c4711ddb2b00ef",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5554",
       "triggerID" : "b64a33a3e57e4af2522aeaf274c4711ddb2b00ef",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * b64a33a3e57e4af2522aeaf274c4711ddb2b00ef Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5554) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


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



[GitHub] [flink] lirui-apache commented on a change in pull request #13157: [FLINK-18900][hive] HiveCatalog should error out when listing partitions with an invalid spec

Posted by GitBox <gi...@apache.org>.
lirui-apache commented on a change in pull request #13157:
URL: https://github.com/apache/flink/pull/13157#discussion_r471253972



##########
File path: flink-connectors/flink-connector-hive/src/main/java/org/apache/flink/table/catalog/hive/HiveCatalog.java
##########
@@ -777,8 +777,15 @@ public void dropPartition(ObjectPath tablePath, CatalogPartitionSpec partitionSp
 			// partition spec can be partial
 			List<String> partialVals = HiveReflectionUtils.getPvals(hiveShim, hiveTable.getPartitionKeys(),
 				partitionSpec.getPartitionSpec());
-			return client.listPartitionNames(tablePath.getDatabaseName(), tablePath.getObjectName(), partialVals,
-				(short) -1).stream().map(HiveCatalog::createPartitionSpec).collect(Collectors.toList());
+			if (partialVals.size() == 1 && StringUtils.isNullOrWhitespaceOnly(partialVals.get(0))) {

Review comment:
       We can simply try calling `getOrderedFullPartitionValues`, which will check if the spec is valid

##########
File path: flink-connectors/flink-connector-hive/src/main/java/org/apache/flink/table/catalog/hive/HiveCatalog.java
##########
@@ -765,7 +765,7 @@ public void dropPartition(ObjectPath tablePath, CatalogPartitionSpec partitionSp
 
 	@Override
 	public List<CatalogPartitionSpec> listPartitions(ObjectPath tablePath, CatalogPartitionSpec partitionSpec)
-			throws TableNotExistException, TableNotPartitionedException, CatalogException {
+			throws TableNotExistException, TableNotPartitionedException, PartitionNotExistException, CatalogException {

Review comment:
       In case of invalid partition spec, we should throw `PartitionSpecInvalidException`

##########
File path: flink-connectors/flink-connector-hive/src/test/java/org/apache/flink/connectors/hive/HiveDialectITCase.java
##########
@@ -467,14 +468,36 @@ public void testAddDropPartitions() throws Exception {
 
 	@Test
 	public void testShowPartitions() throws Exception {
-		tableEnv.executeSql("create table tbl (x int,y binary) partitioned by (dt date, country string)");
-		tableEnv.executeSql("alter table tbl add partition (dt='2020-04-30',country='china') partition (dt='2020-04-30',country='us')");
+		tableEnv.executeSql("create table tbl (x int,y binary) partitioned by (country string)");

Review comment:
       Why do we need a different table schema? I think you can just reuse the table in this test




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



[GitHub] [flink] JingsongLi commented on pull request #13157: [FLINK-18900][hive] HiveCatalog should error out when listing partitions with an invalid spec

Posted by GitBox <gi...@apache.org>.
JingsongLi commented on pull request #13157:
URL: https://github.com/apache/flink/pull/13157#issuecomment-678087889


   @SteNicholas Can you create a PR for release-1.11? There are some conflicts.


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



[GitHub] [flink] flinkbot edited a comment on pull request #13157: [FLINK-18900][hive] HiveCatalog should error out when listing partitions with an invalid spec

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #13157:
URL: https://github.com/apache/flink/pull/13157#issuecomment-674410767


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "b64a33a3e57e4af2522aeaf274c4711ddb2b00ef",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5554",
       "triggerID" : "b64a33a3e57e4af2522aeaf274c4711ddb2b00ef",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * b64a33a3e57e4af2522aeaf274c4711ddb2b00ef Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5554) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


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



[GitHub] [flink] flinkbot edited a comment on pull request #13157: [FLINK-18900][hive] HiveCatalog should error out when listing partitions with an invalid spec

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #13157:
URL: https://github.com/apache/flink/pull/13157#issuecomment-674410767


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "b64a33a3e57e4af2522aeaf274c4711ddb2b00ef",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5554",
       "triggerID" : "b64a33a3e57e4af2522aeaf274c4711ddb2b00ef",
       "triggerType" : "PUSH"
     }, {
       "hash" : "f77481fbdf9900bd2f411ef045cd91985ebb1085",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5707",
       "triggerID" : "f77481fbdf9900bd2f411ef045cd91985ebb1085",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * f77481fbdf9900bd2f411ef045cd91985ebb1085 Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5707) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


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



[GitHub] [flink] flinkbot edited a comment on pull request #13157: [FLINK-18900][hive] HiveCatalog should error out when listing partitions with an invalid spec

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #13157:
URL: https://github.com/apache/flink/pull/13157#issuecomment-674410767


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "b64a33a3e57e4af2522aeaf274c4711ddb2b00ef",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5554",
       "triggerID" : "b64a33a3e57e4af2522aeaf274c4711ddb2b00ef",
       "triggerType" : "PUSH"
     }, {
       "hash" : "f77481fbdf9900bd2f411ef045cd91985ebb1085",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5707",
       "triggerID" : "f77481fbdf9900bd2f411ef045cd91985ebb1085",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * b64a33a3e57e4af2522aeaf274c4711ddb2b00ef Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5554) 
   * f77481fbdf9900bd2f411ef045cd91985ebb1085 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5707) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


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