hive Cli 启动
[toc]
CliDriver
作用: 执行命令:hive时 实际上运行的类是org.apache.hadoop.hive.cli.CliDriver.java 。
入口
public static void main(String[] args) throws Exception {
int ret = new CliDriver().run(args);
System.exit(ret);
}
public int run(String[] args) throws Exception {
//解析命令行参数, 把hiveconf 的参数设置到环境变量,吧define,和hivevar等参数添加到一个map中
OptionsProcessor oproc = new OptionsProcessor();
if (!oproc.process_stage1(args)) {
return 1;
}
//初始化Log4j日志组件
// NOTE: It is critical to do this here so that log4j is reinitialized
// before any of the other core hive classes are loaded
boolean logInitFailed = false;
String logInitDetailMessage;
try {
logInitDetailMessage = LogUtils.initHiveLog4j();
} catch