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

		CommonTree root_0 = null;

		ParserRuleReturnScope insertClause719 =null;
		ParserRuleReturnScope selectClause720 =null;
		ParserRuleReturnScope fromClause721 =null;
		ParserRuleReturnScope whereClause722 =null;
		ParserRuleReturnScope groupByClause723 =null;
		ParserRuleReturnScope havingClause724 =null;
		ParserRuleReturnScope orderByClause725 =null;
		ParserRuleReturnScope clusterByClause726 =null;
		ParserRuleReturnScope distributeByClause727 =null;
		ParserRuleReturnScope sortByClause728 =null;
		ParserRuleReturnScope window_clause729 =null;
		ParserRuleReturnScope limitClause730 =null;
		ParserRuleReturnScope selectStatement731 =null;

		RewriteRuleSubtreeStream stream_whereClause=new RewriteRuleSubtreeStream(adaptor,"rule whereClause");
		RewriteRuleSubtreeStream stream_window_clause=new RewriteRuleSubtreeStream(adaptor,"rule window_clause");
		RewriteRuleSubtreeStream stream_clusterByClause=new RewriteRuleSubtreeStream(adaptor,"rule clusterByClause");
		RewriteRuleSubtreeStream stream_distributeByClause=new RewriteRuleSubtreeStream(adaptor,"rule distributeByClause");
		RewriteRuleSubtreeStream stream_limitClause=new RewriteRuleSubtreeStream(adaptor,"rule limitClause");
		RewriteRuleSubtreeStream stream_orderByClause=new RewriteRuleSubtreeStream(adaptor,"rule orderByClause");
		RewriteRuleSubtreeStream stream_sortByClause=new RewriteRuleSubtreeStream(adaptor,"rule sortByClause");
		RewriteRuleSubtreeStream stream_insertClause=new RewriteRuleSubtreeStream(adaptor,"rule insertClause");
		RewriteRuleSubtreeStream stream_groupByClause=new RewriteRuleSubtreeStream(adaptor,"rule groupByClause");
		RewriteRuleSubtreeStream stream_havingClause=new RewriteRuleSubtreeStream(adaptor,"rule havingClause");
		RewriteRuleSubtreeStream stream_selectClause=new RewriteRuleSubtreeStream(adaptor,"rule selectClause");
		RewriteRuleSubtreeStream stream_fromClause=new RewriteRuleSubtreeStream(adaptor,"rule fromClause");

		try {
			// HiveParser.g:1835:4: ( insertClause selectClause fromClause ( whereClause )? ( groupByClause )? ( havingClause )? ( orderByClause )? ( clusterByClause )? ( distributeByClause )? ( sortByClause )? ( window_clause )? ( limitClause )? -> ^( TOK_QUERY fromClause ^( TOK_INSERT insertClause selectClause ( whereClause )? ( groupByClause )? ( havingClause )? ( orderByClause )? ( clusterByClause )? ( distributeByClause )? ( sortByClause )? ( window_clause )? ( limitClause )? ) ) | selectStatement )
			int alt199=2;
			int LA199_0 = input.LA(1);
			if ( (LA199_0==KW_INSERT) ) {
				alt199=1;
			}
			else if ( (LA199_0==KW_MAP||LA199_0==KW_REDUCE||LA199_0==KW_SELECT) ) {
				alt199=2;
			}

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

			switch (alt199) {
				case 1 :
					// HiveParser.g:1836:4: insertClause selectClause fromClause ( whereClause )? ( groupByClause )? ( havingClause )? ( orderByClause )? ( clusterByClause )? ( distributeByClause )? ( sortByClause )? ( window_clause )? ( limitClause )?
					{
					pushFollow(FOLLOW_insertClause_in_regular_body11458);
					insertClause719=insertClause();
					state._fsp--;

					stream_insertClause.add(insertClause719.getTree());
					pushFollow(FOLLOW_selectClause_in_regular_body11463);
					selectClause720=selectClause();
					state._fsp--;

					stream_selectClause.add(selectClause720.getTree());
					pushFollow(FOLLOW_fromClause_in_regular_body11468);
					fromClause721=fromClause();
					state._fsp--;

					stream_fromClause.add(fromClause721.getTree());
					// HiveParser.g:1839:4: ( whereClause )?
					int alt190=2;
					int LA190_0 = input.LA(1);
					if ( (LA190_0==KW_WHERE) ) {
						alt190=1;
					}
					switch (alt190) {
						case 1 :
							// HiveParser.g:1839:4: whereClause
							{
							pushFollow(FOLLOW_whereClause_in_regular_body11473);
							whereClause722=whereClause();
							state._fsp--;

							stream_whereClause.add(whereClause722.getTree());
							}
							break;

					}

					// HiveParser.g:1840:4: ( groupByClause )?
					int alt191=2;
					int LA191_0 = input.LA(1);
					if ( (LA191_0==KW_GROUP) ) {
						alt191=1;
					}
					switch (alt191) {
						case 1 :
							// HiveParser.g:1840:4: groupByClause
							{
							pushFollow(FOLLOW_groupByClause_in_regular_body11479);
							groupByClause723=groupByClause();
							state._fsp--;

							stream_groupByClause.add(groupByClause723.getTree());
							}
							break;

					}

					// HiveParser.g:1841:4: ( havingClause )?
					int alt192=2;
					int LA192_0 = input.LA(1);
					if ( (LA192_0==KW_HAVING) ) {
						alt192=1;
					}
					switch (alt192) {
						case 1 :
							// HiveParser.g:1841:4: havingClause
							{
							pushFollow(FOLLOW_havingClause_in_regular_body11485);
							havingClause724=havingClause();
							state._fsp--;

							stream_havingClause.add(havingClause724.getTree());
							}
							break;

					}

					// HiveParser.g:1842:4: ( orderByClause )?
					int alt193=2;
					int LA193_0 = input.LA(1);
					if ( (LA193_0==KW_ORDER) ) {
						alt193=1;
					}
					switch (alt193) {
						case 1 :
							// HiveParser.g:1842:4: orderByClause
							{
							pushFollow(FOLLOW_orderByClause_in_regular_body11491);
							orderByClause725=orderByClause();
							state._fsp--;

							stream_orderByClause.add(orderByClause725.getTree());
							}
							break;

					}

					// HiveParser.g:1843:4: ( clusterByClause )?
					int alt194=2;
					int LA194_0 = input.LA(1);
					if ( (LA194_0==KW_CLUSTER) ) {
						alt194=1;
					}
					switch (alt194) {
						case 1 :
							// HiveParser.g:1843:4: clusterByClause
							{
							pushFollow(FOLLOW_clusterByClause_in_regular_body11497);
							clusterByClause726=clusterByClause();
							state._fsp--;

							stream_clusterByClause.add(clusterByClause726.getTree());
							}
							break;

					}

					// HiveParser.g:1844:4: ( distributeByClause )?
					int alt195=2;
					int LA195_0 = input.LA(1);
					if ( (LA195_0==KW_DISTRIBUTE) ) {
						alt195=1;
					}
					switch (alt195) {
						case 1 :
							// HiveParser.g:1844:4: distributeByClause
							{
							pushFollow(FOLLOW_distributeByClause_in_regular_body11503);
							distributeByClause727=distributeByClause();
							state._fsp--;

							stream_distributeByClause.add(distributeByClause727.getTree());
							}
							break;

					}

					// HiveParser.g:1845:4: ( sortByClause )?
					int alt196=2;
					int LA196_0 = input.LA(1);
					if ( (LA196_0==KW_SORT) ) {
						alt196=1;
					}
					switch (alt196) {
						case 1 :
							// HiveParser.g:1845:4: sortByClause
							{
							pushFollow(FOLLOW_sortByClause_in_regular_body11509);
							sortByClause728=sortByClause();
							state._fsp--;

							stream_sortByClause.add(sortByClause728.getTree());
							}
							break;

					}

					// HiveParser.g:1846:4: ( window_clause )?
					int alt197=2;
					int LA197_0 = input.LA(1);
					if ( (LA197_0==KW_WINDOW) ) {
						alt197=1;
					}
					switch (alt197) {
						case 1 :
							// HiveParser.g:1846:4: window_clause
							{
							pushFollow(FOLLOW_window_clause_in_regular_body11515);
							window_clause729=window_clause();
							state._fsp--;

							stream_window_clause.add(window_clause729.getTree());
							}
							break;

					}

					// HiveParser.g:1847:4: ( limitClause )?
					int alt198=2;
					int LA198_0 = input.LA(1);
					if ( (LA198_0==KW_LIMIT) ) {
						alt198=1;
					}
					switch (alt198) {
						case 1 :
							// HiveParser.g:1847:4: limitClause
							{
							pushFollow(FOLLOW_limitClause_in_regular_body11521);
							limitClause730=limitClause();
							state._fsp--;

							stream_limitClause.add(limitClause730.getTree());
							}
							break;

					}

					// AST REWRITE
					// elements: whereClause, selectClause, insertClause, distributeByClause, orderByClause, window_clause, fromClause, groupByClause, sortByClause, limitClause, clusterByClause, havingClause
					// 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();
					// 1847:17: -> ^( TOK_QUERY fromClause ^( TOK_INSERT insertClause selectClause ( whereClause )? ( groupByClause )? ( havingClause )? ( orderByClause )? ( clusterByClause )? ( distributeByClause )? ( sortByClause )? ( window_clause )? ( limitClause )? ) )
					{
						// HiveParser.g:1847:20: ^( TOK_QUERY fromClause ^( TOK_INSERT insertClause selectClause ( whereClause )? ( groupByClause )? ( havingClause )? ( orderByClause )? ( clusterByClause )? ( distributeByClause )? ( sortByClause )? ( window_clause )? ( limitClause )? ) )
						{
						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());
						// HiveParser.g:1847:43: ^( TOK_INSERT insertClause selectClause ( whereClause )? ( groupByClause )? ( havingClause )? ( orderByClause )? ( clusterByClause )? ( distributeByClause )? ( sortByClause )? ( window_clause )? ( limitClause )? )
						{
						CommonTree root_2 = (CommonTree)adaptor.nil();
						root_2 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(TOK_INSERT, "TOK_INSERT"), root_2);
						adaptor.addChild(root_2, stream_insertClause.nextTree());
						adaptor.addChild(root_2, stream_selectClause.nextTree());
						// HiveParser.g:1848:35: ( whereClause )?
						if ( stream_whereClause.hasNext() ) {
							adaptor.addChild(root_2, stream_whereClause.nextTree());
						}
						stream_whereClause.reset();

						// HiveParser.g:1848:48: ( groupByClause )?
						if ( stream_groupByClause.hasNext() ) {
							adaptor.addChild(root_2, stream_groupByClause.nextTree());
						}
						stream_groupByClause.reset();

						// HiveParser.g:1848:63: ( havingClause )?
						if ( stream_havingClause.hasNext() ) {
							adaptor.addChild(root_2, stream_havingClause.nextTree());
						}
						stream_havingClause.reset();

						// HiveParser.g:1848:77: ( orderByClause )?
						if ( stream_orderByClause.hasNext() ) {
							adaptor.addChild(root_2, stream_orderByClause.nextTree());
						}
						stream_orderByClause.reset();

						// HiveParser.g:1848:92: ( clusterByClause )?
						if ( stream_clusterByClause.hasNext() ) {
							adaptor.addChild(root_2, stream_clusterByClause.nextTree());
						}
						stream_clusterByClause.reset();

						// HiveParser.g:1849:22: ( distributeByClause )?
						if ( stream_distributeByClause.hasNext() ) {
							adaptor.addChild(root_2, stream_distributeByClause.nextTree());
						}
						stream_distributeByClause.reset();

						// HiveParser.g:1849:42: ( sortByClause )?
						if ( stream_sortByClause.hasNext() ) {
							adaptor.addChild(root_2, stream_sortByClause.nextTree());
						}
						stream_sortByClause.reset();

						// HiveParser.g:1849:56: ( window_clause )?
						if ( stream_window_clause.hasNext() ) {
							adaptor.addChild(root_2, stream_window_clause.nextTree());
						}
						stream_window_clause.reset();

						// HiveParser.g:1849:71: ( limitClause )?
						if ( stream_limitClause.hasNext() ) {
							adaptor.addChild(root_2, stream_limitClause.nextTree());
						}
						stream_limitClause.reset();

						adaptor.addChild(root_1, root_2);
						}

						adaptor.addChild(root_0, root_1);
						}

					}


					retval.tree = root_0;

					}
					break;
				case 2 :
					// HiveParser.g:1851:4: selectStatement
					{
					root_0 = (CommonTree)adaptor.nil();


					pushFollow(FOLLOW_selectStatement_in_regular_body11617);
					selectStatement731=selectStatement();
					state._fsp--;

					adaptor.addChild(root_0, selectStatement731.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;
	}