You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@paimon.apache.org by "zhuangchong (via GitHub)" <gi...@apache.org> on 2023/08/17 03:46:38 UTC

[GitHub] [incubator-paimon] zhuangchong opened a new pull request, #1833: [hive] After Flink changed the table name when using hive metastore, the modified table could not be found.

zhuangchong opened a new pull request, #1833:
URL: https://github.com/apache/incubator-paimon/pull/1833

   …
   
   <!-- Please specify the module before the PR name: [core] ... or [flink] ... -->
   
   ### Purpose
   
   <!-- Linking this pull request to the issue -->
   Linked issue: close #831
   
   <!-- What is the purpose of the change -->
   
   ### Tests
   
   <!-- List UT and IT cases to verify this change -->
   HiveCatalogITCaseBase#testRenameTable
   
   ### 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


[GitHub] [incubator-paimon] zhuangchong commented on pull request #1833: [hive] After Flink changed the table name when using hive metastore, the modified table could not be found.

Posted by "zhuangchong (via GitHub)" <gi...@apache.org>.
zhuangchong commented on PR #1833:
URL: https://github.com/apache/incubator-paimon/pull/1833#issuecomment-1683230099

   Thanks @zhangjun0x01 @JingsongLi 
   
   I suggest that at the code layer, first execute the hive client alert_table method to rename, then check toPath, if it does not exist, call fileIO rename, and update hive location. What do you think? @JingsongLi @zhangjun0x01 


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


[GitHub] [incubator-paimon] zhuangchong commented on a diff in pull request #1833: [hive] After Flink changed the table name when using hive metastore, the modified table could not be found.

Posted by "zhuangchong (via GitHub)" <gi...@apache.org>.
zhuangchong commented on code in PR #1833:
URL: https://github.com/apache/incubator-paimon/pull/1833#discussion_r1296869000


