Add complex query support for samples

Change-Id: I88c4eb6fa32514100187dbbca9777c7a5974fac6
Merge "Add complex query support for samples"