[ https://issues.apache.org/jira/browse/HIVE-20608?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16641365#comment-16641365 ]
Soumabrata Chakraborty commented on HIVE-20608: ----------------------------------------------- Hi [~daijy] - yes beeline trims the command before sending to hiverserver2 which is why this issue of HiveServer2 not handling untrimmed statement does not come to surface. The issue will be reproducible if you use Java JDBC Driver for HiveServer2. Basically do something like: {code:java} Connection connection = DriverManager.getConnection("jdbc:hive2://localhost:10000/"); connection.createStatement().execute(" set a = b"); {code} Also, if you remove my change to the HiveCommandOperation.java and then run the new test case I introduced you will see that it computes the command arguments incorrectly and it fails. > Incorrect handling of sql command args in hive service leading to misleading > error messages > ------------------------------------------------------------------------------------------- > > Key: HIVE-20608 > URL: https://issues.apache.org/jira/browse/HIVE-20608 > Project: Hive > Issue Type: Bug > Reporter: Soumabrata Chakraborty > Assignee: Soumabrata Chakraborty > Priority: Major > Attachments: HIVE-20608.2.patch, HIVE-20608.patch > > > *Steps to reproduce:* > (1) Connect to HiveServer2 using JDBC driver (not via Beeline) > (2) Execute a set command with a space before set – e.g. " set > hive.exec.dynamic.partiton=true" > (3) The error that is returned says: > {code:java} > Caused by: org.apache.hive.service.cli.HiveSQLException: Error while > processing statement: Cannot modify set hive.exec.dynamic.partition at > runtime. It is not in list of params that are allowed to be modified at > runtime > {code} > (4) However on removing the space before the set command - it works fine. > > *Analysis:* > Looks like an issue with > [https://github.com/apache/hive/blob/master/service/src/java/org/apache/hive/service/cli/operation/HiveCommandOperation.java] > > In the runInternal() method, the untrimmed sql statement is split by space > (\\s) but the substring operation to get the command args is done on the > trimmed sql statement. This causes the issue. > {code:java} > String command = getStatement().trim(); > String[] tokens = statement.split("\\s"); > String commandArgs = command.substring(tokens[0].length()).trim(); > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)