直接看代码
public void impalaQuery() throws Exception {
TSocket transport = new TSocket("10.17.36.93", 21000);
transport.open();
TProtocol protocol = new TBinaryProtocol(transport);
// connect to client
ImpalaService.Client client = new ImpalaService.Client(protocol);
client.PingImpalaService();
// send the query
Query query = new Query();
query.setQuery("SELECT * FROM wux_test_10000 limit 1000");
// fetch the results
client.send_query(query);
queryHandle = client.recv_query();
String log = client.get_log(queryHandle.getLog_context());
System.out.println(log);
//查询结果
Results results = client.fetch(queryHandle, false, 5);
List<String> data = results.data;
for (int i = 0; i < data.size(); i++) {
System.out.println(data.get(i));
}
}
public void impalaGetLog() throws Exception {
System.out.println("获取日志"