zhan7236 opened a new pull request, #14714:
URL: https://github.com/apache/iceberg/pull/14714
Closes #14644
### What changes were proposed in this pull request?
This PR improves the error logging in `IcebergWriterFactory` when partition
spec creation fails due to an invalid configuration.
### Changes made:
1. **Enhanced error log message**: The log message now explicitly includes
the exception message via `e.getMessage()` in the format string, making it
clearer what went wrong:
```java
LOG.error(
"Unable to create partition spec {} for table {}, table will be
unpartitioned: {}",
partitionBy,
identifier,
e.getMessage(),
e);
```
2. **Added test case**: Added `testAutoCreateTableWithInvalidPartitionSpec`
to verify that when a partition spec is invalid (e.g., referencing a
non-existent column), the table is correctly created as unpartitioned.
### Why are the changes needed?
The original implementation had an ambiguous logging pattern where the
exception was passed as the last argument, but it wasn't immediately clear from
reading the code that the exception would be properly logged. By explicitly
including `e.getMessage()` in the format string, the intent is clearer and
ensures the exception message is always visible in the log output regardless of
the SLF4J implementation or version.
### How was this patch tested?
- Existing tests pass.
- Added new test `testAutoCreateTableWithInvalidPartitionSpec` to verify the
fallback behavior when partition spec creation fails.
- Ran `./gradlew :iceberg-kafka-connect:iceberg-kafka-connect:check` - all
checks pass.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]