@Override
	public void run(String[] args) throws SQLException, InterruptedException {
		
		if (args.length < 1) {
			System.out.println("Arguments: config-file");
			System.exit(1);
		}
		
		dbManager = createDatabaseManager(args[0]);
		dbManager.setResultShipmentBatchSize(5000);
		TableManager tableManager = new TableManager();
		Parser.parse("select 1 as bla from parser_needs_to_warm_up");
		
		System.out.println(
				"Welcome to Distributed SQL Query Engine!\n" +
				"Please enter your query, or type 'exit' when you are finished."
				);
		
		Scanner input = new Scanner(System.in);
		
		while (true) {
			System.out.print("\n>>> ");
			
			String query = input.nextLine();
			if (query.equalsIgnoreCase("exit")) break;
			else if (query.trim().isEmpty()) continue;
			else if (command(query)) continue;
			
			try {
				QueryRelation queryTree = Parser.parse(query);
				if(DEBUG) System.out.println("\nQUERY: " + queryTree);
				QueryGraph queryGraph = new QueryGraph(queryTree);
				if(DEBUG) System.out.println("\nQUERY GRAPH:\n" + queryGraph);
				
				GraphProcessor queryGraphProcessor = new GraphProcessor(tableManager, queryGraph);
				List<ExecStep> execSteps = queryGraphProcessor.processGraph();
				if(DEBUG) System.out.println("QUERY PLAN:\n" + Arrays.toString(execSteps.toArray()));
				StepExecutor queryStepExecutor = new StepExecutor(dbManager, tableManager, allNodes);
				ResultSet finalResultSet = queryStepExecutor.executeSteps(execSteps);
				System.out.println();
				TablePrinter.printTableData(System.in, System.out, finalResultSet);
				
			} catch (Exception e) {
				//e.printStackTrace();
				System.out.println(e);
			} finally {
				tableManager.cleanTempTables(dbManager, allNodes);
			}
		}
		input.close();
		dbManager.shutDown();
	}