Viraj Jasani created PHOENIX-7588: ------------------------------------- Summary: SUBBINARY() - Substring like search for Binary data types Key: PHOENIX-7588 URL: https://issues.apache.org/jira/browse/PHOENIX-7588 Project: Phoenix Issue Type: Improvement Reporter: Viraj Jasani
We have SUBSTR() function that performs sub-string search within the given string data type. The proposal of this Jira is to build new function with similar functionality for Binary data types: BINARY, VARBINARY and VARBINARY_ENCODED. *Function:* SUBBINARY() *Arguments:* # BINARY, VARBINARY or VARBINARY_ENCODED - data type on which the sub-string like search is to be performed. # Offset - Specify the offset position on the above binary data from where the sub-string like comparison of binary is to be performed. # Length - Optional length of the binary data to compare. *Examples:* {code:java} SELECT * FROM T WHERE SUBBINARY(PK1, 0) = X'00000022d215';{code} Assuming PK1 is the only primary key column, the above query should return all rows where PK1 value starts with binary equivalent of value X'00000022d215' at offset 0. Therefore, the above query should return all rows that start with prefix value of X'00000022d215'. {code:java} SELECT * FROM T WHERE SUBBINARY(PK1, 3) = X'00000022d215';{code} Assuming PK1 is the only primary key column, the above query should return all rows where PK1 value starts with binary equivalent of value X'00000022d215' at offset 3. -- This message was sent by Atlassian Jira (v8.20.10#820010)