Skip to content

Commit

Permalink
code optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
aiceflower committed Dec 17, 2024
1 parent 73723ed commit 2f7aff3
Showing 1 changed file with 28 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -166,36 +166,36 @@ class HiveEngineConcurrentConnExecutor(
val proc = CommandProcessorFactory.get(tokens, hiveConf)
LOG.debug("ugi is " + ugi.getUserName)
ugi.doAs(new PrivilegedExceptionAction[ExecuteResponse]() {
override def run(): ExecuteResponse = {
proc match {
case any if HiveDriverProxy.isDriver(any) =>
logger.info(s"driver is $any")

val driver = new HiveDriverProxy(any)
if (StringUtils.isNotBlank(taskId)) {
driverCache.put(taskId, driver)
}
executeHQL(
engineExecutorContext.getJobId.get,
engineExecutorContext,
realCode,
driver
)
case _ =>
val resp = proc.run(realCode.substring(tokens(0).length).trim)
val result = new String(baos.toByteArray)
logger.info("RESULT => {}", result)
engineExecutorContext.appendStdout(result)
baos.reset()
if (resp.getResponseCode != 0) {
onComplete()
throw resp.getException
}
override def run(): ExecuteResponse = {
proc match {
case any if HiveDriverProxy.isDriver(any) =>
logger.info(s"driver is $any")

val driver = new HiveDriverProxy(any)
if (StringUtils.isNotBlank(taskId)) {
driverCache.put(taskId, driver)
}
executeHQL(
engineExecutorContext.getJobId.get,
engineExecutorContext,
realCode,
driver
)
case _ =>
val resp = proc.run(realCode.substring(tokens(0).length).trim)
val result = new String(baos.toByteArray)
logger.info("RESULT => {}", result)
engineExecutorContext.appendStdout(result)
baos.reset()
if (resp.getResponseCode != 0) {
onComplete()
SuccessExecuteResponse()
}
throw resp.getException
}
onComplete()
SuccessExecuteResponse()
}
})
}
})
}
}
val future: Future[ExecuteResponse] = backgroundOperationPool.submit(operation)
Expand Down

0 comments on commit 2f7aff3

Please sign in to comment.