zzcclp commented on a change in pull request #1532:
URL: https://github.com/apache/kylin/pull/1532#discussion_r551094391



##########
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());

Review comment:
       Add these code after creating 'PreparedContext' function:
   `
   } catch (NoSuchElementException noElementException) {
                           borrowPrepareContext = false;
                           preparedContext = 
createPreparedContext(sqlRequest.getProject(), sqlRequest.getSql());
                           preparedContext.olapRel = 
QueryContextFacade.current().getOlapRel();
                           preparedContext.resultType = 
(QueryContextFacade.current().getResultType());
                       }
   `




----------------------------------------------------------------
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]


Reply via email to