You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@hive.apache.org by "difin (via GitHub)" <gi...@apache.org> on 2024/02/07 19:06:46 UTC

[PR] HIVE-27850: Addendum: Add DB name in Iceberg Major compaction query t… [hive]

difin opened a new pull request, #5074:
URL: https://github.com/apache/hive/pull/5074

   …o fix compaction issue in Cloud env.
   
   <!--
   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.
   
   -->
   
   ### What changes were proposed in this pull request?
   <!--
   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.
   -->
   Add DB name into the query for Iceberg Major QB compaction.
   
   ### Why are the changes needed?
   <!--
   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.
   -->
   The existing code works fine in q-tests and in Hive-Docker on a local dev env, but the Iceberg Compaction fails in a cloud env because the compaction query is missing DB name. In Hive ACID QB compaction, DB name is part of the query and it was missed to add in Hive Iceberg compaction code.
   
   ### Does this PR introduce _any_ user-facing change?
   <!--
   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'.
   -->
   No
   
   ### Is the change a dependency upgrade?
   <!--
   If yes, please attach a file with output from mvn dependency:tree to validate a complete upgrade of dependency.
   If no, write 'No'.
   -->
   No
   
   ### How was this patch tested?
   <!--
   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.
   -->
   I did remote debugging in the cloud env where the Hive Iceberg compaction was failing. I modified the compaction query manually in the debugger by adding the DB name and compaction passed.
   


-- 
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: gitbox-unsubscribe@hive.apache.org

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


Re: [PR] HIVE-27850: Addendum: Add DB name in Iceberg Major compaction query t… [hive]

Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #5074:
URL: https://github.com/apache/hive/pull/5074#issuecomment-1932829178

   ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=5074) **Quality Gate passed**  
   Kudos, no new issues were introduced!
   
   [0 New issues](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=5074&resolved=false&inNewCodePeriod=true)  
   [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=5074&resolved=false&inNewCodePeriod=true)  
   No data about Coverage  
   No data about Duplication  
     
   [See analysis details on SonarCloud](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=5074)
   
   


-- 
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: gitbox-unsubscribe@hive.apache.org

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


Re: [PR] HIVE-27850: Addendum: Add DB name in Iceberg Major compaction query t… [hive]

Posted by "difin (via GitHub)" <gi...@apache.org>.
difin commented on code in PR #5074:
URL: https://github.com/apache/hive/pull/5074#discussion_r1483354877


