Skip to content

Commit 9355930

Browse files
committed
Addresses review comments
1 parent 2baee94 commit 9355930

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

phoenix-core-client/src/main/java/org/apache/phoenix/expression/function/DecodeViewIndexIdFunction.java

+15-6
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,21 @@
4141
import static org.apache.phoenix.util.ViewIndexIdRetrieveUtil.VIEW_INDEX_ID_BIGINT_TYPE_PTR_LEN;
4242

4343
/**
44-
* Function to return the timestamp of the empty column which functions as the row timestamp. The
45-
* result returned can be used for debugging(eg. using HBase shell), logging etc.
44+
* Function to return the ViewIndexId value based on the ViewIndexIDDataType field.
4645
* Can also be used in sql predicates.
46+
* THe ViewIndexId field value needs to be interpreted based on the type specified in the
47+
* ViewIndexIdDataType field
48+
This is how the various client created view index id's look like:
49+
client VIEW_INDEX_ID(Cell number of bytes) VIEW_INDEX_ID_DATA_TYPE
50+
pre-4.15 2 bytes NULL
51+
post-4.15[config smallint] 2 bytes 5(smallint)
52+
post-4.15[config bigint] 8 bytes -5(bigint)
53+
54+
VIEW_INDEX_ID_DATA_TYPE, VIEW_INDEX_ID(Cell representation of the data)
55+
NULL, SMALLINT -> RETRIEVE AND CONVERT TO BIGINT
56+
SMALLINT, SMALLINT -> RETRIEVE AND CONVERT TO BIGINT
57+
BIGINT, BIGINT -> DO NOT CONVERT
58+
4759
*/
4860
@BuiltInFunction(name = DecodeViewIndexIdFunction.NAME,
4961
nodeClass= DecodeViewIndexIdParseNode.class,
@@ -58,9 +70,7 @@ public DecodeViewIndexIdFunction() {
5870
}
5971

6072
/**
61-
* @param children An EMPTY_COLUMN key value expression injected thru
62-
* {@link PhoenixRowTimestampParseNode#create create}
63-
* will cause the empty column key value to be evaluated during scan filter processing.
73+
* @param children VIEW_INDEX_ID and VIEW_INDEX_ID_DATA_TYPE expressions
6474
*/
6575
public DecodeViewIndexIdFunction(List<Expression> children) {
6676
super(children);
@@ -134,7 +144,6 @@ VIEW_INDEX_ID_DATA_TYPE, VIEW_INDEX_ID(Cell representation of the data)
134144
SortOrder.ASC);
135145
}
136146

137-
System.out.println("DecodeViewIndexIdFunction: Type: " + type);
138147
ImmutableBytesWritable columnValue =
139148
new ImmutableBytesWritable(CellUtil.cloneValue(viewIndexIdCell));
140149
if ((type == NULL_DATA_TYPE_VALUE || type == Types.SMALLINT) && (viewIndexIdCell.getValueLength() <

phoenix-core-server/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java

+1-3
Original file line numberDiff line numberDiff line change
@@ -3371,9 +3371,7 @@ private MetaDataMutationResult doDropTable(byte[] key, byte[] tenantId, byte[] s
33713371
}
33723372
Delete delete = new Delete(kv.getRowArray(), kv.getRowOffset(), kv.getRowLength(),
33733373
clientTimeStamp);
3374-
if (Bytes.compareTo(key, 0, key.length, kv.getRowArray(), kv.getRowOffset(), kv.getRowLength()) == 0) {
3375-
LOGGER.info("doDropTable:Found key {} ", Bytes.toStringBinary(key));
3376-
} else {
3374+
if (Bytes.compareTo(key, 0, key.length, kv.getRowArray(), kv.getRowOffset(), kv.getRowLength()) != 0) {
33773375
catalogMutations.add(delete);
33783376
}
33793377
results.clear();

0 commit comments

Comments
 (0)