[misc] add some more comments and fix bugs in the sql view