diff --git a/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/KyuubiConnection.java b/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/KyuubiConnection.java index 4d95ee0179b..054ae4fab4d 100644 --- a/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/KyuubiConnection.java +++ b/kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/KyuubiConnection.java @@ -719,10 +719,6 @@ private void openSession() throws SQLException { } // switch the database openConf.put("use:database", connParams.getDbName()); - // set the fetchSize - openConf.put( - "set:hiveconf:hive.server2.thrift.resultset.default.fetch.size", - Integer.toString(fetchSize)); if (wmPool != null) { openConf.put("set:hivevar:wmpool", wmPool); } @@ -747,6 +743,12 @@ private void openSession() throws SQLException { clientProtocolStr, CLIENT_PROTOCOL_VERSION)); } openReq.setClient_protocol(clientProtocol); + // HIVE-14901: set the fetchSize + if (clientProtocol.compareTo(TProtocolVersion.HIVE_CLI_SERVICE_PROTOCOL_V10) >= 0) { + openConf.put( + "set:hiveconf:hive.server2.thrift.resultset.default.fetch.size", + Integer.toString(fetchSize)); + } try { openConf.put("kyuubi.client.ipAddress", InetAddress.getLocalHost().getHostAddress()); } catch (UnknownHostException e) {