Source:
<code>public void execute(JobExecutionContext context) throws JobExecutionException { start = new Date(); JobDataMap dataMap = context.getJobDetail().getJobDataMap(); String query = dataMap.getString("query"); String conf = dataMap.getString("conf"); String scheduleid = dataMap.getString("scheduleid"); String session_db = dataMap.getString("session_db"); List<String> resource_path = gson.fromJson(dataMap.getString("resource_path"), List.class); GrillConf grillConf = gson.fromJson(conf, GrillConf.class); try { sessionHandle = <START> getSessionSvc().openSession("", "", new HashMap<String, String>()); <END> } catch (GrillException e) { LOG.error("Exception occured while creating session for schedule query.", e); } for (String path : resource_path) { getSessionSvc().addResource(sessionHandle, "jar/file", path); } QueryStatus.Status status = Status.NEW; try { queryHandle = getQuerySvc().executeAsync(sessionHandle, query, grillConf); while (status != Status.SUCCESSFUL && status != Status.CANCELED && status != Status.CLOSED && status != Status.FAILED) { try { Thread.sleep(SLEEP_DURATION); } catch (InterruptedException e) { e.printStackTrace(); } status = getQuerySvc().getQuery(sessionHandle, queryHandle).getStatus() .getStatus(); } end = new Date(); updateRunStatus(scheduleid, queryHandle, sessionHandle, status, start, end, getQuerySvc().getQuery(sessionHandle, queryHandle) .getResultSetPath()); } catch (GrillException e) { LOG.error("Exception occured while submitting schedule query.", e); } }</code><technical_language>Pass session conf while opening session</technical_language>

Target:
public void execute(JobExecutionContext context) throws JobExecutionException { start = new Date(); JobDataMap dataMap = context.getJobDetail().getJobDataMap(); String query = dataMap.getString("query"); String scheduleid = dataMap.getString("scheduleid"); String session_db = dataMap.getString("session_db"); String qConf = dataMap.getString("query_conf"); GrillConf queryConf = gson.fromJson(qConf, GrillConf.class); String schConf = dataMap.getString("schedule_conf"); GrillConf scheduleConf = gson.fromJson(schConf, GrillConf.class); TypeToken<List<String>> list = new TypeToken<List<String>>() { }; List<String> resource_path = gson.fromJson(dataMap.getString("resource_path"), list.getType()); TypeToken<HashMap<String, String>> stringStringMap = new TypeToken<HashMap<String, String>>() { }; HashMap<String, String> sessionConf = gson.fromJson(dataMap.getString("session_conf"), stringStringMap.getType()); try { sessionHandle = sessionService.openSession("", "", sessionConf); metastoreService.setCurrentDatabase(sessionHandle, session_db); } catch (GrillException e) { LOG.error("Exception occured while creating session for schedule query.", e); } for (String path : resource_path) { sessionService.addResource(sessionHandle, "jar/file", path); } QueryStatus status = new QueryStatus(0, Status.NEW, "", false, "", ""); try { queryHandle = executionService.executeAsync(sessionHandle, query, queryConf, "Schedule Query: " + scheduleid); while (status.isFinished()) { try { Thread.sleep(Integer.parseInt(scheduleConf.getProperties().get( "grill.scheduler.poll.interval"))); } catch (InterruptedException e) { LOG.error("Error while polling for status.", e); } status = executionService.getQuery(sessionHandle, queryHandle).getStatus(); } end = new Date(); updateRunInfo(scheduleid, queryHandle, sessionHandle, status.getStatus(), start, end, executionService.getQuery(sessionHandle, queryHandle) .getResultSetPath()); } catch (GrillException e) { LOG.error("Exception occured while submitting schedule query.", e); } }