zzcclp commented on a change in pull request #1532:
URL: https://github.com/apache/kylin/pull/1532#discussion_r551095285
##########
File path:
server-base/src/main/java/org/apache/kylin/rest/service/QueryService.java
##########
@@ -708,6 +708,22 @@ private SQLResponse queryWithSqlMassage(SQLRequest
sqlRequest) throws Exception
borrowPrepareContext = false;
preparedContext =
createPreparedContext(sqlRequest.getProject(), sqlRequest.getSql());
}
+
+ // when SparkEngine enabled, Execution Plan was created
from RelNode directly, RelNode should be cached
+ if (getConfig().isSparkEngineEnabled()) {
+ // preparedContext initialized by current thread, put
relNode into cache
+ if (preparedContext.olapRel == null) {
+ preparedContext.olapRel =
QueryContextFacade.current().getOlapRel();
+ preparedContext.resultType =
(QueryContextFacade.current().getResultType());
+ } else if (QueryContextFacade.current().getOlapRel()
== null) {
+ //set cached RelNode and ResultType in current
PreparedContext
+
QueryContextFacade.current().setOlapRel(preparedContext.olapRel);
+
QueryContextFacade.current().setResultType(preparedContext.resultType);
Review comment:
Add these code after borrowing 'PreparedContext' from
'preparedContextPool':
```
try {
preparedContext =
preparedContextPool.borrowObject(preparedContextKey);
borrowPrepareContext = true;
QueryContextFacade.current().setOlapRel(preparedContext.olapRel);
QueryContextFacade.current().setResultType(preparedContext.resultType);
} catch (NoSuchElementException noElementException) {
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]