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 2022/04/24 07:08:20 UTC
[GitHub] [flink] lsyldliu opened a new pull request, #19558: [FLINK-27242][table] Support RENAME PARTITION statement for partitioned table
lsyldliu opened a new pull request, #19558:
URL: https://github.com/apache/flink/pull/19558
## What is the purpose of the change
*Support RENAME PARTITION statement for partitioned table*
## Brief change log
- *Support RENAME PARTITION statement for partitioned table*
## Verifying this change
This change added tests and can be verified as follows:
- *Added unit tests in SqlToOperationConverterTest*
## Does this pull request potentially affect one of the following parts:
- Dependencies (does it add or upgrade a dependency): ( no)
- The public API, i.e., is any changed class annotated with `@Public(Evolving)`: (no)
- The serializers: (no)
- The runtime per-record code paths (performance sensitive): (no)
- Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: (no)
- The S3 file system connector: (no)
## Documentation
- Does this pull request introduce a new feature? (yes)
- If yes, how is the feature documented? (docs)
--
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-27242][table] Support RENAME PARTITION statement for partitioned table [flink]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #19558:
URL: https://github.com/apache/flink/pull/19558#issuecomment-2765256217
This PR has been closed since it has not had any activity in 120 days.
If you feel like this was a mistake, or you would like to continue working on it,
please feel free to re-open the PR and ask for a review.
--
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [flink] flinkbot commented on pull request #19558: [FLINK-27242][table] Support RENAME PARTITION statement for partitioned table
Posted by GitBox <gi...@apache.org>.
flinkbot commented on PR #19558:
URL: https://github.com/apache/flink/pull/19558#issuecomment-1107777158
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "41352aea4c633fcd3f8b83acca117a23c921818c",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "41352aea4c633fcd3f8b83acca117a23c921818c",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 41352aea4c633fcd3f8b83acca117a23c921818c UNKNOWN
<details>
<summary>Bot commands</summary>
The @flinkbot bot supports the following commands:
- `@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.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [flink] luoyuxia commented on a diff in pull request #19558: [FLINK-27242][table] Support RENAME PARTITION statement for partitioned table
Posted by GitBox <gi...@apache.org>.
luoyuxia commented on code in PR #19558:
URL: https://github.com/apache/flink/pull/19558#discussion_r857413479
##########
flink-table/flink-sql-parser/src/test/java/org/apache/flink/sql/parser/FlinkSqlParserImplTest.java:
##########
@@ -338,6 +338,21 @@ void testAlterTableCompact() {
.fails("(?s).*Encountered \"\\)\" at line 1, column 26.\n.*");
}
+ @Test
+ public void testAlterPartitionRename() {
+ sql("alter table tbl partition (p=1) rename to partition (p=2)")
+ .ok(
+ "ALTER TABLE `TBL` PARTITION (`P` = 1)\n"
+ + "RENAME TO\n"
+ + "PARTITION (`P` = 2)");
+
+ sql("alter table tbl rename to partition (p=2)")
Review Comment:
the sql can't be parsed
##########
flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/operations/SqlToOperationConverter.java:
##########
@@ -543,6 +550,65 @@ private Operation convertAlterTable(SqlAlterTable sqlAlterTable) {
}
}
+ private Operation convertPartitionRename(
+ ObjectIdentifier tableIdentifier,
+ ResolvedCatalogTable resolvedTable,
+ SqlAlterPartitionRename partitionRename) {
+ List<String> partitionKeys = resolvedTable.getPartitionKeys();
+ LinkedHashMap<String, String> oldPartKVs = partitionRename.getPartitionKVs();
+ LinkedHashMap<String, String> newPartKVs = partitionRename.getNewPartitionKVs();
+ // validate the partition spec
+ validatePartitionSpec(tableIdentifier, partitionKeys, oldPartKVs);
+ validatePartitionSpec(tableIdentifier, partitionKeys, newPartKVs);
+
+ CatalogPartitionSpec oldPartitionSpec = new CatalogPartitionSpec(oldPartKVs);
+ CatalogPartitionSpec newPartitionSpec = new CatalogPartitionSpec(newPartKVs);
+ CatalogPartition catalogPartition =
+ catalogManager
+ .getPartition(tableIdentifier, oldPartitionSpec)
+ .orElseThrow(
+ () ->
+ new ValidationException(
+ String.format(
+ "Partition %s of table %s doesn't exist.",
+ oldPartitionSpec.getPartitionSpec(),
+ tableIdentifier)));
+ return new PartitionRenameOperation(
+ tableIdentifier, oldPartitionSpec, newPartitionSpec, catalogPartition.copy());
Review Comment:
why `catalogPartition.copy()`? do we need copy `catalogPartition`?
##########
flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/TableEnvironmentImpl.java:
##########
@@ -986,6 +987,20 @@ public TableResultInternal executeInternal(Operation operation) {
for (CatalogPartitionSpec spec : dropPartitionsOperation.getPartitionSpecs()) {
catalog.dropPartition(tablePath, spec, ifExists);
}
+ } else if (alterTableOperation instanceof PartitionRenameOperation) {
+ PartitionRenameOperation partitionRenameOperation =
+ (PartitionRenameOperation) alterTableOperation;
+ ObjectPath tablePath =
+ partitionRenameOperation.getTableIdentifier().toObjectPath();
+ // drop old partition first, require old partition exist
+ catalog.dropPartition(
Review Comment:
For `PartitionRenameOperation`, I suggest to make catalog itself to deal with it insteading always drop partition + add partition.
For example, Hive provides renamePartition API. Although it also first drops and then adds partition, but it does more things such like update added partition to refer to the old partition's location.
--
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-27242][table] Support RENAME PARTITION statement for partitioned table [flink]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #19558:
URL: https://github.com/apache/flink/pull/19558#issuecomment-2591723963
This PR is being marked as stale since it has not had any activity in the last 180 days.
If you would like to keep this PR alive, please leave a comment asking for a review.
If the PR has merge conflicts, update it with the latest from the base branch.
<p>
If you are having difficulty finding a reviewer, please reach out to the
[community](https://flink.apache.org/what-is-flink/community/).
<p>
If this PR is no longer valid or desired, please feel free to close it.
If no activity occurs in the next 90 days, it will be automatically closed.
--
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-27242][table] Support RENAME PARTITION statement for partitioned table [flink]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed pull request #19558: [FLINK-27242][table] Support RENAME PARTITION statement for partitioned table
URL: https://github.com/apache/flink/pull/19558
--
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org