Copilot commented on code in PR #2582:
URL: https://github.com/apache/phoenix/pull/2582#discussion_r3642194941
##########
phoenix-core/src/test/java/org/apache/phoenix/query/explain/ExplainPlanTest.java:
##########
@@ -1204,16 +1204,19 @@ public void testVerboseClientFilterHavingFanout()
throws Exception {
/**
* When a top-level AND is only partially tagged, renderVerboseFilters
collapses to a single
- * combined line. That line must still union the origins recorded on the
tagged conjunct(s) rather
+ * combined line. That line must still union the origins recorded on the
tagged conjuncts rather
* than reading only the parent expression. Normal WHERE/HAVING compilation
always tags every
- * conjunct, so this partial-tag state is reachable only when identity is
lost during expression
- * rewriting.
+ * conjunct, so this state is reachable only when identity is lost during
expression rewriting.
*/
@Test
public void testVerboseCombinedFilterUnionsConjunctOrigins() throws
Exception {
try (Connection conn = DriverManager.getConnection(getUrl(),
defaultProps())) {
- QueryPlan plan = conn.prepareStatement("SELECT * FROM atable")
- .unwrap(PhoenixPreparedStatement.class).optimizeQuery();
+ PhoenixPreparedStatement pstmt =
+ conn.prepareStatement("SELECT * FROM
atable").unwrap(PhoenixPreparedStatement.class);
+ // Compile time diagnostic recording is normally only enabled for
EXPLAIN, so enable it
+ // explicitly on this statement.
+
pstmt.unwrap(org.apache.phoenix.jdbc.PhoenixStatement.class).setCollectDiagnostics(true);
+ QueryPlan plan = pstmt.optimizeQuery();
Review Comment:
The prepared statement in this test isn’t closed, and collectDiagnostics is
set to true without being restored. Using try-with-resources and a try/finally
to scope the flag avoids leaking JDBC resources and prevents diagnostic state
from persisting if the statement is reused within the test run.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]