You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Zoltan Haindrich (JIRA)" <ji...@apache.org> on 2019/04/05 09:19:00 UTC

[jira] [Updated] (CALCITE-2955) SQL queries after first query in same statement have no results returned

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

Zoltan Haindrich updated CALCITE-2955:
--------------------------------------
    Fix Version/s:     (was: 1.19.0)

> 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
>              Labels: pull-request-available
>          Time Spent: 50m
>  Remaining Estimate: 0h
>
> 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)