hive-cdh5.7以后版本,程序使用hive接口进行查询,如何获取查询日志?
hive CHD 5.7版本前使用:
public String getQueryLog(TOperationHandle tOperationHandle) throws Exception {
//TCLIService.Client client;
if(tOperationHandle!=null){
TGetLogReq tGetLogReq = new TGetLogReq(tOperationHandle);
TGetLogResp logResp = client.GetLog(tGetLogReq);
log = logResp.getLog();
}
return log;
}
使用hive-service-0.12.0-cdh5.01.jar中的类
但是CDH5.7后,hive-service中的TCLIService.Client 中不在提供GetLog方法了,不知道有什么办法可以获取吗 ?
我查看了hive-exec-1.1.0-cdh5.12.0-core.jar中,org.apache.hive.service.cli.thrift;-ThriftCLIService
/**
*
* @param client
* 连接thriftserver的客户端
* @param operationHandle
* 当前操作对应句柄
* @param Orientation
* 获取结果的起始位置 FetchOrientation.First 从结果第一行开始取2
* @param fetchType
* 获取结果的类型 FetchType.LOG 获取此操作对应日志
* @param maxRows
* 此次获取的最大行数
* @return
*/
public static TRowSet fetchResult(TCLIService.Client client, TOperationHandle operationHandle,
FetchOrientation Orientation, FetchType fetchType, long maxRows) {
TFetchResultsReq fetchReq = new TFetchResultsReq();
fetchReq.setFetchType(fetchType.toTFetchType());
fetchReq.setMaxRows(maxRows);
fetchReq.setOperationHandle(operationHandle);
fetchReq.setOrientation(Orientation.toTFetchOrientation());
TRowSet rowSetLog = null;
try {
rowSetLog = client.FetchResults(fetchReq).getResults();
} catch (TException e) {
log.info("Exception:" + e.getStackTrace());
e.printStackTrace();
}
return rowSetLog;
}
好像可以,不知道有没有哪位大神,有弄过过的,分享一下,谢谢
public String getQueryLog(TOperationHandle tOperationHandle) throws Exception {
//TCLIService.Client client;
if(tOperationHandle!=null){
TGetLogReq tGetLogReq = new TGetLogReq(tOperationHandle);
TGetLogResp logResp = client.GetLog(tGetLogReq);
log = logResp.getLog();
}
return log;
}
使用hive-service-0.12.0-cdh5.01.jar中的类
但是CDH5.7后,hive-service中的TCLIService.Client 中不在提供GetLog方法了,不知道有什么办法可以获取吗 ?
我查看了hive-exec-1.1.0-cdh5.12.0-core.jar中,org.apache.hive.service.cli.thrift;-ThriftCLIService
/**
*
* @param client
* 连接thriftserver的客户端
* @param operationHandle
* 当前操作对应句柄
* @param Orientation
* 获取结果的起始位置 FetchOrientation.First 从结果第一行开始取2
* @param fetchType
* 获取结果的类型 FetchType.LOG 获取此操作对应日志
* @param maxRows
* 此次获取的最大行数
* @return
*/
public static TRowSet fetchResult(TCLIService.Client client, TOperationHandle operationHandle,
FetchOrientation Orientation, FetchType fetchType, long maxRows) {
TFetchResultsReq fetchReq = new TFetchResultsReq();
fetchReq.setFetchType(fetchType.toTFetchType());
fetchReq.setMaxRows(maxRows);
fetchReq.setOperationHandle(operationHandle);
fetchReq.setOrientation(Orientation.toTFetchOrientation());
TRowSet rowSetLog = null;
try {
rowSetLog = client.FetchResults(fetchReq).getResults();
} catch (TException e) {
log.info("Exception:" + e.getStackTrace());
e.printStackTrace();
}
return rowSetLog;
}
好像可以,不知道有没有哪位大神,有弄过过的,分享一下,谢谢
...全文
相关推荐
hive-1.1.0-cdh5.7.0.tar.gz.rar
hive-1.1.0-cdh5.7.0.tar.gz。下载前请注意,你的Hadoop版本号,要和这个版本号对上,才能用。
CDH550@hive 使用及操作说明
cdh5.5.0下的hive的使用和操作介绍。hive作为数据SQL解析引擎,分析、处理数据;Hadoop提供的分布式文件系统(HDFS)作为数据文件的存储介质;Zookeeper作为分布式协调服务器存在,用于管理集群中各节点状态
hive-1.1.0-cdh5.9.3
cdh5.9.3配套hive。cdh5.9.3配套hive。cdh5.9.3配套hive。
hue-cdh版本
这个是hue-3.7.0-cdh5.3.6版本压缩包.
CDH5在线安装包
CDH5在线安装包


