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 2021/05/12 12:39:23 UTC
[GitHub] [hive] kasakrisz opened a new pull request #2264: [draft] HIVE-24991: Enable fetching deleted rows in vectorized mode
kasakrisz opened a new pull request #2264:
URL: https://github.com/apache/hive/pull/2264
<!--
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.
-->
### 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.
-->
### 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'.
-->
### 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.
-->
--
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.
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
[GitHub] [hive] kasakrisz commented on a change in pull request #2264: HIVE-24991: Enable fetching deleted rows in vectorized mode
Posted by GitBox <gi...@apache.org>.
kasakrisz commented on a change in pull request #2264:
URL: https://github.com/apache/hive/pull/2264#discussion_r647582032
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/io/orc/VectorizedOrcAcidRowBatchReader.java
##########
@@ -1940,39 +2091,38 @@ public boolean isEmpty() {
}
@Override
public void findDeletedRecords(ColumnVector[] cols, int size, BitSet selectedBitSet) {
- if (rowIds == null || compressedOwids == null) {
+ if (rowIds == null || writeIds == null || writeIds.isEmpty()) {
return;
}
// Iterate through the batch and for each (owid, rowid) in the batch
// check if it is deleted or not.
long[] originalWriteIdVector =
- cols[OrcRecordUpdater.ORIGINAL_WRITEID].isRepeating ? null
- : ((LongColumnVector) cols[OrcRecordUpdater.ORIGINAL_WRITEID]).vector;
+ cols[OrcRecordUpdater.ORIGINAL_WRITEID].isRepeating ? null
Review comment:
reverted
##########
File path: ql/src/test/org/apache/hadoop/hive/ql/io/orc/TestVectorizedOrcAcidRowBatchReader.java
##########
@@ -961,26 +966,41 @@ private void testDeleteEventOriginalFiltering2() throws Exception {
@Test
public void testVectorizedOrcAcidRowBatchReader() throws Exception {
+ setupTestData();
+
+ testVectorizedOrcAcidRowBatchReader(ColumnizedDeleteEventRegistry.class.getName());
+
+ // To test the SortMergedDeleteEventRegistry, we need to explicitly set the
+ // HIVE_TRANSACTIONAL_NUM_EVENTS_IN_MEMORY constant to a smaller value.
+ int oldValue = conf.getInt(HiveConf.ConfVars.HIVE_TRANSACTIONAL_NUM_EVENTS_IN_MEMORY.varname, 1000000);
+ conf.setInt(HiveConf.ConfVars.HIVE_TRANSACTIONAL_NUM_EVENTS_IN_MEMORY.varname, 1000);
+ testVectorizedOrcAcidRowBatchReader(SortMergedDeleteEventRegistry.class.getName());
+
+ // Restore the old value.
+ conf.setInt(HiveConf.ConfVars.HIVE_TRANSACTIONAL_NUM_EVENTS_IN_MEMORY.varname, oldValue);
+ }
+
+ private void setupTestData() throws IOException {
conf.set("bucket_count", "1");
- conf.set(ValidTxnList.VALID_TXNS_KEY,
- new ValidReadTxnList(new long[0], new BitSet(), 1000, Long.MAX_VALUE).writeToString());
+ conf.set(ValidTxnList.VALID_TXNS_KEY,
+ new ValidReadTxnList(new long[0], new BitSet(), 1000, Long.MAX_VALUE).writeToString());
int bucket = 0;
AcidOutputFormat.Options options = new AcidOutputFormat.Options(conf)
- .filesystem(fs)
- .bucket(bucket)
- .writingBase(false)
- .minimumWriteId(1)
- .maximumWriteId(NUM_OWID)
- .inspector(inspector)
- .reporter(Reporter.NULL)
- .recordIdColumn(1)
- .finalDestination(root);
+ .filesystem(fs)
Review comment:
reverted
--
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.
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
[GitHub] [hive] pgaref commented on a change in pull request #2264: HIVE-24991: Enable fetching deleted rows in vectorized mode
Posted by GitBox <gi...@apache.org>.
pgaref commented on a change in pull request #2264:
URL: https://github.com/apache/hive/pull/2264#discussion_r646592844
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/io/orc/VectorizedOrcAcidRowBatchReader.java
##########
@@ -983,7 +1027,7 @@ private void copyFromBase(VectorizedRowBatch value) {
System.arraycopy(payloadStruct.fields, 0, value.cols, 0, value.getDataColumnCount());
}
if (rowIdProjected) {
- recordIdColumnVector.fields[0] = vectorizedRowBatchBase.cols[OrcRecordUpdater.ORIGINAL_WRITEID];
+ recordIdColumnVector.fields[0] = vectorizedRowBatchBase.cols[fetchDeletedRows ? OrcRecordUpdater.CURRENT_WRITEID : OrcRecordUpdater.ORIGINAL_WRITEID];
Review comment:
would love a comment about the different WRITEID 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.
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
[GitHub] [hive] pgaref commented on a change in pull request #2264: HIVE-24991: Enable fetching deleted rows in vectorized mode
Posted by GitBox <gi...@apache.org>.
pgaref commented on a change in pull request #2264:
URL: https://github.com/apache/hive/pull/2264#discussion_r646590439
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/io/orc/VectorizedOrcAcidRowBatchReader.java
##########
@@ -959,6 +989,20 @@ public boolean next(NullWritable key, VectorizedRowBatch value) throws IOExcepti
int ix = rbCtx.findVirtualColumnNum(VirtualColumn.ROWID);
Review comment:
we could probably do the same optimization 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.
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
[GitHub] [hive] pgaref commented on a change in pull request #2264: HIVE-24991: Enable fetching deleted rows in vectorized mode
Posted by GitBox <gi...@apache.org>.
pgaref commented on a change in pull request #2264:
URL: https://github.com/apache/hive/pull/2264#discussion_r646558742
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/io/orc/VectorizedOrcAcidRowBatchReader.java
##########
@@ -932,8 +960,10 @@ public boolean next(NullWritable key, VectorizedRowBatch value) throws IOExcepti
}
// Case 2- find rows which have been deleted.
+ BitSet notDeletedBitSet = fetchDeletedRows ? (BitSet) selectedBitSet.clone() : selectedBitSet;
Review comment:
lets add a comment above saying when/why we clone the BitSet
--
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.
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
[GitHub] [hive] pgaref commented on a change in pull request #2264: HIVE-24991: Enable fetching deleted rows in vectorized mode
Posted by GitBox <gi...@apache.org>.
pgaref commented on a change in pull request #2264:
URL: https://github.com/apache/hive/pull/2264#discussion_r646592084
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/io/orc/VectorizedOrcAcidRowBatchReader.java
##########
@@ -959,6 +989,20 @@ public boolean next(NullWritable key, VectorizedRowBatch value) throws IOExcepti
int ix = rbCtx.findVirtualColumnNum(VirtualColumn.ROWID);
value.cols[ix] = recordIdColumnVector;
}
+ if (rowIsDeletedProjected) {
+ if (fetchDeletedRows) {
Review comment:
if (!fetchDeletedRows || notDeletedBitSet.cardinality() == vectorizedRowBatchBase.size )
--
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.
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
[GitHub] [hive] pgaref commented on a change in pull request #2264: HIVE-24991: Enable fetching deleted rows in vectorized mode
Posted by GitBox <gi...@apache.org>.
pgaref commented on a change in pull request #2264:
URL: https://github.com/apache/hive/pull/2264#discussion_r646538850
##########
File path: ql/src/test/org/apache/hadoop/hive/ql/io/orc/TestVectorizedOrcAcidRowBatchReader.java
##########
@@ -961,26 +966,41 @@ private void testDeleteEventOriginalFiltering2() throws Exception {
@Test
public void testVectorizedOrcAcidRowBatchReader() throws Exception {
+ setupTestData();
+
+ testVectorizedOrcAcidRowBatchReader(ColumnizedDeleteEventRegistry.class.getName());
+
+ // To test the SortMergedDeleteEventRegistry, we need to explicitly set the
+ // HIVE_TRANSACTIONAL_NUM_EVENTS_IN_MEMORY constant to a smaller value.
+ int oldValue = conf.getInt(HiveConf.ConfVars.HIVE_TRANSACTIONAL_NUM_EVENTS_IN_MEMORY.varname, 1000000);
+ conf.setInt(HiveConf.ConfVars.HIVE_TRANSACTIONAL_NUM_EVENTS_IN_MEMORY.varname, 1000);
+ testVectorizedOrcAcidRowBatchReader(SortMergedDeleteEventRegistry.class.getName());
+
+ // Restore the old value.
+ conf.setInt(HiveConf.ConfVars.HIVE_TRANSACTIONAL_NUM_EVENTS_IN_MEMORY.varname, oldValue);
+ }
+
+ private void setupTestData() throws IOException {
conf.set("bucket_count", "1");
- conf.set(ValidTxnList.VALID_TXNS_KEY,
- new ValidReadTxnList(new long[0], new BitSet(), 1000, Long.MAX_VALUE).writeToString());
+ conf.set(ValidTxnList.VALID_TXNS_KEY,
+ new ValidReadTxnList(new long[0], new BitSet(), 1000, Long.MAX_VALUE).writeToString());
int bucket = 0;
AcidOutputFormat.Options options = new AcidOutputFormat.Options(conf)
- .filesystem(fs)
- .bucket(bucket)
- .writingBase(false)
- .minimumWriteId(1)
- .maximumWriteId(NUM_OWID)
- .inspector(inspector)
- .reporter(Reporter.NULL)
- .recordIdColumn(1)
- .finalDestination(root);
+ .filesystem(fs)
Review comment:
nit. revert spaces
--
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.
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
[GitHub] [hive] kasakrisz commented on a change in pull request #2264: HIVE-24991: Enable fetching deleted rows in vectorized mode
Posted by GitBox <gi...@apache.org>.
kasakrisz commented on a change in pull request #2264:
URL: https://github.com/apache/hive/pull/2264#discussion_r647562562
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/io/orc/VectorizedOrcAcidRowBatchReader.java
##########
@@ -2039,4 +2189,29 @@ private static IntegerColumnStatistics deserializeIntColumnStatistics(List<OrcPr
deserializeIntColumnStatistics(colStats, OrcRecordUpdater.ROW_ID + 1);
return getKeyInterval(columnStatsArray);
}
+
+ private static class RowIsDeletedColumnVector extends LongColumnVector {
+ void clear() {
+ Arrays.fill(vector, 0);
+ }
+
+ void setAll(boolean deleted) {
+ vector[0] = deleted ? 1 : 0;
Review comment:
Changed the implementation to call `LongColumnVector.fill`
--
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.
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
[GitHub] [hive] kasakrisz merged pull request #2264: HIVE-24991: Enable fetching deleted rows in vectorized mode
Posted by GitBox <gi...@apache.org>.
kasakrisz merged pull request #2264:
URL: https://github.com/apache/hive/pull/2264
--
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.
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
[GitHub] [hive] pgaref commented on a change in pull request #2264: HIVE-24991: Enable fetching deleted rows in vectorized mode
Posted by GitBox <gi...@apache.org>.
pgaref commented on a change in pull request #2264:
URL: https://github.com/apache/hive/pull/2264#discussion_r646601459
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/io/orc/VectorizedOrcAcidRowBatchReader.java
##########
@@ -2039,4 +2189,29 @@ private static IntegerColumnStatistics deserializeIntColumnStatistics(List<OrcPr
deserializeIntColumnStatistics(colStats, OrcRecordUpdater.ROW_ID + 1);
return getKeyInterval(columnStatsArray);
}
+
+ private static class RowIsDeletedColumnVector extends LongColumnVector {
+ void clear() {
+ Arrays.fill(vector, 0);
+ }
+
+ void setAll(boolean deleted) {
+ vector[0] = deleted ? 1 : 0;
Review comment:
seems like a duplication of LongColumnVector's fill(long value) method
--
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.
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
[GitHub] [hive] pgaref commented on a change in pull request #2264: HIVE-24991: Enable fetching deleted rows in vectorized mode
Posted by GitBox <gi...@apache.org>.
pgaref commented on a change in pull request #2264:
URL: https://github.com/apache/hive/pull/2264#discussion_r646558980
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/io/orc/VectorizedOrcAcidRowBatchReader.java
##########
@@ -948,7 +978,7 @@ public boolean next(NullWritable key, VectorizedRowBatch value) throws IOExcepti
// This loop fills up the selected[] vector with all the index positions that are selected.
for (int setBitIndex = selectedBitSet.nextSetBit(0), selectedItr = 0;
setBitIndex >= 0;
- setBitIndex = selectedBitSet.nextSetBit(setBitIndex+1), ++selectedItr) {
+ setBitIndex = selectedBitSet.nextSetBit(setBitIndex + 1), ++selectedItr) {
Review comment:
change not needed
--
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.
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
[GitHub] [hive] kasakrisz commented on a change in pull request #2264: HIVE-24991: Enable fetching deleted rows in vectorized mode
Posted by GitBox <gi...@apache.org>.
kasakrisz commented on a change in pull request #2264:
URL: https://github.com/apache/hive/pull/2264#discussion_r647558152
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/io/orc/VectorizedOrcAcidRowBatchReader.java
##########
@@ -892,13 +913,20 @@ public boolean next(NullWritable key, VectorizedRowBatch value) throws IOExcepti
} catch (Exception e) {
throw new IOException("error iterating", e);
}
- if(!includeAcidColumns) {
+ if (!includeAcidColumns) {
//if here, we don't need to filter anything wrt acid metadata columns
//in fact, they are not even read from file/llap
value.size = vectorizedRowBatchBase.size;
value.selected = vectorizedRowBatchBase.selected;
value.selectedInUse = vectorizedRowBatchBase.selectedInUse;
copyFromBase(value);
+
+ if (rowIsDeletedProjected) {
+ rowIsDeletedVector.clear();
+ int ix = rbCtx.findVirtualColumnNum(VirtualColumn.ROWISDELETED);
Review comment:
I started to work on a solution to manage Virtual Column related information but it lead to a much bigger change. `VectorizedOrcAcidRowBatchReader` can behave several ways and each of those behavior worth a separate class after extracting common parts.
So I decided to followed existing logic implemented for RowId.
--
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.
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
[GitHub] [hive] pgaref commented on a change in pull request #2264: HIVE-24991: Enable fetching deleted rows in vectorized mode
Posted by GitBox <gi...@apache.org>.
pgaref commented on a change in pull request #2264:
URL: https://github.com/apache/hive/pull/2264#discussion_r646556329
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/io/orc/VectorizedOrcAcidRowBatchReader.java
##########
@@ -303,6 +314,12 @@ private VectorizedOrcAcidRowBatchReader(JobConf conf, OrcSplit orcSplit, Reporte
VectorizedRowBatch.DEFAULT_SIZE, null, null, null);
}
rowIdProjected = areRowIdsProjected(rbCtx);
+ rowIsDeletedProjected = isVirtualColumnProjected(rbCtx, VirtualColumn.ROWISDELETED);
+ if (rowIsDeletedProjected) {
+ rowIsDeletedVector = new RowIsDeletedColumnVector();
Review comment:
Lets explicitly pass VectorizedRowBatch.DEFAULT_SIZE to make this more obvious
--
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.
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
[GitHub] [hive] kasakrisz commented on a change in pull request #2264: HIVE-24991: Enable fetching deleted rows in vectorized mode
Posted by GitBox <gi...@apache.org>.
kasakrisz commented on a change in pull request #2264:
URL: https://github.com/apache/hive/pull/2264#discussion_r647559407
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/io/orc/VectorizedOrcAcidRowBatchReader.java
##########
@@ -959,6 +989,20 @@ public boolean next(NullWritable key, VectorizedRowBatch value) throws IOExcepti
int ix = rbCtx.findVirtualColumnNum(VirtualColumn.ROWID);
Review comment:
see my previous comment for `VirtualColumn.ROWISDELETED`
--
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.
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
[GitHub] [hive] pgaref commented on a change in pull request #2264: HIVE-24991: Enable fetching deleted rows in vectorized mode
Posted by GitBox <gi...@apache.org>.
pgaref commented on a change in pull request #2264:
URL: https://github.com/apache/hive/pull/2264#discussion_r646550206
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/io/orc/VectorizedOrcAcidRowBatchReader.java
##########
@@ -281,16 +285,23 @@ private VectorizedOrcAcidRowBatchReader(JobConf conf, OrcSplit orcSplit, Reporte
deleteEventReaderOptions.range(0, Long.MAX_VALUE);
deleteEventReaderOptions.searchArgument(null, null);
keyInterval = findMinMaxKeys(orcSplit, conf, deleteEventReaderOptions);
+ fetchDeletedRows = conf.getBoolean(Constants.ACID_FETCH_DELETED_ROWS, false);
DeleteEventRegistry der;
try {
// See if we can load all the relevant delete events from all the
// delete deltas in memory...
+ ColumnizedDeleteEventRegistry.OriginalWriteIdLoader writeIdLoader;
+ if (fetchDeletedRows) {
+ writeIdLoader = new ColumnizedDeleteEventRegistry.BothWriteIdLoader();
Review comment:
Maybe rename to something more explicit like OriginalAndCurrentWriteIdLoader?
Also lets add some comment above explaining the logic
--
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.
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
[GitHub] [hive] pgaref commented on a change in pull request #2264: HIVE-24991: Enable fetching deleted rows in vectorized mode
Posted by GitBox <gi...@apache.org>.
pgaref commented on a change in pull request #2264:
URL: https://github.com/apache/hive/pull/2264#discussion_r646602703
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/io/orc/VectorizedOrcAcidRowBatchReader.java
##########
@@ -2039,4 +2189,29 @@ private static IntegerColumnStatistics deserializeIntColumnStatistics(List<OrcPr
deserializeIntColumnStatistics(colStats, OrcRecordUpdater.ROW_ID + 1);
return getKeyInterval(columnStatsArray);
}
+
+ private static class RowIsDeletedColumnVector extends LongColumnVector {
+ void clear() {
+ Arrays.fill(vector, 0);
Review comment:
Believe reset() method is a better choise, especially as we set repeat flag below
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/io/orc/VectorizedOrcAcidRowBatchReader.java
##########
@@ -2039,4 +2189,29 @@ private static IntegerColumnStatistics deserializeIntColumnStatistics(List<OrcPr
deserializeIntColumnStatistics(colStats, OrcRecordUpdater.ROW_ID + 1);
return getKeyInterval(columnStatsArray);
}
+
+ private static class RowIsDeletedColumnVector extends LongColumnVector {
+ void clear() {
+ Arrays.fill(vector, 0);
Review comment:
Believe reset() method is a better choice here, especially as we set repeat flag below
--
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.
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
[GitHub] [hive] pgaref commented on a change in pull request #2264: HIVE-24991: Enable fetching deleted rows in vectorized mode
Posted by GitBox <gi...@apache.org>.
pgaref commented on a change in pull request #2264:
URL: https://github.com/apache/hive/pull/2264#discussion_r646598948
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/io/orc/VectorizedOrcAcidRowBatchReader.java
##########
@@ -1748,7 +1946,7 @@ public int compareTo(CompressedOwid other) {
assert shouldReadDeleteDeltasWithLlap(conf, true);
}
deleteReaderValue = new DeleteReaderValue(readerData.reader, deleteDeltaFile, readerOptions, bucket,
- validWriteIdList, isBucketedTable, conf, keyInterval, orcSplit, numRows, cacheTag, fileId);
+ validWriteIdList, isBucketedTable, conf, keyInterval, orcSplit, numRows, cacheTag, fileId);
Review comment:
unnecessary space
--
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.
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
[GitHub] [hive] pgaref commented on a change in pull request #2264: HIVE-24991: Enable fetching deleted rows in vectorized mode
Posted by GitBox <gi...@apache.org>.
pgaref commented on a change in pull request #2264:
URL: https://github.com/apache/hive/pull/2264#discussion_r646554194
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/io/orc/VectorizedOrcAcidRowBatchReader.java
##########
@@ -892,13 +913,20 @@ public boolean next(NullWritable key, VectorizedRowBatch value) throws IOExcepti
} catch (Exception e) {
throw new IOException("error iterating", e);
}
- if(!includeAcidColumns) {
+ if (!includeAcidColumns) {
//if here, we don't need to filter anything wrt acid metadata columns
//in fact, they are not even read from file/llap
value.size = vectorizedRowBatchBase.size;
value.selected = vectorizedRowBatchBase.selected;
value.selectedInUse = vectorizedRowBatchBase.selectedInUse;
copyFromBase(value);
+
+ if (rowIsDeletedProjected) {
+ rowIsDeletedVector.clear();
+ int ix = rbCtx.findVirtualColumnNum(VirtualColumn.ROWISDELETED);
Review comment:
Why do we have to recompute **ix** for every batch? Lets store this along with rowIsDeletedProjected flag
--
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.
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
[GitHub] [hive] kasakrisz commented on a change in pull request #2264: HIVE-24991: Enable fetching deleted rows in vectorized mode
Posted by GitBox <gi...@apache.org>.
kasakrisz commented on a change in pull request #2264:
URL: https://github.com/apache/hive/pull/2264#discussion_r647558355
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/io/orc/VectorizedOrcAcidRowBatchReader.java
##########
@@ -932,8 +960,10 @@ public boolean next(NullWritable key, VectorizedRowBatch value) throws IOExcepti
}
// Case 2- find rows which have been deleted.
+ BitSet notDeletedBitSet = fetchDeletedRows ? (BitSet) selectedBitSet.clone() : selectedBitSet;
Review comment:
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.
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
[GitHub] [hive] pgaref commented on a change in pull request #2264: HIVE-24991: Enable fetching deleted rows in vectorized mode
Posted by GitBox <gi...@apache.org>.
pgaref commented on a change in pull request #2264:
URL: https://github.com/apache/hive/pull/2264#discussion_r646596265
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/io/orc/VectorizedOrcAcidRowBatchReader.java
##########
@@ -959,6 +989,20 @@ public boolean next(NullWritable key, VectorizedRowBatch value) throws IOExcepti
int ix = rbCtx.findVirtualColumnNum(VirtualColumn.ROWID);
value.cols[ix] = recordIdColumnVector;
}
+ if (rowIsDeletedProjected) {
+ if (fetchDeletedRows) {
Review comment:
tbh we could even do the second check as part of the Set method (as we do already for cardinality 0) and simplify the logic 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.
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
[GitHub] [hive] pgaref commented on a change in pull request #2264: HIVE-24991: Enable fetching deleted rows in vectorized mode
Posted by GitBox <gi...@apache.org>.
pgaref commented on a change in pull request #2264:
URL: https://github.com/apache/hive/pull/2264#discussion_r646536788
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/io/orc/VectorizedOrcAcidRowBatchReader.java
##########
@@ -1940,39 +2091,38 @@ public boolean isEmpty() {
}
@Override
public void findDeletedRecords(ColumnVector[] cols, int size, BitSet selectedBitSet) {
- if (rowIds == null || compressedOwids == null) {
+ if (rowIds == null || writeIds == null || writeIds.isEmpty()) {
return;
}
// Iterate through the batch and for each (owid, rowid) in the batch
// check if it is deleted or not.
long[] originalWriteIdVector =
- cols[OrcRecordUpdater.ORIGINAL_WRITEID].isRepeating ? null
- : ((LongColumnVector) cols[OrcRecordUpdater.ORIGINAL_WRITEID]).vector;
+ cols[OrcRecordUpdater.ORIGINAL_WRITEID].isRepeating ? null
Review comment:
Lets avoid changing the tabs/spaces below
--
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.
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
[GitHub] [hive] pgaref commented on a change in pull request #2264: HIVE-24991: Enable fetching deleted rows in vectorized mode
Posted by GitBox <gi...@apache.org>.
pgaref commented on a change in pull request #2264:
URL: https://github.com/apache/hive/pull/2264#discussion_r646551472
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/io/orc/VectorizedOrcAcidRowBatchReader.java
##########
@@ -303,6 +314,12 @@ private VectorizedOrcAcidRowBatchReader(JobConf conf, OrcSplit orcSplit, Reporte
VectorizedRowBatch.DEFAULT_SIZE, null, null, null);
}
rowIdProjected = areRowIdsProjected(rbCtx);
+ rowIsDeletedProjected = isVirtualColumnProjected(rbCtx, VirtualColumn.ROWISDELETED);
Review comment:
lets move this to a Utility function as areRowIdsProjected() above
--
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.
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
[GitHub] [hive] pgaref commented on a change in pull request #2264: HIVE-24991: Enable fetching deleted rows in vectorized mode
Posted by GitBox <gi...@apache.org>.
pgaref commented on a change in pull request #2264:
URL: https://github.com/apache/hive/pull/2264#discussion_r646554194
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/io/orc/VectorizedOrcAcidRowBatchReader.java
##########
@@ -892,13 +913,20 @@ public boolean next(NullWritable key, VectorizedRowBatch value) throws IOExcepti
} catch (Exception e) {
throw new IOException("error iterating", e);
}
- if(!includeAcidColumns) {
+ if (!includeAcidColumns) {
//if here, we don't need to filter anything wrt acid metadata columns
//in fact, they are not even read from file/llap
value.size = vectorizedRowBatchBase.size;
value.selected = vectorizedRowBatchBase.selected;
value.selectedInUse = vectorizedRowBatchBase.selectedInUse;
copyFromBase(value);
+
+ if (rowIsDeletedProjected) {
+ rowIsDeletedVector.clear();
+ int ix = rbCtx.findVirtualColumnNum(VirtualColumn.ROWISDELETED);
Review comment:
Why do we have to recompute this for every batch? Lets store this along with rowIsDeletedProjected flag
--
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.
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
[GitHub] [hive] kasakrisz commented on a change in pull request #2264: HIVE-24991: Enable fetching deleted rows in vectorized mode
Posted by GitBox <gi...@apache.org>.
kasakrisz commented on a change in pull request #2264:
URL: https://github.com/apache/hive/pull/2264#discussion_r647582736
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/io/orc/VectorizedOrcAcidRowBatchReader.java
##########
@@ -948,7 +978,7 @@ public boolean next(NullWritable key, VectorizedRowBatch value) throws IOExcepti
// This loop fills up the selected[] vector with all the index positions that are selected.
for (int setBitIndex = selectedBitSet.nextSetBit(0), selectedItr = 0;
setBitIndex >= 0;
- setBitIndex = selectedBitSet.nextSetBit(setBitIndex+1), ++selectedItr) {
+ setBitIndex = selectedBitSet.nextSetBit(setBitIndex + 1), ++selectedItr) {
Review comment:
reverted
--
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.
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
[GitHub] [hive] kasakrisz commented on a change in pull request #2264: HIVE-24991: Enable fetching deleted rows in vectorized mode
Posted by GitBox <gi...@apache.org>.
kasakrisz commented on a change in pull request #2264:
URL: https://github.com/apache/hive/pull/2264#discussion_r647561929
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/io/orc/VectorizedOrcAcidRowBatchReader.java
##########
@@ -959,6 +989,20 @@ public boolean next(NullWritable key, VectorizedRowBatch value) throws IOExcepti
int ix = rbCtx.findVirtualColumnNum(VirtualColumn.ROWID);
value.cols[ix] = recordIdColumnVector;
}
+ if (rowIsDeletedProjected) {
+ if (fetchDeletedRows) {
Review comment:
I prefer your first suggestion because the second one requires passing `vectorizedRowBatchBase.size()` to the `set` method which I would like to avoid.
--
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.
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
[GitHub] [hive] kasakrisz commented on a change in pull request #2264: HIVE-24991: Enable fetching deleted rows in vectorized mode
Posted by GitBox <gi...@apache.org>.
kasakrisz commented on a change in pull request #2264:
URL: https://github.com/apache/hive/pull/2264#discussion_r647559557
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/io/orc/VectorizedOrcAcidRowBatchReader.java
##########
@@ -983,7 +1027,7 @@ private void copyFromBase(VectorizedRowBatch value) {
System.arraycopy(payloadStruct.fields, 0, value.cols, 0, value.getDataColumnCount());
}
if (rowIdProjected) {
- recordIdColumnVector.fields[0] = vectorizedRowBatchBase.cols[OrcRecordUpdater.ORIGINAL_WRITEID];
+ recordIdColumnVector.fields[0] = vectorizedRowBatchBase.cols[fetchDeletedRows ? OrcRecordUpdater.CURRENT_WRITEID : OrcRecordUpdater.ORIGINAL_WRITEID];
Review comment:
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.
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
[GitHub] [hive] kasakrisz commented on a change in pull request #2264: HIVE-24991: Enable fetching deleted rows in vectorized mode
Posted by GitBox <gi...@apache.org>.
kasakrisz commented on a change in pull request #2264:
URL: https://github.com/apache/hive/pull/2264#discussion_r647583124
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/io/orc/VectorizedOrcAcidRowBatchReader.java
##########
@@ -1748,7 +1946,7 @@ public int compareTo(CompressedOwid other) {
assert shouldReadDeleteDeltasWithLlap(conf, true);
}
deleteReaderValue = new DeleteReaderValue(readerData.reader, deleteDeltaFile, readerOptions, bucket,
- validWriteIdList, isBucketedTable, conf, keyInterval, orcSplit, numRows, cacheTag, fileId);
+ validWriteIdList, isBucketedTable, conf, keyInterval, orcSplit, numRows, cacheTag, fileId);
Review comment:
reverted
--
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.
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
[GitHub] [hive] kasakrisz commented on a change in pull request #2264: HIVE-24991: Enable fetching deleted rows in vectorized mode
Posted by GitBox <gi...@apache.org>.
kasakrisz commented on a change in pull request #2264:
URL: https://github.com/apache/hive/pull/2264#discussion_r647582327
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/io/orc/VectorizedOrcAcidRowBatchReader.java
##########
@@ -281,16 +285,23 @@ private VectorizedOrcAcidRowBatchReader(JobConf conf, OrcSplit orcSplit, Reporte
deleteEventReaderOptions.range(0, Long.MAX_VALUE);
deleteEventReaderOptions.searchArgument(null, null);
keyInterval = findMinMaxKeys(orcSplit, conf, deleteEventReaderOptions);
+ fetchDeletedRows = conf.getBoolean(Constants.ACID_FETCH_DELETED_ROWS, false);
DeleteEventRegistry der;
try {
// See if we can load all the relevant delete events from all the
// delete deltas in memory...
+ ColumnizedDeleteEventRegistry.OriginalWriteIdLoader writeIdLoader;
+ if (fetchDeletedRows) {
+ writeIdLoader = new ColumnizedDeleteEventRegistry.BothWriteIdLoader();
Review comment:
done
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/io/orc/VectorizedOrcAcidRowBatchReader.java
##########
@@ -303,6 +314,12 @@ private VectorizedOrcAcidRowBatchReader(JobConf conf, OrcSplit orcSplit, Reporte
VectorizedRowBatch.DEFAULT_SIZE, null, null, null);
}
rowIdProjected = areRowIdsProjected(rbCtx);
+ rowIsDeletedProjected = isVirtualColumnProjected(rbCtx, VirtualColumn.ROWISDELETED);
Review comment:
done
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/io/orc/VectorizedOrcAcidRowBatchReader.java
##########
@@ -303,6 +314,12 @@ private VectorizedOrcAcidRowBatchReader(JobConf conf, OrcSplit orcSplit, Reporte
VectorizedRowBatch.DEFAULT_SIZE, null, null, null);
}
rowIdProjected = areRowIdsProjected(rbCtx);
+ rowIsDeletedProjected = isVirtualColumnProjected(rbCtx, VirtualColumn.ROWISDELETED);
+ if (rowIsDeletedProjected) {
+ rowIsDeletedVector = new RowIsDeletedColumnVector();
Review comment:
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.
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
[GitHub] [hive] kasakrisz commented on a change in pull request #2264: HIVE-24991: Enable fetching deleted rows in vectorized mode
Posted by GitBox <gi...@apache.org>.
kasakrisz commented on a change in pull request #2264:
URL: https://github.com/apache/hive/pull/2264#discussion_r647563794
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/io/orc/VectorizedOrcAcidRowBatchReader.java
##########
@@ -2039,4 +2189,29 @@ private static IntegerColumnStatistics deserializeIntColumnStatistics(List<OrcPr
deserializeIntColumnStatistics(colStats, OrcRecordUpdater.ROW_ID + 1);
return getKeyInterval(columnStatsArray);
}
+
+ private static class RowIsDeletedColumnVector extends LongColumnVector {
+ void clear() {
+ Arrays.fill(vector, 0);
Review comment:
Removed this method since `fill(false)` do what we need
--
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.
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