Fixing a destructor bug

Some query nodes copy schemas from its children and some just refer to
them. When the destructor executes, those shallow copies will be deleted
twice. This leads to very hard-to-find bugs, where the first queries can
execute nicely but subsequent ones failed.
Set outputs

Output methods now support
 * Output to screen (stdout)
 * Output to file
 * No output (show query plan only)