@Override
	public long[] run(String query) {
		FUNCTION_NAME = "PRM";
		query = query.toUpperCase();
		boolean state = true;

		SQLParser parser = new SQLParser();
		state &= parser.parse(query + ".txt"); // file name
		wrieteGlobalInfoToHDFS(parser);
		
		long[] time = new long[4];
		long startTime = new Date().getTime();
		if (state) {

			if (state) { // init conf
				Configuration conf = new Configuration();
				state &= doFirstPhase(query, conf, PATH_OUTPUT_FIRST, parser.getDimensionTables());
				time[0] = new Date().getTime() - startTime;
				startTime = new Date().getTime();			
			}
			if (state) { // init conf
				Configuration conf = new Configuration();
				state &= doSecondPhase(query, conf, PATH_OUTPUT_SECOND, parser.getDimensionTables(), parser.getFilterTables(),
						(parser.getTables().length - 1)*reduceScale);
				time[1] = new Date().getTime() - startTime;
				startTime = new Date().getTime();			
			}
			if (state) {
				Configuration conf = new Configuration();
				state &= doThirdPhase(query.toUpperCase(), conf, PATH_OUTPUT_THIRD);
				time[2] = new Date().getTime() - startTime;
				startTime = new Date().getTime();			
			}
			if (state) {
				Configuration conf = new Configuration();
				state &= doForthPhase(query.toUpperCase(), conf, PATH_OUTPUT_FINAL);
				time[3] = new Date().getTime() - startTime;
			}
		}
		return time;
	}