Currently, CreateTableNode and InsertNode are just intermediate representations. They are rewritten to StoreTableNode. But, StoreTableNode does not contain some necessary fields, such as output table, target table, target columns, overwrite flag and create table flag. So far, these fields are kept in QueryContext.
This implementation causes unnecessary and complex rewrite of DistributedQueryHookManager. As a result, it is hard to maintain and manage CREATE/INSERT plans.
The main objective of this issue is to improve LogicalPlanner to use CreateTableNode and InsertNode throughout the planning phase and eliminate complex rewrite in DistributedQueryHookManager.