Adds some nil checks in lua distinct method.

Conflicts:
	query/lua_header.go
Merge pull request #183 from Shopify/fix_lua_distinct_with_nils_predupsort

[Pre-dupsort] Fix lua distinct with nils