41
41
import static org .apache .phoenix .util .ViewIndexIdRetrieveUtil .VIEW_INDEX_ID_BIGINT_TYPE_PTR_LEN ;
42
42
43
43
/**
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.
46
45
* 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
+
47
59
*/
48
60
@ BuiltInFunction (name = DecodeViewIndexIdFunction .NAME ,
49
61
nodeClass = DecodeViewIndexIdParseNode .class ,
@@ -58,9 +70,7 @@ public DecodeViewIndexIdFunction() {
58
70
}
59
71
60
72
/**
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
64
74
*/
65
75
public DecodeViewIndexIdFunction (List <Expression > children ) {
66
76
super (children );
@@ -134,7 +144,6 @@ VIEW_INDEX_ID_DATA_TYPE, VIEW_INDEX_ID(Cell representation of the data)
134
144
SortOrder .ASC );
135
145
}
136
146
137
- System .out .println ("DecodeViewIndexIdFunction: Type: " + type );
138
147
ImmutableBytesWritable columnValue =
139
148
new ImmutableBytesWritable (CellUtil .cloneValue (viewIndexIdCell ));
140
149
if ((type == NULL_DATA_TYPE_VALUE || type == Types .SMALLINT ) && (viewIndexIdCell .getValueLength () <
0 commit comments