You can do something similar to PhoenixRuntime.decodeColumnValues() to do
that. It'd be something like this:
public static Object[] decodeColumnValues(Connection conn, String
fullTableName, byte[] value) throws SQLException {
PTable table = getTable(conn, fullTableName);
RowKeySchema schema = table.getRowKeySchema();
ImmutableBytesWritable ptr = new ImmutableBytesWritable(value);
schema.iterator(ptr);
int i = 0;
List<Object> values = new ArrayList<Object>();
while(schema.next(ptr, i, maxOffset) != null) {
values.add(schema.getField(i).getDataType().toObject(ptr));
i++;
}
return values.toArray();
}
On Mon, Jan 14, 2019 at 12:47 PM Shawn Li <[email protected]> wrote:
> Hi,
>
> Phoenix encodes composite key to hbase rowkey. We want to check if there
> any documentation or example to show how to manually decode Hbase rowkey
> back to original values for those primary keys. Or is there any phoenix
> source code we can directly use to do this?
>
> Thanks,
> Shawn
>