vineetgarg02 commented on a change in pull request #1315: URL: https://github.com/apache/hive/pull/1315#discussion_r466561873
########## File path: parser/src/java/org/apache/hadoop/hive/ql/parse/PrepareStatementParser.g ########## @@ -0,0 +1,66 @@ +/** + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ +parser grammar PrepareStatementParser; + +options +{ +output=AST; +ASTLabelType=ASTNode; +backtrack=false; +k=3; +} + +@members { + @Override + public Object recoverFromMismatchedSet(IntStream input, + RecognitionException re, BitSet follow) throws RecognitionException { + throw re; + } + @Override + public void displayRecognitionError(String[] tokenNames, + RecognitionException e) { + gParent.errors.add(new ParseError(gParent, e, tokenNames)); + } +} + +@rulecatch { +catch (RecognitionException e) { + throw e; +} +} + +//----------------------- Rules for parsing Prepare statement----------------------------- +prepareStatement +@init { gParent.pushMsg("prepare statement ", state); } +@after { gParent.popMsg(state); } + : KW_PREPARE identifier KW_FROM queryStatementExpression + -> ^(TOK_PREPARE queryStatementExpression identifier) + ; + +executeStatement +@init { gParent.pushMsg("execute statement ", state); } +@after { gParent.popMsg(state); } + : KW_EXECUTE identifier KW_USING executeParamList + -> ^(TOK_EXECUTE executeParamList identifier) + ; + +executeParamList +@init { gParent.pushMsg("execute param list", state); } +@after { gParent.popMsg(state); } + : constant (COMMA constant)* Review comment: https://issues.apache.org/jira/browse/HIVE-24002 ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
