clickhouse-java
clickhouse-java copied to clipboard
The ClickHouse Data Processor’s write position does not revert to its original state after an exception is triggered by the addBatch() method.
Error: The ClickHouseDataProcessor doesn't reset the write position after encountering exceptions during addBatch(). This leads to subsequent batches using the wrong position and failing with serialization errors.
Scenario:
- Calling addBatch() with invalid data (null for non-nullable or wrong data type) throws a SqlException.
- The write position remains at the previous attempt (not reset to 0).
- Adding the next batch with the incorrect position causes a serializer exception due to mismatched data and serialization method.
Question:
- How can we reset the write position of ClickHouseDataProcessor after handling addBatch() exceptions?
- Alternatively, is there a way to add subsequent batches without relying on the potentially incorrect write position?
I was debugging and saw the wrong value here:
I tried using the clearParameters() method in my catch block but it hasn't got any effect.