[
https://issues.apache.org/jira/browse/PHOENIX-5628?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17013219#comment-17013219
]
Ankit Singhal commented on PHOENIX-5628:
----------------------------------------
[~abhishek.chouhan], when you have a composite key, the string version of
rowkey will not make much sense. so it is better to have return type as
VARBINARY instead to be VARCHAR.
{code}
+ @Override
+ public boolean evaluate(Tuple tuple, ImmutableBytesWritable ptr) {
+ tuple.getKey(ptr);
+ String rowkey = Bytes.toStringBinary(ptr.get(), ptr.getOffset(),
ptr.getLength());
+ ptr.set(PVarchar.INSTANCE.toBytes(rowkey));
+ return true;
+ }
+
+ @Override
+ public PDataType getDataType() {
+ return PVarchar.INSTANCE;
+ }
{code}
> Phoenix Function to Return HBase Row Key of Column Cell
> -------------------------------------------------------
>
> Key: PHOENIX-5628
> URL: https://issues.apache.org/jira/browse/PHOENIX-5628
> Project: Phoenix
> Issue Type: New Feature
> Reporter: Geoffrey Jacoby
> Assignee: Abhishek Singh Chouhan
> Priority: Major
> Fix For: 5.1.0, 4.16.0
>
> Attachments: PHOENIX-5628-4.x-HBase-1.5.patch,
> PHOENIX-5628-master.patch
>
>
> It's occasionally useful when diagnosing an issue with Phoenix to be able to
> easily look up the byte array of a row key that corresponds to a cell with a
> Phoenix query. This can then be looked up in the HBase shell.
> For example:
> SELECT ROWKEY_BYTES(Column1) FROM Table1 WHERE Column1 = 'SomeValue'
--
This message was sent by Atlassian Jira
(v8.3.4#803005)