@SuppressWarnings("unchecked")
    public LinkedHashMap<Integer,List<Tuple>> processQuery() throws ParseException{

        PlainSelect plain_select=(PlainSelect)select.getSelectBody();	
        SubSelect sub_select=null;
        
        FromItem from=plain_select.getFromItem();

        TablesNamesFinder t=new TablesNamesFinder();
        from.accept(t);

        
        
        tables=t.getTableList(select);
        sub_select=t.getSubSelect();
        List<SelectExpressionItem>selectList = new ArrayList<SelectExpressionItem>();
        selectList = plain_select.getSelectItems();
        new OutputSchema(selectList).createOutputSchema();

     
        
        
        if(sub_select!=null){
        	 Select s=new Select();
             s.setSelectBody(sub_select.getSelectBody());
        	outstream=new EvaluateStatement(s).processQuery();
        	tables=new ArrayList<Table>();
            Main.ct.add(OutputSchema.os);
       	
        }
        
        if(tables.size()==1){
        outstream=new OperatorFrom(tables,plain_select).caculateFrom();
        }else if(tables.size()>1){
        	outstream=new MultipleTable(tables,plain_select).caculateMultipleFrom();
        }
     
         
        groupBy=plain_select.getGroupByColumnReferences();

        if(groupBy!=null){
            outstream=new OperatorGroupBy(outstream,groupBy).calculateGroupBy();
        }
              
     

        int count=0;
        LinkedHashMap<Integer,List<Tuple>>new_outstream=new LinkedHashMap<Integer,List<Tuple>>();
        if(groupBy!=null){
        	
            for(Integer i : OperatorGroupBy.sel_op.keySet()){
                LinkedHashMap<Integer,List<Tuple>> instream = OperatorGroupBy.sel_op.get(i);
                new_outstream.put(count++,new OperatorProject(instream,plain_select).calculateGroupByProjection());
            }
            outstream=new_outstream;   
        }else{

            outstream=new OperatorProject(outstream,plain_select).calculateProjection();
        }
        

        orderby=plain_select.getOrderByElements();
     
        if(orderby!=null){
        	   Collections.reverse(orderby);
        	  
            for(OrderByElement o : orderby){
            	
                outstream=new OperatorOrderBy(outstream,o).calculateOrderBy();
            }
        }

 

        return outstream;
    }