You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@hive.apache.org by GitBox <gi...@apache.org> on 2022/11/14 12:33:06 UTC
[GitHub] [hive] veghlaci05 commented on a diff in pull request #3746: HIVE-26716: Query based Rebalance compaction on full acid tables
veghlaci05 commented on code in PR #3746:
URL: https://github.com/apache/hive/pull/3746#discussion_r1021470141
##########
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 % ");
+ query.append(numberOfBuckets);
Review Comment:
Yes, in order to equally distribute the records among the buckets, the numberOfBuckets % row_number is used.
##########
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 % ");
Review Comment:
The first value id the 'operation'. In other compactions it is set by the validate_acid_sort_order UDF, but in the rebalancing case that function would be a more difficult to use.
--
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