Test for streaming
Copy optimization from CSV functions

 * Add rule to rewrite to specialized function
 * Inline decoding functions
Move common functionality and helpers to the end of module