Other way to execute query by Calling REST API in Apache Drill
public class RequestQuery {
private String queryType; private String query; public String getQueryType() { return queryType; } public void setQueryType(String queryType) { this.queryType = queryType; } public String getQuery() { return query; } public void setQuery(String query) { this.query = query; }
}
import javax.ws.rs.client.Client; import javax.ws.rs.client.ClientBuilder; import javax.ws.rs.client.Entity; import javax.ws.rs.client.WebTarget; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.ramyam.eis.apache.drill.api.model.RequestQuery; public class RestAPI { private static Log logger = LogFactory.getLog(RestAPI.class); public static void main(String[] args) { getQueryResponce(); } private static void getQueryResponce(){ Client client = null; WebTarget target = null; try { logger.info("---------Started execution-----------"); RequestQuery query = new RequestQuery(); query.setQueryType("SQL");
source share