this depends on the type of your job. Is it a batch or a streaming job?
Some queries could be ported to Flink's SQL API as suggested by the link that Hequn posted. In that case, the query would be executed in Flink.
Other options are to use a JDBC InputFormat or persisting the result to files and ingesting it with a monitoring file sink.
These options would mean to run the query in Hive/Presto and just ingesting the result (via JDBC or files).
It depends on the details, which solution works best for you.