union query fix and a broken test
add sanity unit tests
add header
Merge pull request #545 from metamx/union-query-fix

Union query fix