SR大数据量查询结果集拉取问题(JDBC方式)

使用mysql客户端拉取大数据量,由于客户端缓存数据导致oom

  1. 目前测试一下使用stream ResultSet是可以的 但是效率有点低。https://dev.mysql.com/doc/connector-j/en/connector-j-reference-implementation-notes.html
  2. 使用jdbc:mysql://xxxx:9030?defaultFetchSize=1000&useCursorFetch=true的方式会报错
    java.sql.SQLException: java.lang.ArrayIndexOutOfBoundsException: Index 4 out of bounds for length 1
    at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:130)
    at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:98)
    at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:90)
    at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:64)
    at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:74)
    at com.mysql.cj.jdbc.ServerPreparedStatement.executeInternal(ServerPreparedStatement.java:362)
    at com.mysql.cj.jdbc.ClientPreparedStatement.execute(ClientPreparedStatement.java:354)
    at com.mysql.cj.jdbc.StatementImpl.createResultSetUsingServerFetch(StatementImpl.java:570)
    at com.mysql.cj.jdbc.StatementImpl.executeQuery(StatementImpl.java:1150)
    at org.lilith.bigtable.localtest.MysqlTest.lambda$main$1(MysqlTest.java:62)
    at java.base/java.lang.Thread.run(Thread.java:842)
    Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 4 out of bounds for length 1
    at com.mysql.cj.protocol.a.NativePacketPayload.readInteger(NativePacketPayload.java:399)
    at com.mysql.cj.protocol.a.ColumnDefinitionReader.unpackField(ColumnDefinitionReader.java:89)
    at com.mysql.cj.protocol.a.ColumnDefinitionReader.read(ColumnDefinitionReader.java:67)
    at com.mysql.cj.protocol.a.ColumnDefinitionReader.read(ColumnDefinitionReader.java:40)
    at com.mysql.cj.protocol.a.NativeProtocol.read(NativeProtocol.java:1648)
    at com.mysql.cj.protocol.a.BinaryResultsetReader.read(BinaryResultsetReader.java:69)
    at com.mysql.cj.protocol.a.BinaryResultsetReader.read(BinaryResultsetReader.java:50)
    at com.mysql.cj.protocol.a.NativeProtocol.read(NativeProtocol.java:1661)
    at com.mysql.cj.protocol.a.NativeProtocol.readAllResults(NativeProtocol.java:1713)
    at com.mysql.cj.ServerPreparedQuery.readExecuteResult(ServerPreparedQuery.java:328)
    at com.mysql.cj.ServerPreparedQuery.serverExecute(ServerPreparedQuery.java:198)
    at com.mysql.cj.jdbc.ServerPreparedStatement.serverExecute(ServerPreparedStatement.java:553)
    at com.mysql.cj.jdbc.ServerPreparedStatement.executeInternal(ServerPreparedStatement.java:339)
    … 5 more