Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(clickhouse): treat unsupported Arrow column type as non-retryable (#66404)

Tom Owers579b485006d1
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/clickhouse/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/clickhouse/source.py
index 013b9f8ec744..66d7733cf6c6 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/clickhouse/source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/clickhouse/source.py
@@ -213,6 +213,13 @@ class ClickHouseSource(SimpleSource[ClickHouseSourceConfig], SSHTunnelMixin, Val
# replays the identical failure, so stop and tell the customer to fix the schema.
# We match the stable suffix, not the volatile `<database>.<table>` prefix.
"not found or has no columns": "We couldn't find this table in your ClickHouse database — it may have been dropped or renamed. If you were syncing a materialized view, sync it by its own name rather than its internal `.inner_id.<uuid>` table (those names change whenever the view is recreated). Remove or re-point this table in your source, then resync.",
+ # UNKNOWN_TYPE (code 50) raised while ClickHouse streams our extraction
+ # query as Arrow: a selected column has a type ClickHouse can't serialize
+ # to Arrow (e.g. an `AggregateFunction(...)` state column on an aggregating
+ # materialized view). The column type is fixed, so retrying replays the
+ # identical failure. We match the stable Arrow-conversion phrase, not the
+ # volatile column name or type in the message.
+ "is not supported for conversion into Arrow data format": "One of the columns in this table has a type ClickHouse can't export (for example an `AggregateFunction` state column on an aggregating materialized view). Deselect that column in this schema's column settings, or sync a view that finalizes it, then resync.",
}
def get_schemas(
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/clickhouse/test_clickhouse.py b/products/warehouse_sources/backend/temporal/data_imports/sources/clickhouse/test_clickhouse.py
index 8638abb3f198..d30a0b0748db 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/clickhouse/test_clickhouse.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/clickhouse/test_clickhouse.py
@@ -640,6 +640,11 @@ class TestClickHouseSourceNonRetryableErrors:
# view's `.inner_id.<uuid>` inner table whose UUID changed when the view was recreated.
"Table soax_stage..inner_id.8c612ff0-b72c-4b20-8ea5-405ed002c2f6 not found or has no columns",
"Table default.some_dropped_table not found or has no columns",
+ # UNKNOWN_TYPE (code 50) — a column type ClickHouse can't serialize to Arrow,
+ # e.g. an AggregateFunction state column on an aggregating materialized view.
+ "HTTPDriver for https://host:8443 received ClickHouse error code 50\n Code: 50. "
+ "DB::Exception: The type 'AggregateFunction(uniq, String)' of a column 'profile_id' "
+ "is not supported for conversion into Arrow data format: While executing Arrow. (UNKNOWN_TYPE)",
],
)
def test_permanent_errors_are_non_retryable(self, source, error_msg):