Two tables associated with the query bug


#1

I have two tables associated query, but can not query, reported the wrong message, here is my java code, please copy my code for testing, thank you very much!
================ ========= =============== =============
package com.liu.mapd;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class MapDTest {

static final String JDBC_DRIVER = "com.mapd.jdbc.MapDDriver";
static final String DB_URL = "jdbc:mapd:192.168.100.133:9091:mapd";
static final String USER = "mapd";
static final String PASS = "HyperInteractive";

public static void main(String[] args) throws SQLException {
	Connection conn = null;
      Statement stmt = null;
      try {
        Class.forName(JDBC_DRIVER);

        conn = DriverManager.getConnection(DB_URL, USER, PASS);

        stmt = conn.createStatement();
        String sql = "CREATE table mytest_a (gmsfhm varchar(255))";
        stmt.executeUpdate(sql);
        sql = "CREATE table mytest_b (sfzhm varchar(255))";
        stmt.executeUpdate(sql);
        sql = "insert into mytest_a values('aaa')";
        stmt.executeUpdate(sql);
        sql = "insert into mytest_a values('bbb')";
        stmt.executeUpdate(sql);
        sql = "insert into mytest_b values('bbb')";
        stmt.executeUpdate(sql);
        sql = "select * from mytest_a a ,mytest_b b where  a.gmsfhm = b.sfzhm";
        ResultSet rs = stmt.executeQuery(sql);
        while (rs.next()) {
          String gmsfhm = rs.getString("gmsfhm");
          System.out.println("gmsfhm: " + gmsfhm);
        }

        rs.close();
        stmt.close();
        conn.close();
      } catch (SQLException se) {
        //Handle errors for JDBC
        se.printStackTrace();
      } catch (Exception e) {
        e.printStackTrace();
        if (stmt != null)
            stmt.close();
        if (conn != null)
            conn.close();
       }
}

}


#2

Hi,

Thanks for you detailed report. A crash is occurring on the server.

There is nothing wrong with your code, the issue is on MapD side. I have created an issue to track.

https://github.com/mapd/mapd-core/issues/131

regards


#3

Does the next version of Mapd solve this problem?


#4

Hi @liermao12, the issue was just fixed in master and will be in the next release. If you are building from source you can get the fix now.

Thanks for bringing this to our attention.