Hi all, I'd like to debug hive program, and want to use the raw java api of Hive. I know that there's thrift api for hive, but it's not convenient for me especially for debugging and unit test. And I notice that the unit test (TestExecDriver) in hive use shim (call ExecDriver in another process) which is also not convenient for testing, I did some hacking and finally the following code can execute successfully ( I create the table before the execution). so I'd like to suggest maybe Hive should provide a more simple java api for user(wrapper based on the Hive internal Java api) and allow user to choose not using shim but directly using ExecDriver.
///////////////////////// code snippet //////////////////////////////////////////////////////////////////////// HiveConf conf = new HiveConf(ExecDriver.class); Driver driver = new Driver(conf); driver.compile("select name from test group by name"); QueryPlan plan = Utilities.deserializeQueryPlan(new FileInputStream(driver.ctx .getLocalScratchDir().substring(5) + File.separator + "queryplan.xml"), conf); Task task=plan.getRootTasks().get(0); ExecDriver eDriver = new ExecDriver((MapredWork)task.getWork(), new JobConf(), false); eDriver.execute(new DriverContext()); -- Best Regards Jeff Zhang