How to parse and classify N1QL queries as read or write in Java SDK

You can use RBAC permissions to control this. N1QL will not inform the query is readonly or write. First it needs to parse the query to do. If not prepare statement it must execute too.

Mostly SELECT statements are readonly, all other DDLs,DMLs are write

If you need that early try AST tree generation described by @eben AST Generator for N1QL - #9 by eben make your own decision.