[ 
https://issues.apache.org/jira/browse/CALCITE-2955?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

leesf updated CALCITE-2955:
---------------------------
    Summary: SQL queries after first query in same statement have no results 
returned  (was: SQL queries after first query in same statement have no results)

> SQL queries after first query in same statement have no results returned
> ------------------------------------------------------------------------
>
>                 Key: CALCITE-2955
>                 URL: https://issues.apache.org/jira/browse/CALCITE-2955
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.18.0
>            Reporter: leesf
>            Assignee: leesf
>            Priority: Major
>             Fix For: 1.19.0
>
>
> When integrate avatica with calcite, when using same statement, except for 
> the first sql query, other sql queries have no result to return.
> The following example
> {code:java}
> private static void testMultiQueryWithSameStatement(Connection connection) 
> throws Exception {
> // get avatica remote connection
> Connection connection = getRemoteConnection();
> String sql = "select * from mysql.jobs";
> ResultSet rs;
> Statement st;
> st = connection.createStatement();
> System.out.println("============================first 
> query=====================================");
> rs = st.executeQuery(sql);
> ResultSetMetaData rsmd = rs.getMetaData();
> int columnNum = rsmd.getColumnCount();
> for (int i = 1; i <= columnNum; i++) {
> System.out.print(rsmd.getColumnName(i) + "\t");
> }
> System.out.println();
> while (rs.next()) {
> for (int i = 1; i <= columnNum; i++) {
> System.out.print(rs.getString(i) + "\t");
> }
> System.out.println();
> }
> System.out.println("============================second 
> query=====================================");
> rs = st.executeQuery(sql);
> while (rs.next()) {
> for (int i = 1; i <= columnNum; i++) {
> System.out.print(rs.getString(i) + "\t");
> }
> System.out.println();
> }
> }
> {code}
> The result would be like this. The first query has result while the second 
> query has no result returned.
> {code:java}
> ============================first query=====================================
> id name
> 1 abc
> ============================second query=====================================
> {code}
> What's more, use avatica alone and don't integrate with calcite, then query 
> sql twice will return normal results.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to