@@ -183,6 +183,7 @@ private ImportTargetResult importIntoSingleTable(
183183 .tableName (table )
184184 .status (ImportTargetResultStatus .VALIDATION_FAILED )
185185 .errors (Collections .singletonList (DataLoaderError .TABLE_METADATA_MISSING .buildMessage ()))
186+ .importedRecord (importOptions .isLogRawRecord () ? mutableSourceRecord : null )
186187 .build ();
187188 }
188189
@@ -209,6 +210,7 @@ private ImportTargetResult importIntoSingleTable(
209210 .tableName (table )
210211 .status (ImportTargetResultStatus .VALIDATION_FAILED )
211212 .errors (validationResult .getErrorMessages ())
213+ .importedRecord (importOptions .isLogRawRecord () ? mutableSourceRecord : null )
212214 .build ();
213215 }
214216
@@ -223,6 +225,7 @@ private ImportTargetResult importIntoSingleTable(
223225 .errors (
224226 Collections .singletonList (
225227 DataLoaderError .COULD_NOT_FIND_PARTITION_KEY .buildMessage ()))
228+ .importedRecord (importOptions .isLogRawRecord () ? mutableSourceRecord : null )
226229 .build ();
227230 }
228231 Optional <Key > optionalClusteringKey = Optional .empty ();
@@ -238,6 +241,7 @@ private ImportTargetResult importIntoSingleTable(
238241 .errors (
239242 Collections .singletonList (
240243 DataLoaderError .COULD_NOT_FIND_CLUSTERING_KEY .buildMessage ()))
244+ .importedRecord (importOptions .isLogRawRecord () ? mutableSourceRecord : null )
241245 .build ();
242246 }
243247 }
@@ -254,6 +258,7 @@ private ImportTargetResult importIntoSingleTable(
254258 .tableName (table )
255259 .status (ImportTargetResultStatus .RETRIEVAL_FAILED )
256260 .errors (Collections .singletonList (e .getMessage ()))
261+ .importedRecord (importOptions .isLogRawRecord () ? mutableSourceRecord : null )
257262 .build ();
258263 }
259264 ImportTaskAction importAction =
@@ -273,6 +278,7 @@ && shouldRevalidateMissingColumns(importOptions, checkForMissingColumns)) {
273278 .errors (
274279 Collections .singletonList (
275280 DataLoaderError .UPSERT_INSERT_MISSING_COLUMNS .buildMessage ()))
281+ .importedRecord (importOptions .isLogRawRecord () ? mutableSourceRecord : null )
276282 .build ();
277283 }
278284 }
@@ -281,7 +287,7 @@ && shouldRevalidateMissingColumns(importOptions, checkForMissingColumns)) {
281287 return ImportTargetResult .builder ()
282288 .namespace (namespace )
283289 .tableName (table )
284- .importedRecord (mutableSourceRecord )
290+ .importedRecord (importOptions . isLogRawRecord () ? mutableSourceRecord : null )
285291 .importAction (importAction )
286292 .status (ImportTargetResultStatus .DATA_ALREADY_EXISTS )
287293 .errors (Collections .singletonList (DataLoaderError .DATA_ALREADY_EXISTS .buildMessage ()))
@@ -292,7 +298,7 @@ && shouldRevalidateMissingColumns(importOptions, checkForMissingColumns)) {
292298 return ImportTargetResult .builder ()
293299 .namespace (namespace )
294300 .tableName (table )
295- .importedRecord (mutableSourceRecord )
301+ .importedRecord (importOptions . isLogRawRecord () ? mutableSourceRecord : null )
296302 .importAction (importAction )
297303 .status (ImportTargetResultStatus .DATA_NOT_FOUND )
298304 .errors (Collections .singletonList (DataLoaderError .DATA_NOT_FOUND .buildMessage ()))
@@ -314,7 +320,7 @@ && shouldRevalidateMissingColumns(importOptions, checkForMissingColumns)) {
314320 return ImportTargetResult .builder ()
315321 .namespace (namespace )
316322 .tableName (table )
317- .importedRecord (mutableSourceRecord )
323+ .importedRecord (importOptions . isLogRawRecord () ? mutableSourceRecord : null )
318324 .status (ImportTargetResultStatus .VALIDATION_FAILED )
319325 .errors (Collections .singletonList (e .getMessage ()))
320326 .build ();
@@ -333,13 +339,14 @@ && shouldRevalidateMissingColumns(importOptions, checkForMissingColumns)) {
333339 .namespace (namespace )
334340 .tableName (table )
335341 .importAction (importAction )
336- .importedRecord (mutableSourceRecord )
342+ .importedRecord (importOptions . isLogRawRecord () ? mutableSourceRecord : null )
337343 .status (ImportTargetResultStatus .SAVED )
338344 .build ();
339345
340346 } catch (ScalarDbDaoException e ) {
341347 return ImportTargetResult .builder ()
342348 .namespace (namespace )
349+ .importedRecord (importOptions .isLogRawRecord () ? mutableSourceRecord : null )
343350 .tableName (table )
344351 .importAction (importAction )
345352 .status (ImportTargetResultStatus .SAVE_FAILED )
0 commit comments