@@ -94,7 +94,7 @@ public class PersistedTableManager implements IPersistedManager {
9494 private static final int BATCH_SIZE = 1000 ;
9595 private static final Random RANDOM = new SecureRandom ();
9696 private static final String ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" ;
97- private static final String COLUMN_SEPARATOR = "| " ;
97+ private static final String COLUMN_SEPARATOR = "\t " ;
9898
9999 private DatabaseDialect dialect = null ;
100100 private String tableName = "" ;
@@ -184,31 +184,40 @@ private void persistDoris(IDataSet dataSet, IDataSource datasource, String table
184184 String user = Optional .ofNullable (datasource .getUser ()).filter (u -> !u .isEmpty ())
185185 .orElse (SingletonConfig .getInstance ().getConfigValue ("KNOWAGE.DORIS.USER" ));
186186 if (user == null || user .isEmpty ()) {
187+ LOGGER .error ("Error : User doris is undefined" );
187188 throw new RuntimeException ("Error : User doris is undefined" );
188189 }
189190 String password = Optional .ofNullable (datasource .getPwd ()).filter (u -> !u .isEmpty ())
190191 .or (() -> Optional .ofNullable (SingletonConfig .getInstance ().getConfigValue ("KNOWAGE.DORIS.PASSWORD" )).filter (u -> !u .isEmpty ())).orElse ("" );
191192
192193 String endpoint = SingletonConfig .getInstance ().getConfigValue ("KNOWAGE.DORIS.ENDPOINT" );
193194 if (endpoint == null || endpoint .isEmpty ()) {
195+ LOGGER .error ("Error : Endpoint doris is undefined" );
194196 throw new RuntimeException ("Error : Endpoint doris is undefined" );
195197 }
196198 endpoint = endpoint .replace ("{table}" , tableName );
197199
198200 String basicAuth = Base64 .getEncoder ().encodeToString ((user + ":" + password ).getBytes (StandardCharsets .UTF_8 ));
199201
200- HttpClient client = HttpClient .newBuilder ().version (HttpClient .Version .HTTP_1_1 ).connectTimeout (java .time .Duration .ofSeconds (10 )).build ();
202+ HttpResponse <String > resp = null ;
203+ HttpRequest request = null ;
204+ try {
205+ HttpClient client = HttpClient .newBuilder ().version (HttpClient .Version .HTTP_1_1 ).connectTimeout (java .time .Duration .ofSeconds (10 )).build ();
201206
202- HttpRequest request = HttpRequest .newBuilder ().uri (URI .create (endpoint )).timeout (java .time .Duration .ofMinutes (10 ))
203- .header ("Authorization" , "Basic " + basicAuth ).header ("label" , label ).header ("format" , "csv" ).header ("compress_type" , "gz" )
204- .header ("column_separator" , COLUMN_SEPARATOR ).header ("Content-Type" , "text/csv; charset=UTF-8" ).expectContinue (true )
205- .PUT (HttpRequest .BodyPublishers .ofFile (gzPath ))
206- .build ();
207+ request = HttpRequest .newBuilder ().uri (URI .create (endpoint )).timeout (java .time .Duration .ofMinutes (10 ))
208+ .header ("Authorization" , "Basic " + basicAuth ).header ("label" , label ).header ("format" , "csv" ).header ("compress_type" , "gz" )
209+ .header ("column_separator" , COLUMN_SEPARATOR ).header ("Content-Type" , "text/csv; charset=UTF-8" ).expectContinue (true )
210+ .PUT (HttpRequest .BodyPublishers .ofFile (gzPath ))
211+ .build ();
207212
208- LOGGER .info ("Executing Stream Load: " + endpoint );
209- LOGGER .debug ("Label: " + label );
213+ LOGGER .info ("Executing Stream Load: " + endpoint );
214+ LOGGER .debug ("Label: " + label );
210215
211- HttpResponse <String > resp = client .send (request , HttpResponse .BodyHandlers .ofString ());
216+ resp = client .send (request , HttpResponse .BodyHandlers .ofString ());
217+ } catch (Exception e ) {
218+ LOGGER .error ("Error Communication Knowage/Doris " + endpoint , e );
219+ throw e ;
220+ }
212221 LOGGER .info ("Stream Load HTTP status: " + resp .statusCode ());
213222 LOGGER .debug ("Stream Load response body: " + resp .body ());
214223
@@ -220,6 +229,7 @@ private void persistDoris(IDataSet dataSet, IDataSource datasource, String table
220229 LOGGER .info ("Stream Load completed successfully for table " + tableName );
221230
222231 } else {
232+ LOGGER .error ("Error Doris body " + resp .body ());
223233 throw new RuntimeException ("Stream Load failed: HTTP " + resp .statusCode () + " - " + resp .body ());
224234 }
225235
0 commit comments