[
https://issues.apache.org/jira/browse/PHOENIX-6764?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17601644#comment-17601644
]
ASF GitHub Bot commented on PHOENIX-6764:
-----------------------------------------
stoty commented on code in PR #1490:
URL: https://github.com/apache/phoenix/pull/1490#discussion_r965532691
##########
phoenix-core/src/test/java/org/apache/phoenix/parse/QueryParserTest.java:
##########
@@ -925,6 +925,31 @@ public void testShowCreateTable() throws Exception {
// Expected failures.
parseQueryThatShouldFail("SHOW CREATE VIEW foo");
parseQueryThatShouldFail("SHOW CREATE TABLE 'foo'");
+ }
+
+ @Test
+ public void testBinaryLiteral() throws Exception {
+ // Happy paths
+ parseQuery("SELECT b, x from x WHERE x = x'00'");
+ parseQuery("SELECT b, x from x WHERE x = "
+ + "x '0 12 ' --comment \n /* comment */ '34 567' \n \n 'aA'");
+ parseQuery("SELECT b, x from x WHERE x = "
+ + "b '0 10 ' --comment \n /* comment */ '10 101' \n \n
'00000000'");
+ // Expected failures.
Review Comment:
Thanks.
I've misread the grammar in the standard, space is allowed before and after
digits, but not between X and ' , as you would expect.
> 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)