[ 
https://issues.apache.org/jira/browse/PHOENIX-6764?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17585168#comment-17585168
 ] 

ASF GitHub Bot commented on PHOENIX-6764:
-----------------------------------------

stoty commented on PR #1490:
URL: https://github.com/apache/phoenix/pull/1490#issuecomment-1228096196

   There two open issues:
   
   1. The new litarals don't work with BINARY ARRAYS. I suspect that this is 
not a new problem, so I'm not terribly concerned about that.
   
   2. The way we convert binaries to strings is inconsitent:
   On one hand, we have the Formatters that are used for VARBINARY (and now 
BINARY) results, on the other we have the toStringLiteral() method in the 
P*BBinary classes, which are used for Statement.toString(), and for 
BINARY_ARRAY (which doesn't have an explicit Formatter set)
   
   Before the patch, the formatter generated  _'AABB'_, which the 
toStringLiteral() methods returned _'[170, 187]'_
   
   With my patch, the formatter is the same, only it's now also set for BINARY, 
while previously it was only set for VARBINARY.
   I've changed the toStringLiteral() formatter to return a valid binary string 
literal, _X'AABB'_ , so now stmt.toString() generates valid SQL.
   
   The complicate things, it seems that Oracle and Mysql simply returns 
something like new String(byte[]) for getString(), so the Phoenix behaviour is 
unique.
   
   I don't think that this is show-stopper either, the patch doesn't make any 
of those problems any worse.




> Implement Binary and Hexadecimal literals
> -----------------------------------------
>
>                 Key: PHOENIX-6764
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-6764
>             Project: Phoenix
>          Issue Type: Bug
>          Components: core
>            Reporter: Istvan Toth
>            Assignee: Istvan Toth
>            Priority: Major
>
> Currently there is no sane way to specify arbitrary binary and varbinary 
> values in the query string.
> They can be set as variables for preparedstatements, and if the length 
> corresponds to an existing type, then some casting gymnastics can be used to 
> work around the problem, but I have not found a way to write a query that 
> upserts an arbitrary three byte value into a binary/varbinary.
> The SQL standard defines Binary and Hex literals in the form of 
> B'01010101001...' and X'0102AAF5...'
> Implement this in the parser.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to