JNSimba commented on code in PR #305:
URL: 
https://github.com/apache/doris-spark-connector/pull/305#discussion_r2030406249


##########
spark-doris-connector/spark-doris-connector-base/src/main/java/org/apache/doris/spark/client/write/AbstractStreamLoadProcessor.java:
##########
@@ -402,15 +402,40 @@ private Future<CloseableHttpResponse> 
buildReqAndExec(String host, Integer port,
             entity = new GzipCompressingEntity(entity);
         }
         httpPut.setEntity(entity);
-
-        logger.info("table {}.{} stream load started for {} on host {}:{}", 
database, table, currentLabel != null ? currentLabel : "group commit", host, 
port);
-        return getExecutors().submit(() -> client.execute(httpPut));
+        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(() -> {
+            CloseableHttpResponse response = client.execute(httpPut);
+            // stream load http request finished unexpectedly
+            if (!isStopped) {
+                if (response.getStatusLine().getStatusCode() != 
HttpStatus.SC_OK) {
+                    unexpectedException = new StreamLoadException(
+                            "stream load failed, status: " + 
response.getStatusLine().getStatusCode()
+                                    + ", reason: " + 
response.getStatusLine().getReasonPhrase());
+                } else {
+                    StreamLoadResponse streamLoadResponse =
+                            
MAPPER.readValue(EntityUtils.toString(response.getEntity()), 
StreamLoadResponse.class);
+                    if (!streamLoadResponse.isSuccess()) {

Review Comment:
   please add commment for stream load response



##########
spark-doris-connector/spark-doris-connector-base/src/main/java/org/apache/doris/spark/client/write/AbstractStreamLoadProcessor.java:
##########
@@ -402,15 +402,40 @@ private Future<CloseableHttpResponse> 
buildReqAndExec(String host, Integer port,
             entity = new GzipCompressingEntity(entity);
         }
         httpPut.setEntity(entity);
-
-        logger.info("table {}.{} stream load started for {} on host {}:{}", 
database, table, currentLabel != null ? currentLabel : "group commit", host, 
port);
-        return getExecutors().submit(() -> client.execute(httpPut));
+        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(() -> {
+            CloseableHttpResponse response = client.execute(httpPut);
+            // stream load http request finished unexpectedly
+            if (!isStopped) {
+                if (response.getStatusLine().getStatusCode() != 
HttpStatus.SC_OK) {
+                    unexpectedException = new StreamLoadException(
+                            "stream load failed, status: " + 
response.getStatusLine().getStatusCode()
+                                    + ", reason: " + 
response.getStatusLine().getReasonPhrase());
+                } else {
+                    StreamLoadResponse streamLoadResponse =
+                            
MAPPER.readValue(EntityUtils.toString(response.getEntity()), 
StreamLoadResponse.class);
+                    if (!streamLoadResponse.isSuccess()) {

Review Comment:
   please add log for stream load response



-- 
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

Reply via email to