Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-5462

unknown type -1 and unknown type -4 for mysql json and blob columns

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • avatica-1.22.0
    • None
    • avatica
    • None

    Description

      The following code throws SQLException: Error while executing SQL "SELECT * FROM test": unknown type -1,when the table contains columns of type json or blob.

      Client side:

      public static void main(String[] args) throws ClassNotFoundException {
          Class.forName("org.apache.calcite.avatica.remote.Driver");
          Properties prop = new Properties();
          prop.put("serialization", "protobuf");
          try(Connection conn = DriverManager.getConnection(
              "jdbc:avatica:remote:url=http://localhost:5888", prop);
              Statement stmt = conn.createStatement();
              ResultSet rs = stmt.executeQuery("SELECT * FROM test")) {
              while (rs.next()) {
                  log.info("{}, {}", rs.getObject(1),
                      rs.getObject(2));
              }
          } catch (SQLException e) {
              throw new RuntimeException(e);
          }
      } 

      Server side:

      public static void main(String[] args) throws SQLException {
          String url = "jdbc:mysql://localhost:3306/db1";
          JdbcMeta meta = new JdbcMeta(url, "root", "root");
          LocalService service = new LocalService(meta);
          HttpServer server = new HttpServer.Builder<>()
              .withPort(5888)
              .withHandler(service, Driver.Serialization.PROTOBUF)
              .build();
          server.start();
          new Thread(() -> {
              try {
                  server.join();
              } catch (InterruptedException e) {
                  e.printStackTrace();
              }
          }).start();
      } 

      Attachments

        Activity

          People

            Unassigned Unassigned
            xinqiu asdfgh19
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: