implemented insert by query analysis
Merge pull request #863 from crate/m/insert-by-query-analysis

M/insert by query analysis