-
[OPIK-5694] [BE] fix: stop emitting NULL into non-nullable last_updated_at on batch insert (#6569)
发布于
2026-04-30 15:33:16 +00:00 The batch INSERT path in TraceDAO and SpanDAO was emitting
if(:last_updated_at IS NULL, NULL, parseDateTime64BestEffort(...))for
rows where the client did not provide lastUpdatedAt. The else-branch
returned NULL, which ClickHouse cannot convert to the column's
non-nullable DateTime64(6) type. The row still inserts (CH falls back to
the column DEFAULT), but every row increments system.errors code 70
(CANNOT_CONVERT_TYPE) and pollutes pod stderr — the source of the ~30k
errors/hour observed in production.Reproduction (added as regression tests in TracesResourceTest$BatchInsert
and SpansResourceTest$BatchInsert): query system.errors before and after
batchCreateTraces/Spans with one row having lastUpdatedAt=null; without
the fix the code-70 counter grows by 1 per buggy row.Fix: emit now64(6) instead of NULL in the else-branch, matching the
column's DEFAULT now64(6). Behaviour is identical (null input → current
time, just like DEFAULT) but no NULL ever reaches the non-nullable
column, so no type-conversion error.Implements OPIK-5694: Multiple parsing errors in Production Clickhouse
下载附件