Copilot commented on code in PR #305: URL: https://github.com/apache/doris-spark-connector/pull/305#discussion_r2032818591
########## spark-doris-connector/spark-doris-connector-base/src/main/java/org/apache/doris/spark/client/write/AbstractStreamLoadProcessor.java: ########## @@ -402,15 +395,38 @@ private Future<CloseableHttpResponse> buildReqAndExec(String host, Integer port, entity = new GzipCompressingEntity(entity); } httpPut.setEntity(entity); + Thread currentThread = Thread.currentThread(); - logger.info("table {}.{} stream load started for {} on host {}:{}", database, table, currentLabel != null ? currentLabel : "group commit", host, port); - return getExecutors().submit(() -> client.execute(httpPut)); + logger.info("table {}.{} stream load started for {} on host {}:{}", database, table, + currentLabel != null ? currentLabel : "group commit", host, port); + return getExecutors().submit(() -> { + CloseableHttpResponse response = client.execute(httpPut); + // stream load http request finished unexpectedly + if (response.getStatusLine().getStatusCode() != HttpStatus.SC_OK) { + unexpectedException = new StreamLoadException( + "stream load failed, status: " + response.getStatusLine().getStatusCode() + + ", reason: " + response.getStatusLine().getReasonPhrase()); + currentThread.interrupt(); Review Comment: Using currentThread.interrupt() to signal a failed stream load may inadvertently impact the processing thread; consider using a more explicit cancellation mechanism (such as canceling the Future) to avoid unintended side effects. ```suggestion future.cancel(true); ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org