getStatement() should get you the SQL2 statement, not the native query string, right? if i interpret that correctly then this looks like a bug somewhere in the querybuilder of phpcr-utils.

but indeed the exact SQL2 string is probably implementation specific (like quoting, unnecessary parenthesis around expressions or not...) maybe checking the PHPCR QOM tree would make more sense indeed, though its more work.