Github user karanmehta93 commented on a diff in the pull request: https://github.com/apache/phoenix/pull/283#discussion_r152649147 --- Diff: phoenix-core/src/test/java/org/apache/phoenix/parse/QueryParserTest.java --- @@ -66,6 +68,46 @@ private void parseQueryThatShouldFail(String sql) throws Exception { } } + @Test + public void testParseGrantQuery() throws Exception { + + String sql0 = "GRANT 'RX' ON SYSTEM.\"SEQUENCE\" TO 'user'"; + parseQuery(sql0); + String sql1 = "GRANT 'RWXCA' ON TABLE some_table0 TO 'user0'"; + parseQuery(sql1); + String sql2 = "GRANT 'RWX' ON some_table1 TO 'user1'"; + parseQuery(sql2); + String sql3 = "GRANT 'CA' ON SCHEMA some_schema2 TO 'user2'"; + parseQuery(sql3); + String sql4 = "GRANT 'RXW' ON some_table3 TO GROUP 'group3'"; + parseQuery(sql4); + String sql5 = "GRANT 'RXW' ON \"some_schema5\".\"some_table5\" TO GROUP 'group5'"; + parseQuery(sql5); + String sql6 = "GRANT 'RWA' TO 'user6'"; + parseQuery(sql6); + String sql7 = "GRANT 'A' TO GROUP 'group7'"; + parseQuery(sql7); --- End diff -- HBase API logs a message and ignores it if any other character is found apart from 'RWXCA'. If same character is passed again, it will put up the same string in the hbase:acl table. An example of this is `GRANT 'RXXRRRRCAAAA' to 'user11'` results in ` hbase:acl column=l:user11, timestamp=1511376020328, value=RXXRRRRCAAAA` A simple check should be to limit the size of string to 5 characters. Does that seem fine?
---