virajjasani commented on code in PR #2377:
URL: https://github.com/apache/phoenix/pull/2377#discussion_r2830019180
##########
phoenix-core-client/src/main/java/org/apache/phoenix/compile/RVCOffsetCompiler.java:
##########
@@ -247,17 +248,19 @@ public CompiledOffset getRVCOffset(StatementContext
context, FilterableStatement
// check to see if this was a single key expression
ScanRanges scanRanges = context.getScanRanges();
- // We do not generate a point lookup today in phoenix if the rowkey has a
trailing null, we
- // generate a range scan.
+ // Always generate point lookup for RVC Offset
if (!scanRanges.isPointLookup()) {
- // Since we use a range scan to guarantee we get only the null value and
the upper bound is
- // unset this suffices
- // sanity check
- if (!rowKeyColumnExpressionOutput.isTrailingNull()) {
- throw new RowValueConstructorOffsetNotCoercibleException(
- "RVC Offset must be a point lookup.");
- }
- key = scanRanges.getScanRange().getUpperRange();
+ throw new RowValueConstructorOffsetNotCoercibleException(
+ "RVC Offset must be a point lookup.");
+ }
+ if (rowKeyColumnExpressionOutput.isTrailingNull()) {
+ // Handle trailing nulls in RVC offset by appending null byte at the end
to generate immediate
+ // next key
+ key = scanRanges.getScanRange().getLowerRange();
+ byte[] keyCopy = new byte[key.length + 1];
+ System.arraycopy(key, 0, keyCopy, 0, key.length);
+ keyCopy[key.length] = QueryConstants.SEPARATOR_BYTE;
+ key = keyCopy;
Review Comment:
Any chance we can use `ByteUtil.nextKey()` to generate next key?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]