##########
iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/compaction/IcebergMajorQueryCompactor.java:
##########
@@ -39,12 +39,13 @@ public class IcebergMajorQueryCompactor extends QueryCompactor  {
   @Override
   public boolean run(CompactorContext context) throws IOException, HiveException, InterruptedException {
 
+    String compactDbName = context.getTable().getDbName();

Review Comment:
   Thanks for suggestion, done.



-- 
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: gitbox-unsubscribe@hive.apache.org

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


Re: [PR] HIVE-27850: Addendum: Add DB name in Iceberg Major compaction query t… [hive]

Posted by "deniskuzZ (via GitHub)" <gi...@apache.org>.
deniskuzZ commented on code in PR #5074:
URL: https://github.com/apache/hive/pull/5074#discussion_r1482715727


##########
iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/compaction/IcebergMajorQueryCompactor.java:
##########
@@ -39,12 +39,13 @@ public class IcebergMajorQueryCompactor extends QueryCompactor  {
   @Override
   public boolean run(CompactorContext context) throws IOException, HiveException, InterruptedException {
 
+    String compactDbName = context.getTable().getDbName();
     String compactTableName = context.getTable().getTableName();
     Map<String, String> tblProperties = context.getTable().getParameters();
     LOG.debug("Initiating compaction for the {} table", compactTableName);
 
-    String compactionQuery = String.format("insert overwrite table %s select * from %s",
-        compactTableName, compactTableName);
+    String compactionQuery = String.format("insert overwrite table %s.%s select * from %s.%s",

Review Comment:
   you refactor to
   ````
   String.format("insert overwrite table %1$s.%2$s select * from %1$s.%2$s", compactDbName, compactTableName)
   ````
   



##########
iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/compaction/IcebergMajorQueryCompactor.java:
##########
@@ -39,12 +39,13 @@ public class IcebergMajorQueryCompactor extends QueryCompactor  {
   @Override
   public boolean run(CompactorContext context) throws IOException, HiveException, InterruptedException {
 
+    String compactDbName = context.getTable().getDbName();
     String compactTableName = context.getTable().getTableName();
     Map<String, String> tblProperties = context.getTable().getParameters();
     LOG.debug("Initiating compaction for the {} table", compactTableName);

Review Comment:
   add dbname here as well



-- 
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: gitbox-unsubscribe@hive.apache.org

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


Re: [PR] HIVE-27850: Addendum: Add DB name in Iceberg Major compaction query t… [hive]

Posted by "deniskuzZ (via GitHub)" <gi...@apache.org>.
deniskuzZ commented on code in PR #5074:
URL: https://github.com/apache/hive/pull/5074#discussion_r1482726754


##########
iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/compaction/IcebergMajorQueryCompactor.java:
##########
@@ -39,12 +39,13 @@ public class IcebergMajorQueryCompactor extends QueryCompactor  {
   @Override
   public boolean run(CompactorContext context) throws IOException, HiveException, InterruptedException {
 
+    String compactDbName = context.getTable().getDbName();

Review Comment:
   ````
   String compactTableName = TableName.getDbTable(context.getTable().getDbName(), context.getTable().getTableName())
   ````



##########
iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/compaction/IcebergMajorQueryCompactor.java:
##########
@@ -39,12 +39,13 @@ public class IcebergMajorQueryCompactor extends QueryCompactor  {
   @Override
   public boolean run(CompactorContext context) throws IOException, HiveException, InterruptedException {
 
+    String compactDbName = context.getTable().getDbName();
     String compactTableName = context.getTable().getTableName();
     Map<String, String> tblProperties = context.getTable().getParameters();
     LOG.debug("Initiating compaction for the {} table", compactTableName);
 
-    String compactionQuery = String.format("insert overwrite table %s select * from %s",
-        compactTableName, compactTableName);
+    String compactionQuery = String.format("insert overwrite table %s.%s select * from %s.%s",

Review Comment:
   you could refactor to
   ````
   String.format("insert overwrite table %s select * from %<s", compactTableName)
   ````
   



-- 
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: gitbox-unsubscribe@hive.apache.org

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


Re: [PR] HIVE-27850: Addendum: Add DB name in Iceberg Major compaction query t… [hive]

Posted by "deniskuzZ (via GitHub)" <gi...@apache.org>.
deniskuzZ merged PR #5074:
URL: https://github.com/apache/hive/pull/5074


-- 
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: gitbox-unsubscribe@hive.apache.org

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


Re: [PR] HIVE-27850: Addendum: Add DB name in Iceberg Major compaction query t… [hive]

Posted by "deniskuzZ (via GitHub)" <gi...@apache.org>.
deniskuzZ commented on code in PR #5074:
URL: https://github.com/apache/hive/pull/5074#discussion_r1482726754


##########
iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/compaction/IcebergMajorQueryCompactor.java:
##########
@@ -39,12 +39,13 @@ public class IcebergMajorQueryCompactor extends QueryCompactor  {
   @Override
   public boolean run(CompactorContext context) throws IOException, HiveException, InterruptedException {
 
+    String compactDbName = context.getTable().getDbName();

Review Comment:
   String tableName = TableName.getDbTable(context.getTable().getDbName(), context.getTable().getTableName())



##########
iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/compaction/IcebergMajorQueryCompactor.java:
##########
@@ -39,12 +39,13 @@ public class IcebergMajorQueryCompactor extends QueryCompactor  {
   @Override
   public boolean run(CompactorContext context) throws IOException, HiveException, InterruptedException {
 
+    String compactDbName = context.getTable().getDbName();

Review Comment:
   ````
   String tableName = TableName.getDbTable(context.getTable().getDbName(), context.getTable().getTableName())
   ````



-- 
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: gitbox-unsubscribe@hive.apache.org

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


Re: [PR] HIVE-27850: Addendum: Add DB name in Iceberg Major compaction query t… [hive]

Posted by "deniskuzZ (via GitHub)" <gi...@apache.org>.
deniskuzZ commented on code in PR #5074:
URL: https://github.com/apache/hive/pull/5074#discussion_r1482715727


##########
iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/compaction/IcebergMajorQueryCompactor.java:
##########
@@ -39,12 +39,13 @@ public class IcebergMajorQueryCompactor extends QueryCompactor  {
   @Override
   public boolean run(CompactorContext context) throws IOException, HiveException, InterruptedException {
 
+    String compactDbName = context.getTable().getDbName();
     String compactTableName = context.getTable().getTableName();
     Map<String, String> tblProperties = context.getTable().getParameters();
     LOG.debug("Initiating compaction for the {} table", compactTableName);
 
-    String compactionQuery = String.format("insert overwrite table %s select * from %s",
-        compactTableName, compactTableName);
+    String compactionQuery = String.format("insert overwrite table %s.%s select * from %s.%s",

Review Comment:
   you could refactor to
   ````
   String compactionQuery ="insert overwrite table %s select * from %s".replace("%s", tableName)
   ````
   



-- 
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: gitbox-unsubscribe@hive.apache.org

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


Re: [PR] HIVE-27850: Addendum: Add DB name in Iceberg Major compaction query t… [hive]

Posted by "deniskuzZ (via GitHub)" <gi...@apache.org>.
deniskuzZ commented on code in PR #5074:
URL: https://github.com/apache/hive/pull/5074#discussion_r1482715727


##########
iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/compaction/IcebergMajorQueryCompactor.java:
##########
@@ -39,12 +39,13 @@ public class IcebergMajorQueryCompactor extends QueryCompactor  {
   @Override
   public boolean run(CompactorContext context) throws IOException, HiveException, InterruptedException {
 
+    String compactDbName = context.getTable().getDbName();
     String compactTableName = context.getTable().getTableName();
     Map<String, String> tblProperties = context.getTable().getParameters();
     LOG.debug("Initiating compaction for the {} table", compactTableName);
 
-    String compactionQuery = String.format("insert overwrite table %s select * from %s",
-        compactTableName, compactTableName);
+    String compactionQuery = String.format("insert overwrite table %s.%s select * from %s.%s",

Review Comment:
   you could refactor to
   ````
   String.format("insert overwrite table %s select * from %<s", tableName)
   ````
   



-- 
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: gitbox-unsubscribe@hive.apache.org

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


Re: [PR] HIVE-27850: Addendum: Add DB name in Iceberg Major compaction query t… [hive]

Posted by "difin (via GitHub)" <gi...@apache.org>.
difin commented on code in PR #5074:
URL: https://github.com/apache/hive/pull/5074#discussion_r1483356719


##########
iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/compaction/IcebergMajorQueryCompactor.java:
##########
@@ -39,12 +39,13 @@ public class IcebergMajorQueryCompactor extends QueryCompactor  {
   @Override
   public boolean run(CompactorContext context) throws IOException, HiveException, InterruptedException {
 
+    String compactDbName = context.getTable().getDbName();
     String compactTableName = context.getTable().getTableName();
     Map<String, String> tblProperties = context.getTable().getParameters();
     LOG.debug("Initiating compaction for the {} table", compactTableName);
 
-    String compactionQuery = String.format("insert overwrite table %s select * from %s",
-        compactTableName, compactTableName);
+    String compactionQuery = String.format("insert overwrite table %s.%s select * from %s.%s",

Review Comment:
   Thanks, done.



-- 
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: gitbox-unsubscribe@hive.apache.org

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


Re: [PR] HIVE-27850: Addendum: Add DB name in Iceberg Major compaction query t… [hive]

Posted by "deniskuzZ (via GitHub)" <gi...@apache.org>.
deniskuzZ commented on code in PR #5074:
URL: https://github.com/apache/hive/pull/5074#discussion_r1482715727


##########
iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/compaction/IcebergMajorQueryCompactor.java:
##########
@@ -39,12 +39,13 @@ public class IcebergMajorQueryCompactor extends QueryCompactor  {
   @Override
   public boolean run(CompactorContext context) throws IOException, HiveException, InterruptedException {
 
+    String compactDbName = context.getTable().getDbName();
     String compactTableName = context.getTable().getTableName();
     Map<String, String> tblProperties = context.getTable().getParameters();
     LOG.debug("Initiating compaction for the {} table", compactTableName);
 
-    String compactionQuery = String.format("insert overwrite table %s select * from %s",
-        compactTableName, compactTableName);
+    String compactionQuery = String.format("insert overwrite table %s.%s select * from %s.%s",

Review Comment:
   you refactor to
   ````
   String.format("insert overwrite table %s select * from %<s", tableName)
   ````
   



-- 
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: gitbox-unsubscribe@hive.apache.org

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


Re: [PR] HIVE-27850: Addendum: Add DB name in Iceberg Major compaction query t… [hive]

Posted by "deniskuzZ (via GitHub)" <gi...@apache.org>.
deniskuzZ commented on code in PR #5074:
URL: https://github.com/apache/hive/pull/5074#discussion_r1482716011


##########
iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/compaction/IcebergMajorQueryCompactor.java:
##########
@@ -39,12 +39,13 @@ public class IcebergMajorQueryCompactor extends QueryCompactor  {
   @Override
   public boolean run(CompactorContext context) throws IOException, HiveException, InterruptedException {
 
+    String compactDbName = context.getTable().getDbName();
     String compactTableName = context.getTable().getTableName();
     Map<String, String> tblProperties = context.getTable().getParameters();
     LOG.debug("Initiating compaction for the {} table", compactTableName);

Review Comment:
   add dbname here as well



-- 
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: gitbox-unsubscribe@hive.apache.org

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


Re: [PR] HIVE-27850: Addendum: Add DB name in Iceberg Major compaction query t… [hive]

Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #5074:
URL: https://github.com/apache/hive/pull/5074#issuecomment-1934811979

   ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=5074) **Quality Gate passed**  
   Issues  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 New issues](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=5074&resolved=false&inNewCodePeriod=true)
   
   Measures  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=5074&resolved=false&inNewCodePeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/no-data-16px.png '') No data about Coverage  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/no-data-16px.png '') No data about Duplication  
     
   [See analysis details on SonarCloud](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=5074)
   
   


-- 
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: gitbox-unsubscribe@hive.apache.org

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