PHOENIX-1001 Using NEXT VALUE FOR 'sequence' as an input to a function cause a NPE (Thomas D'Silva)
Merge branch '4.0' of https://git-wip-us.apache.org/repos/asf/phoenix into 4.0