public final HiveParser.queryStatement_return queryStatement() throws RecognitionException {
		HiveParser.queryStatement_return retval = new HiveParser.queryStatement_return();
		retval.start = input.LT(1);

		CommonTree root_0 = null;

		List<Object> list_b=null;
		ParserRuleReturnScope fromClause717 =null;
		ParserRuleReturnScope regular_body718 =null;
		RuleReturnScope b = null;
		RewriteRuleSubtreeStream stream_body=new RewriteRuleSubtreeStream(adaptor,"rule body");
		RewriteRuleSubtreeStream stream_fromClause=new RewriteRuleSubtreeStream(adaptor,"rule fromClause");

		try {
			// HiveParser.g:1828:5: ( fromClause (b+= body )+ -> ^( TOK_QUERY fromClause ( body )+ ) | regular_body )
			int alt189=2;
			int LA189_0 = input.LA(1);
			if ( (LA189_0==KW_FROM) ) {
				alt189=1;
			}
			else if ( (LA189_0==KW_INSERT||LA189_0==KW_MAP||LA189_0==KW_REDUCE||LA189_0==KW_SELECT) ) {
				alt189=2;
			}

			else {
				NoViableAltException nvae =
					new NoViableAltException("", 189, 0, input);
				throw nvae;
			}

			switch (alt189) {
				case 1 :
					// HiveParser.g:1829:5: fromClause (b+= body )+
					{
					pushFollow(FOLLOW_fromClause_in_queryStatement11407);
					fromClause717=fromClause();
					state._fsp--;

					stream_fromClause.add(fromClause717.getTree());
					// HiveParser.g:1830:5: (b+= body )+
					int cnt188=0;
					loop188:
					while (true) {
						int alt188=2;
						int LA188_0 = input.LA(1);
						if ( (LA188_0==KW_INSERT||LA188_0==KW_MAP||LA188_0==KW_REDUCE||LA188_0==KW_SELECT) ) {
							alt188=1;
						}

						switch (alt188) {
						case 1 :
							// HiveParser.g:1830:7: b+= body
							{
							pushFollow(FOLLOW_body_in_queryStatement11417);
							b=body();
							state._fsp--;

							stream_body.add(b.getTree());
							if (list_b==null) list_b=new ArrayList<Object>();
							list_b.add(b.getTree());
							}
							break;

						default :
							if ( cnt188 >= 1 ) break loop188;
							EarlyExitException eee = new EarlyExitException(188, input);
							throw eee;
						}
						cnt188++;
					}

					// AST REWRITE
					// elements: body, fromClause
					// token labels: 
					// rule labels: retval
					// token list labels: 
					// rule list labels: 
					// wildcard labels: 
					retval.tree = root_0;
					RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);

					root_0 = (CommonTree)adaptor.nil();
					// 1830:18: -> ^( TOK_QUERY fromClause ( body )+ )
					{
						// HiveParser.g:1830:21: ^( TOK_QUERY fromClause ( body )+ )
						{
						CommonTree root_1 = (CommonTree)adaptor.nil();
						root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(TOK_QUERY, "TOK_QUERY"), root_1);
						adaptor.addChild(root_1, stream_fromClause.nextTree());
						if ( !(stream_body.hasNext()) ) {
							throw new RewriteEarlyExitException();
						}
						while ( stream_body.hasNext() ) {
							adaptor.addChild(root_1, stream_body.nextTree());
						}
						stream_body.reset();

						adaptor.addChild(root_0, root_1);
						}

					}


					retval.tree = root_0;

					}
					break;
				case 2 :
					// HiveParser.g:1831:7: regular_body
					{
					root_0 = (CommonTree)adaptor.nil();


					pushFollow(FOLLOW_regular_body_in_queryStatement11439);
					regular_body718=regular_body();
					state._fsp--;

					adaptor.addChild(root_0, regular_body718.getTree());

					}
					break;

			}
			retval.stop = input.LT(-1);

			retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
			adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

		}

		catch (RecognitionException e) {
		 reportError(e);
		  throw e;
		}

		finally {
			// do for sure before leaving
		}
		return retval;
	}