You can create a bug by clicking the “create” button on Apache JIRA: https://issues.apache.org/jira/browse/CALCITE.
A test case would be a piece of code that anyone could run to reproduce the problem. Maybe you could add a method to RelBuilderTest similar to testRun(). Julian > On May 19, 2017, at 2:40 PM, JD Zheng <[email protected]> wrote: > > Hi, Julian, > > Thank you for reply. I am new to the open source community. What do you > mean by "log a bug, with a test case"? > > -JD > > On May 19, 2017, at 11:52 AM, Julian Hyde <[email protected]> wrote: > > Please log a bug, with a test case. > > Maybe we use some callback to create a connection. And maybe if you are > using an anonymous class it causes the connection to be garbage-collected > sooner. > > Julian > > > On May 19, 2017, at 1:24 PM, Laptop huawei <[email protected]> wrote: > > Hi, > > I am using RelRunners to execute pre-built relnode tree. It works perfectly > when I put the following code in the junit class: > > protected String execute(RelNode rel) { > try (final PreparedStatement preparedStatement = RelRunners.run(rel)) > { > final ResultSet resultSet = preparedStatement.executeQuery(); > return printResult(resultSet, true); > } catch (SQLException e) { > throw new RuntimeException(e); > } > } > > However,if I put these code inside a src class, the returned resultSet is > closed. > > More interestingly, if I expand the RelRunners.run() in the method like > this: > > public static ResultSet execute(RelNode rel) { > /* > try (final PreparedStatement preparedStatement = RelRunners.run(rel)) > { > return preparedStatement.executeQuery(); > } catch (SQLException e) { > throw new AQLExecuteErrorException(e); > } > */ > try (Connection connection = > DriverManager.getConnection("jdbc:calcite:")) > { > final RelRunner runner = connection.unwrap(RelRunner.class); > PreparedStatement preparedStatement = runner.prepare(rel); > return preparedStatement.executeQuery(); > } catch (SQLException e) { > throw new AQLExecuteErrorException(e); > } > } > > It works again. > > Has anyone seen this behavior before or has any insights? Thanks, > > -JD
