chaijunjie0101 commented on code in PR #2079: URL: https://github.com/apache/phoenix/pull/2079#discussion_r1998098640
########## phoenix-core-client/src/main/java/org/apache/phoenix/jdbc/PhoenixStatement.java: ########## @@ -2614,6 +2614,15 @@ public QueryPlan getQueryPlan() { @Override public ResultSet getResultSet() throws SQLException { ResultSet rs = getLastResultSet(); + if (!isClosed && rs == null && lastQueryPlan != null) { Review Comment: yeah, i test on my clustrer, after this pacth, it worked fine.. The root cause is in the compilePlan method of ExecutableShowCreateTable, it create a new statement to create QueryPlan, so the statement of the queryPlan's context is not same object with the origin statement.... statement(origin show create table statement)-->it's queryPlan compile from a new statement(Select from catalog table) -->so will just setLastResultSet for the new statement-->the origin statement's lastResultSet is null... see this code: https://github.com/apache/phoenix/blob/2f392b8399d4541a76dbe35bb94facb7b48643e4/phoenix-core-client/src/main/java/org/apache/phoenix/jdbc/PhoenixStatement.java#L1569 the ExecutableShowCreateTable will create a PreparedStatement(ExecutableSelectStatement) instead of it... then the queryPlan will create context from the inner statement... see this code: https://github.com/apache/phoenix/blob/2f392b8399d4541a76dbe35bb94facb7b48643e4/phoenix-core-client/src/main/java/org/apache/phoenix/jdbc/PhoenixStatement.java#L838 and https://github.com/apache/phoenix/blob/2f392b8399d4541a76dbe35bb94facb7b48643e4/phoenix-core-client/src/main/java/org/apache/phoenix/compile/QueryCompiler.java#L281 so i find ExecutableShowCreateTable/ExecutableShowSchemasStatement is different with other statement... so I add .setLastResultSet outside of newResultSet(), it work fine... as you said, for other statement, will set twice...,but for showCreateTable, it will be once...but all the same object... -- 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. To unsubscribe, e-mail: issues-unsubscr...@phoenix.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org