This is an automated email from the ASF dual-hosted git repository. stoty pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/phoenix.git
The following commit(s) were added to refs/heads/master by this push: new 09a9802e3a PHOENIX-6966 UngroupedAggregateRegionScanner.insertEmptyKeyValue() writes wrong qualifier for encoded CQ tables 09a9802e3a is described below commit 09a9802e3a0ea094ea9c3584be560f73454c2b4c Author: Istvan Toth <st...@apache.org> AuthorDate: Thu Jun 1 08:40:06 2023 +0200 PHOENIX-6966 UngroupedAggregateRegionScanner.insertEmptyKeyValue() writes wrong qualifier for encoded CQ tables --- .../coprocessor/UngroupedAggregateRegionScanner.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/UngroupedAggregateRegionScanner.java b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/UngroupedAggregateRegionScanner.java index 8416fe47f3..68080f9d44 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/UngroupedAggregateRegionScanner.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/UngroupedAggregateRegionScanner.java @@ -151,6 +151,7 @@ public class UngroupedAggregateRegionScanner extends BaseRegionScanner { private byte[] deleteCQ = null; private byte[] deleteCF = null; private byte[] emptyCF = null; + private byte[] emptyCQ = null; private final byte[] indexUUID; private final byte[] txState; private final byte[] clientVersionBytes; @@ -241,6 +242,13 @@ public class UngroupedAggregateRegionScanner extends BaseRegionScanner { deleteCQ = scan.getAttribute(BaseScannerRegionObserver.DELETE_CQ); } emptyCF = scan.getAttribute(BaseScannerRegionObserver.EMPTY_CF); + emptyCQ = scan.getAttribute(BaseScannerRegionObserver.EMPTY_COLUMN_QUALIFIER); + if (emptyCF != null && emptyCQ == null) { + // In case some old version sets EMPTY_CF but not EMPTY_COLUMN_QUALIFIER + // Not sure if it's really needed, but better safe than sorry + emptyCQ = QueryConstants.EMPTY_COLUMN_BYTES; + } + } ColumnReference[] dataColumns = IndexUtil.deserializeDataTableColumnsToJoin(scan); useQualifierAsIndex = EncodedColumnsUtil.useQualifierAsIndex(EncodedColumnsUtil.getMinMaxQualifiersFromScan(scan)); @@ -541,13 +549,15 @@ public class UngroupedAggregateRegionScanner extends BaseRegionScanner { if (!timeStamps.contains(kvts)) { Put put = new Put(kv.getRowArray(), kv.getRowOffset(), kv.getRowLength()); - put.addColumn(emptyCF, QueryConstants.EMPTY_COLUMN_BYTES, kvts, - ByteUtil.EMPTY_BYTE_ARRAY); + // The value is not dependent on encoding ("x") + put.addColumn(emptyCF, emptyCQ, kvts, + QueryConstants.EMPTY_COLUMN_VALUE_BYTES); mutations.add(put); timeStamps.add(kvts); } } } + @Override public boolean next(List<Cell> resultsToReturn) throws IOException { boolean hasMore;