You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@paimon.apache.org by "xuzifu666 (via GitHub)" <gi...@apache.org> on 2024/05/13 09:09:14 UTC
[PR] [spark] MigrateTableProcedure support keep origin table and rename target paimon table [paimon]
xuzifu666 opened a new pull request, #3328:
URL: https://github.com/apache/paimon/pull/3328
<!-- Please specify the module before the PR name: [core] ... or [flink] ... -->
Currently MigrateTableProcedure only support migrate table with origin name,but some conditions user not want to drop origin table in hms or want to rename a new target table name,this pr is aim to support it.
<!-- Linking this pull request to the issue -->
Linked issue: close #xxx
<!-- What is the purpose of the change -->
### Tests
<!-- List UT and IT cases to verify this change -->
### API and Format
<!-- Does this change affect API or storage format -->
### Documentation
<!-- Does this change introduce a new feature -->
--
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@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [spark] MigrateTableProcedure support keep origin table and rename target paimon table [paimon]
Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi commented on PR #3328:
URL: https://github.com/apache/paimon/pull/3328#issuecomment-2107416819
+1
--
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@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [spark] MigrateTableProcedure support keep origin table and rename target paimon table [paimon]
Posted by "xuzifu666 (via GitHub)" <gi...@apache.org>.
xuzifu666 commented on code in PR #3328:
URL: https://github.com/apache/paimon/pull/3328#discussion_r1598210826
##########
docs/content/spark/procedures.md:
##########
@@ -101,6 +101,18 @@ This section introduce all available spark procedures about paimon.
CALL sys.rollback(table => 'default.T', version => 10)
</td>
</tr>
+ <tr>
+ <td>migrate_table</td>
+ <td>
+ Migrate hive table to a paimon table. Arguments:
+ <li>source_type: the origin table's type to be migrated, such as hive. Cannot be empty.</li>
+ <li>table: name of the origin table to be migrated. Cannot be empty.</li>
+ <li>options: the table options of the paimon table to migrate.</li>
+ <li>delete_origin: whether to delete the origin table metadata from hms after migrate. Default is true</li>
Review Comment:
Get, <li>target_table: name of the target paimon table to migrate. If not set would keep the same name with origin hive table</li> this describtion would be OK?
--
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@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [spark] MigrateTableProcedure support keep origin table and rename target paimon table [paimon]
Posted by "xuzifu666 (via GitHub)" <gi...@apache.org>.
xuzifu666 commented on code in PR #3328:
URL: https://github.com/apache/paimon/pull/3328#discussion_r1598210826
##########
docs/content/spark/procedures.md:
##########
@@ -101,6 +101,18 @@ This section introduce all available spark procedures about paimon.
CALL sys.rollback(table => 'default.T', version => 10)
</td>
</tr>
+ <tr>
+ <td>migrate_table</td>
+ <td>
+ Migrate hive table to a paimon table. Arguments:
+ <li>source_type: the origin table's type to be migrated, such as hive. Cannot be empty.</li>
+ <li>table: name of the origin table to be migrated. Cannot be empty.</li>
+ <li>options: the table options of the paimon table to migrate.</li>
+ <li>delete_origin: whether to delete the origin table metadata from hms after migrate. Default is true</li>
Review Comment:
Get, <li>target_table: name of the target paimon table to migrate. If not set would keep the same name with origin hive table</li> this describtion would be OK?
--
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@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [spark] MigrateTableProcedure support keep origin table and rename target paimon table [paimon]
Posted by "xuzifu666 (via GitHub)" <gi...@apache.org>.
xuzifu666 commented on code in PR #3328:
URL: https://github.com/apache/paimon/pull/3328#discussion_r1598211907
##########
paimon-core/src/main/java/org/apache/paimon/migrate/Migrator.java:
##########
@@ -24,4 +24,6 @@ public interface Migrator {
void executeMigrate() throws Exception;
void renameTable(boolean ignoreIfNotExists) throws Exception;
+
+ public void deleteOriginTable(Boolean delete) throws Exception;
Review Comment:
addressed
##########
paimon-hive/paimon-hive-catalog/src/main/java/org/apache/paimon/hive/migrate/HiveMigrator.java:
##########
@@ -78,6 +78,7 @@ public class HiveMigrator implements Migrator {
private final String targetDatabase;
private final String targetTable;
private final Map<String, String> options;
+ private Boolean delete = true;
Review Comment:
addressedaddressed
##########
paimon-spark/paimon-spark-common/src/main/java/org/apache/paimon/spark/procedure/MigrateTableProcedure.java:
##########
@@ -77,9 +81,14 @@ public InternalRow[] call(InternalRow args) {
String format = args.getString(0);
String sourceTable = args.getString(1);
String properties = args.isNullAt(2) ? null : args.getString(2);
+ Boolean deleteNeed = args.isNullAt(3) ? true : args.getBoolean(3);
Review Comment:
addressed
--
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@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [spark] MigrateTableProcedure support keep origin table and rename target paimon table [paimon]
Posted by "xuzifu666 (via GitHub)" <gi...@apache.org>.
xuzifu666 commented on code in PR #3328:
URL: https://github.com/apache/paimon/pull/3328#discussion_r1598228747
##########
docs/content/spark/procedures.md:
##########
@@ -101,6 +101,18 @@ This section introduce all available spark procedures about paimon.
CALL sys.rollback(table => 'default.T', version => 10)
</td>
</tr>
+ <tr>
+ <td>migrate_table</td>
+ <td>
+ Migrate hive table to a paimon table. Arguments:
+ <li>source_type: the origin table's type to be migrated, such as hive. Cannot be empty.</li>
+ <li>table: name of the origin table to be migrated. Cannot be empty.</li>
+ <li>options: the table options of the paimon table to migrate.</li>
+ <li>delete_origin: whether to delete the origin table metadata from hms after migrate. Default is true</li>
Review Comment:
Thanks for the reminder,change it to:
<td>delete_origin: If had set target_table, can set delete_origin to decide whether delete the origin table metadata from hms after migrate. Default is true</td> @JingsongLi
--
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@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [spark] MigrateTableProcedure support keep origin table and rename target paimon table [paimon]
Posted by "xuzifu666 (via GitHub)" <gi...@apache.org>.
xuzifu666 commented on code in PR #3328:
URL: https://github.com/apache/paimon/pull/3328#discussion_r1598228747
##########
docs/content/spark/procedures.md:
##########
@@ -101,6 +101,18 @@ This section introduce all available spark procedures about paimon.
CALL sys.rollback(table => 'default.T', version => 10)
</td>
</tr>
+ <tr>
+ <td>migrate_table</td>
+ <td>
+ Migrate hive table to a paimon table. Arguments:
+ <li>source_type: the origin table's type to be migrated, such as hive. Cannot be empty.</li>
+ <li>table: name of the origin table to be migrated. Cannot be empty.</li>
+ <li>options: the table options of the paimon table to migrate.</li>
+ <li>delete_origin: whether to delete the origin table metadata from hms after migrate. Default is true</li>
Review Comment:
Thanks for the remind,change it to:
<td>delete_origin: If had set target_table, can set delete_origin to decide whether delete the origin table metadata from hms after migrate. Default is true</td> @JingsongLi
--
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@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [spark] MigrateTableProcedure support keep origin table and rename target paimon table [paimon]
Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi merged PR #3328:
URL: https://github.com/apache/paimon/pull/3328
--
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@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [spark] MigrateTableProcedure support keep origin table and rename target paimon table [paimon]
Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi commented on code in PR #3328:
URL: https://github.com/apache/paimon/pull/3328#discussion_r1598198514
##########
docs/content/spark/procedures.md:
##########
@@ -101,6 +101,18 @@ This section introduce all available spark procedures about paimon.
CALL sys.rollback(table => 'default.T', version => 10)
</td>
</tr>
+ <tr>
+ <td>migrate_table</td>
+ <td>
+ Migrate hive table to a paimon table. Arguments:
+ <li>source_type: the origin table's type to be migrated, such as hive. Cannot be empty.</li>
+ <li>table: name of the origin table to be migrated. Cannot be empty.</li>
+ <li>options: the table options of the paimon table to migrate.</li>
+ <li>delete_origin: whether to delete the origin table metadata from hms after migrate. Default is true</li>
Review Comment:
I think we should mention the option of target_table in the description. Without target_table, this option is difficult to understand.
##########
paimon-hive/paimon-hive-catalog/src/main/java/org/apache/paimon/hive/migrate/HiveMigrator.java:
##########
@@ -78,6 +78,7 @@ public class HiveMigrator implements Migrator {
private final String targetDatabase;
private final String targetTable;
private final Map<String, String> options;
+ private Boolean delete = true;
Review Comment:
boolean
##########
paimon-spark/paimon-spark-common/src/main/java/org/apache/paimon/spark/procedure/MigrateTableProcedure.java:
##########
@@ -77,9 +81,14 @@ public InternalRow[] call(InternalRow args) {
String format = args.getString(0);
String sourceTable = args.getString(1);
String properties = args.isNullAt(2) ? null : args.getString(2);
+ Boolean deleteNeed = args.isNullAt(3) ? true : args.getBoolean(3);
Review Comment:
boolean
##########
paimon-core/src/main/java/org/apache/paimon/migrate/Migrator.java:
##########
@@ -24,4 +24,6 @@ public interface Migrator {
void executeMigrate() throws Exception;
void renameTable(boolean ignoreIfNotExists) throws Exception;
+
+ public void deleteOriginTable(Boolean delete) throws Exception;
Review Comment:
boolean
--
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@paimon.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org