@@ -134,17 +134,17 @@ public static Column<?> createColumnFromValue(
134134 } catch (NumberFormatException e ) {
135135 throw new ColumnParsingException (
136136 CoreError .DATA_LOADER_INVALID_NUMBER_FORMAT_FOR_COLUMN_VALUE .buildMessage (
137- columnName , columnInfo .getTableName (), columnInfo .getNamespace ()),
137+ value , columnName , columnInfo .getTableName (), columnInfo .getNamespace ()),
138138 e );
139139 } catch (DateTimeParseException e ) {
140140 throw new ColumnParsingException (
141141 CoreError .DATA_LOADER_INVALID_DATE_TIME_FOR_COLUMN_VALUE .buildMessage (
142- columnName , columnInfo .getTableName (), columnInfo .getNamespace ()),
142+ value , columnName , columnInfo .getTableName (), columnInfo .getNamespace ()),
143143 e );
144144 } catch (IllegalArgumentException e ) {
145145 throw new ColumnParsingException (
146146 CoreError .DATA_LOADER_INVALID_BASE64_ENCODING_FOR_COLUMN_VALUE .buildMessage (
147- columnName , columnInfo .getTableName (), columnInfo .getNamespace ()),
147+ value , columnName , columnInfo .getTableName (), columnInfo .getNamespace ()),
148148 e );
149149 }
150150 }
@@ -166,6 +166,8 @@ public static Column<?> createColumnFromValue(
166166 * @param sourceRecord the source data in JSON format to compare against
167167 * @param ignoreNullValues if true, null values will be excluded from the result
168168 * @param tableMetadata metadata about the table structure and column types
169+ * @param namespace namespace in which the table is present
170+ * @param table table name to which data is to be imported
169171 * @return a List of Column objects representing the processed data
170172 * @throws Base64Exception if there's an error processing base64 encoded BLOB data
171173 * @throws ColumnParsingException if there's an error parsing column values
@@ -174,7 +176,9 @@ public static List<Column<?>> getColumnsFromResult(
174176 Result scalarDBResult ,
175177 JsonNode sourceRecord ,
176178 boolean ignoreNullValues ,
177- TableMetadata tableMetadata )
179+ TableMetadata tableMetadata ,
180+ String namespace ,
181+ String table )
178182 throws Base64Exception , ColumnParsingException {
179183
180184 List <Column <?>> columns = new ArrayList <>();
@@ -193,7 +197,9 @@ public static List<Column<?>> getColumnsFromResult(
193197 sourceRecord ,
194198 columnName ,
195199 ignoreNullValues ,
196- tableMetadata .getColumnDataTypes ());
200+ tableMetadata .getColumnDataTypes (),
201+ namespace ,
202+ table );
197203
198204 if (column != null ) {
199205 columns .add (column );
@@ -242,6 +248,8 @@ private static Set<String> getColumnsToIgnore(
242248 * @param columnName the name of the column to retrieve
243249 * @param ignoreNullValues whether to ignore null values in the result
244250 * @param dataTypesByColumns mapping of column names to their data types
251+ * @param namespace namespace in which the table is present
252+ * @param table table name to which data is to be imported
245253 * @return the Column object containing the value, or null if ignored
246254 * @throws ColumnParsingException if there's an error parsing the column value
247255 */
@@ -250,13 +258,15 @@ private static Column<?> getColumn(
250258 JsonNode sourceRecord ,
251259 String columnName ,
252260 boolean ignoreNullValues ,
253- Map <String , DataType > dataTypesByColumns )
261+ Map <String , DataType > dataTypesByColumns ,
262+ String namespace ,
263+ String table )
254264 throws ColumnParsingException {
255265 if (scalarDBResult != null && !sourceRecord .has (columnName )) {
256266 return getColumnFromResult (scalarDBResult , columnName );
257267 } else {
258268 return getColumnFromSourceRecord (
259- sourceRecord , columnName , ignoreNullValues , dataTypesByColumns );
269+ sourceRecord , columnName , ignoreNullValues , dataTypesByColumns , namespace , table );
260270 }
261271 }
262272
@@ -279,22 +289,27 @@ private static Column<?> getColumnFromResult(Result scalarDBResult, String colum
279289 * @param columnName column name
280290 * @param ignoreNullValues ignore null values or not
281291 * @param dataTypesByColumns data types of columns
292+ * @param namespace namespace in which the table is present
293+ * @param table table name to which data is to be imported
282294 * @return column data
283295 * @throws ColumnParsingException if an error occurs while parsing the column
284296 */
285297 private static Column <?> getColumnFromSourceRecord (
286298 JsonNode sourceRecord ,
287299 String columnName ,
288300 boolean ignoreNullValues ,
289- Map <String , DataType > dataTypesByColumns )
301+ Map <String , DataType > dataTypesByColumns ,
302+ String namespace ,
303+ String table )
290304 throws ColumnParsingException {
291305 DataType dataType = dataTypesByColumns .get (columnName );
292306 String columnValue =
293307 sourceRecord .has (columnName ) && !sourceRecord .get (columnName ).isNull ()
294308 ? sourceRecord .get (columnName ).asText ()
295309 : null ;
296310 if (!ignoreNullValues || columnValue != null ) {
297- ColumnInfo columnInfo = ColumnInfo .builder ().columnName (columnName ).build ();
311+ ColumnInfo columnInfo =
312+ ColumnInfo .builder ().columnName (columnName ).tableName (table ).namespace (namespace ).build ();
298313 return createColumnFromValue (dataType , columnInfo , columnValue );
299314 }
300315 return null ;
0 commit comments