This is an automated email from the ASF dual-hosted git repository. stoty pushed a commit to branch 5.1 in repository https://gitbox.apache.org/repos/asf/phoenix.git
The following commit(s) were added to refs/heads/5.1 by this push: new 0663a25e64 PHOENIX-6966 UngroupedAggregateRegionScanner.insertEmptyKeyValue() writes wrong qualifier for encoded CQ tables 0663a25e64 is described below commit 0663a25e649a5007145d7d90fb98328b67669f0e 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 daebad4a75..30dfa41761 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 @@ -152,6 +152,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)); @@ -545,13 +553,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;