[ https://issues.apache.org/jira/browse/HIVE-26716?focusedWorklogId=828887&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-828887 ]
ASF GitHub Bot logged work on HIVE-26716: ----------------------------------------- Author: ASF GitHub Bot Created on: 25/Nov/22 10:42 Start Date: 25/Nov/22 10:42 Worklog Time Spent: 10m Work Description: deniskuzZ commented on code in PR #3746: URL: https://github.com/apache/hive/pull/3746#discussion_r1032268630 ########## ql/src/java/org/apache/hadoop/hive/ql/txn/compactor/CompactionQueryBuilder.java: ########## @@ -287,16 +302,27 @@ private void buildAddClauseForAlter(StringBuilder query) { private void buildSelectClauseForInsert(StringBuilder query) { // Need list of columns for major crud, mmmajor partitioned, mmminor List<FieldSchema> cols; - if (major && crud || major && insertOnly && sourcePartition != null || minor && insertOnly) { + if (rebalance || major && crud || major && insertOnly && sourcePartition != null || minor && insertOnly) { if (sourceTab == null) { return; // avoid NPEs, don't throw an exception but skip this part of the query } cols = sourceTab.getSd().getCols(); } else { cols = null; } - - if (crud) { + if (rebalance) { + query.append("0, t2.writeId, t2.rowId / CEIL(numRows / "); + query.append(numberOfBuckets); + query.append("), t2.rowId, t2.writeId, t2.data from (select "); + query.append("count(ROW__ID.writeId) over() as numRows, ROW__ID.writeId as writeId, " + + "(row_number() OVER (order by ROW__ID.writeId ASC, ROW__ID.bucketId ASC, ROW__ID.rowId ASC)) -1 AS rowId, " + + "NAMED_STRUCT("); + for (int i = 0; i < cols.size(); ++i) { Review Comment: should we check for null? Issue Time Tracking ------------------- Worklog Id: (was: 828887) Time Spent: 7h (was: 6h 50m) > Query based Rebalance compaction on full acid tables > ---------------------------------------------------- > > Key: HIVE-26716 > URL: https://issues.apache.org/jira/browse/HIVE-26716 > Project: Hive > Issue Type: Sub-task > Components: Hive > Reporter: László Végh > Assignee: László Végh > Priority: Major > Labels: ACID, compaction, pull-request-available > Time Spent: 7h > Remaining Estimate: 0h > > Support rebalancing compaction on fully ACID tables. -- This message was sent by Atlassian Jira (v8.20.10#820010)