##########
paimon-hive/paimon-hive-catalog/src/main/java/org/apache/paimon/hive/HiveCatalog.java:
##########
@@ -358,9 +358,28 @@ public void renameTable(Identifier fromTable, Identifier toTable, boolean ignore
 
         try {
             checkIdentifierUpperCase(toTable);
+
+            // Rename the file system's table directory. Maintain consistency between tables in the
+            // file system and tables in the Hive Metastore.
+            Path fromPath = getDataTableLocation(fromTable);
+            Path toPath = getDataTableLocation(toTable);
+            try {
+                fileIO.rename(fromPath, toPath);

Review Comment:
   The version of hive used by the user is 3.1.3. After the rename operation, the location of the new table has not changed, and it points to the original path.
   
   <img width="773" alt="465A537E-183E-4543-8F47-061B0E581173" src="https://github.com/apache/incubator-paimon/assets/37063904/bdbdd8c1-d651-43ec-bc33-c44cbe44e212">
   
   <img width="357" alt="B79371E6-AAB0-4fbb-8AD6-555E8818C8C3" src="https://github.com/apache/incubator-paimon/assets/37063904/99e6c2a9-fdac-458c-b337-656c36f724b6">
   



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


[GitHub] [incubator-paimon] JingsongLi commented on a diff in pull request #1833: [hive] After Flink changed the table name when using hive metastore, the modified table could not be found.

Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi commented on code in PR #1833:
URL: https://github.com/apache/incubator-paimon/pull/1833#discussion_r1296813960


##########
paimon-hive/paimon-hive-catalog/src/main/java/org/apache/paimon/hive/HiveCatalog.java:
##########
@@ -358,9 +358,28 @@ public void renameTable(Identifier fromTable, Identifier toTable, boolean ignore
 
         try {
             checkIdentifierUpperCase(toTable);
+
+            // Rename the file system's table directory. Maintain consistency between tables in the
+            // file system and tables in the Hive Metastore.
+            Path fromPath = getDataTableLocation(fromTable);
+            Path toPath = getDataTableLocation(toTable);
+            try {
+                fileIO.rename(fromPath, toPath);

Review Comment:
   https://github.com/apache/incubator-paimon/pull/471
   See original PR. 



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


[GitHub] [incubator-paimon] zhangjun0x01 commented on pull request #1833: [hive] After Flink changed the table name when using hive metastore, the modified table could not be found.

Posted by "zhangjun0x01 (via GitHub)" <gi...@apache.org>.
zhangjun0x01 commented on PR #1833:
URL: https://github.com/apache/incubator-paimon/pull/1833#issuecomment-1683341926

   > Thanks @zhangjun0x01 @JingsongLi
   > 
   > I suggest that at the code layer, first execute the hive client alert_table method to rename, then check fromPath, if it exists, call fileIO rename, and update hive location. What do you think? @JingsongLi @zhangjun0x01
   
   I think it is ok, add a check to ensure that the location is correctly renamed


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


[GitHub] [incubator-paimon] JingsongLi commented on a diff in pull request #1833: [hive] After Flink changed the table name when using hive metastore, the modified table could not be found.

Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi commented on code in PR #1833:
URL: https://github.com/apache/incubator-paimon/pull/1833#discussion_r1297172146


##########
paimon-hive/paimon-hive-catalog/src/main/java/org/apache/paimon/hive/HiveCatalog.java:
##########
@@ -358,9 +358,28 @@ public void renameTable(Identifier fromTable, Identifier toTable, boolean ignore
 
         try {
             checkIdentifierUpperCase(toTable);
+
+            // Rename the file system's table directory. Maintain consistency between tables in the
+            // file system and tables in the Hive Metastore.
+            Path fromPath = getDataTableLocation(fromTable);
+            Path toPath = getDataTableLocation(toTable);
+            try {
+                fileIO.rename(fromPath, toPath);

Review Comment:
   You can see discussion in https://github.com/apache/incubator-paimon/pull/471 .
   Some Hive version maybe rename the directory to new. So we can add this check first. 
   Or can you confirm all Hive versions do not rename the directory?



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


[GitHub] [incubator-paimon] zhangjun0x01 commented on pull request #1833: [hive] After Flink changed the table name when using hive metastore, the modified table could not be found.

Posted by "zhangjun0x01 (via GitHub)" <gi...@apache.org>.
zhangjun0x01 commented on PR #1833:
URL: https://github.com/apache/incubator-paimon/pull/1833#issuecomment-1682330055

   I test again in hive3.1.3, it is correct. that is very strange
   
   ```
   Flink SQL> CREATE CATALOG paimon_hive_catalog WITH (
   >     'type' = 'paimon',
   >     'metastore' = 'hive',
   >     'uri' = 'thrift://localhost:9083',
   >     'warehouse' = 'hdfs://localhost/user/hive/warehouse'
   > );
   > 
   [INFO] Execute statement succeed.
   
   Flink SQL> use catalog paimon_hive_catalog;
   [INFO] Execute statement succeed.
   
   
   Flink SQL> create database db6;
   [INFO] Execute statement succeed.
   
   Flink SQL> use db6;
   [INFO] Execute statement succeed.
   
   Flink SQL> create table t1(id int);
   [INFO] Execute statement succeed.
   
   Flink SQL> show tables;
   +------------+
   | table name |
   +------------+
   |         t1 |
   +------------+
   1 row in set
   
   Flink SQL> alter table t1 rename to t2;
   [INFO] Execute statement succeed.
   
   Flink SQL> show tables;
   +------------+
   | table name |
   +------------+
   |         t2 |
   +------------+
   1 row in set
   
   Flink SQL> show create table t2;
   +------------------------------------------------------------------------------------------------------------------------------------+
   |                                                                                                                             result |
   +------------------------------------------------------------------------------------------------------------------------------------+
   | CREATE TABLE `paimon_hive_catalog`.`db6`.`t2` (
     `id` INT
   ) WITH (
     'path' = 'hdfs://localhost/user/hive/warehouse/db6.db/t2'
   )
    |
   +------------------------------------------------------------------------------------------------------------------------------------+
   1 row in set
   
   ```


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


[GitHub] [incubator-paimon] JingsongLi merged pull request #1833: [hive] After Flink changed the table name when using hive metastore, the modified table could not be found.

Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi merged PR #1833:
URL: https://github.com/apache/incubator-paimon/pull/1833


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


[GitHub] [incubator-paimon] zhangjun0x01 commented on pull request #1833: [hive] After Flink changed the table name when using hive metastore, the modified table could not be found.

Posted by "zhangjun0x01 (via GitHub)" <gi...@apache.org>.
zhangjun0x01 commented on PR #1833:
URL: https://github.com/apache/incubator-paimon/pull/1833#issuecomment-1682353837

   We need to confirm if the user is using object storage. I remember this situation occurred once when I was using s3.
   
   In addition, I think we may need more user environment information to troubleshoot the 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.

To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-paimon] zhuangchong commented on a diff in pull request #1833: [hive] After Flink changed the table name when using hive metastore, the modified table could not be found.

Posted by "zhuangchong (via GitHub)" <gi...@apache.org>.
zhuangchong commented on code in PR #1833:
URL: https://github.com/apache/incubator-paimon/pull/1833#discussion_r1296783368


##########
paimon-hive/paimon-hive-catalog/src/main/java/org/apache/paimon/hive/HiveCatalog.java:
##########
@@ -358,9 +358,28 @@ public void renameTable(Identifier fromTable, Identifier toTable, boolean ignore
 
         try {
             checkIdentifierUpperCase(toTable);
+
+            // Rename the file system's table directory. Maintain consistency between tables in the
+            // file system and tables in the Hive Metastore.
+            Path fromPath = getDataTableLocation(fromTable);
+            Path toPath = getDataTableLocation(toTable);
+            try {
+                fileIO.rename(fromPath, toPath);

Review Comment:
   When hive renames a table, it only modifies the metadata and does not modify the value of the location url. Is it necessary to check fromPath and toPath here?
   
   



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


[GitHub] [incubator-paimon] JingsongLi commented on a diff in pull request #1833: [hive] After Flink changed the table name when using hive metastore, the modified table could not be found.

Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi commented on code in PR #1833:
URL: https://github.com/apache/incubator-paimon/pull/1833#discussion_r1297175939


##########
paimon-hive/paimon-hive-catalog/src/main/java/org/apache/paimon/hive/HiveCatalog.java:
##########
@@ -358,9 +358,28 @@ public void renameTable(Identifier fromTable, Identifier toTable, boolean ignore
 
         try {
             checkIdentifierUpperCase(toTable);
+
+            // Rename the file system's table directory. Maintain consistency between tables in the
+            // file system and tables in the Hive Metastore.
+            Path fromPath = getDataTableLocation(fromTable);
+            Path toPath = getDataTableLocation(toTable);
+            try {
+                fileIO.rename(fromPath, toPath);

Review Comment:
   The birth of bugs is because the codes did not perform a minimum protection action, which I suggested in PR.



##########
paimon-hive/paimon-hive-catalog/src/main/java/org/apache/paimon/hive/HiveCatalog.java:
##########
@@ -358,9 +358,28 @@ public void renameTable(Identifier fromTable, Identifier toTable, boolean ignore
 
         try {
             checkIdentifierUpperCase(toTable);
+
+            // Rename the file system's table directory. Maintain consistency between tables in the
+            // file system and tables in the Hive Metastore.
+            Path fromPath = getDataTableLocation(fromTable);
+            Path toPath = getDataTableLocation(toTable);
+            try {
+                fileIO.rename(fromPath, toPath);

Review Comment:
   The birth of this bug is because the codes did not perform a minimum protection action, which I suggested in PR.



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


[GitHub] [incubator-paimon] JingsongLi commented on a diff in pull request #1833: [hive] After Flink changed the table name when using hive metastore, the modified table could not be found.

Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi commented on code in PR #1833:
URL: https://github.com/apache/incubator-paimon/pull/1833#discussion_r1297172953


##########
paimon-hive/paimon-hive-catalog/src/main/java/org/apache/paimon/hive/HiveCatalog.java:
##########
@@ -358,9 +358,28 @@ public void renameTable(Identifier fromTable, Identifier toTable, boolean ignore
 
         try {
             checkIdentifierUpperCase(toTable);
+
+            // Rename the file system's table directory. Maintain consistency between tables in the
+            // file system and tables in the Hive Metastore.
+            Path fromPath = getDataTableLocation(fromTable);
+            Path toPath = getDataTableLocation(toTable);
+            try {
+                fileIO.rename(fromPath, toPath);

Review Comment:
   We are fixing this bug, so I know there is the problem.



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


[GitHub] [incubator-paimon] zhangjun0x01 commented on pull request #1833: [hive] After Flink changed the table name when using hive metastore, the modified table could not be found.

Posted by "zhangjun0x01 (via GitHub)" <gi...@apache.org>.
zhangjun0x01 commented on PR #1833:
URL: https://github.com/apache/incubator-paimon/pull/1833#issuecomment-1683222704

   I test in s3  with hive catalog  , the table could no be found after rename table 
   
   ```
   
   Flink SQL> show create table t1;
   +----------------------------------------------------------------------------------------------------------------------------------------------------------------+
   |                                                                                                                                                         result |
   +----------------------------------------------------------------------------------------------------------------------------------------------------------------+
   | CREATE TABLE `paimon_hive_catalog_dev`.`paimon_zhangjun`.`t1` (
     `id` INT
   ) COMMENT 'aa'
   WITH (
     'path' = 's3://xxxxx/paimon/paimon_zhangjun.db/t1'
   )
    |
   +----------------------------------------------------------------------------------------------------------------------------------------------------------------+
   1 row in set
   
   Flink SQL> show tables;
   +------------+
   | table name |
   +------------+
   |         t1 |
   +------------+
   1 row in set
   
   Flink SQL> alter table t1 rename to t2;
   [INFO] Execute statement succeed.
   
   Flink SQL> show tables;
   Empty set
   
   Flink SQL> 
   
   
   ```


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


[GitHub] [incubator-paimon] JingsongLi commented on a diff in pull request #1833: [hive] After Flink changed the table name when using hive metastore, the modified table could not be found.

Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi commented on code in PR #1833:
URL: https://github.com/apache/incubator-paimon/pull/1833#discussion_r1296684139


##########
paimon-hive/paimon-hive-catalog/src/main/java/org/apache/paimon/hive/HiveCatalog.java:
##########
@@ -358,9 +358,28 @@ public void renameTable(Identifier fromTable, Identifier toTable, boolean ignore
 
         try {
             checkIdentifierUpperCase(toTable);
+
+            // Rename the file system's table directory. Maintain consistency between tables in the
+            // file system and tables in the Hive Metastore.
+            Path fromPath = getDataTableLocation(fromTable);
+            Path toPath = getDataTableLocation(toTable);
+            try {
+                fileIO.rename(fromPath, toPath);

Review Comment:
   Maybe check `fromPath` existence first? Maybe hive will do this renaming before.



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