Skip to content

Read Arrow interval types - #126206

Merged
alexey-milovidov merged 8 commits into
ClickHouse:masterfrom
JayPokale:arrow-interval-types
Oct 23, 2026
Merged

alexey-milovidov merged 8 commits into
ClickHouse:masterfrom
JayPokale:arrow-interval-types

Conversation

@JayPokale

@JayPokale JayPokale commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Closes: #125143

The native Arrow IPC reader now reads the three Arrow interval types instead of failing with Native Arrow IPC reader does not support this type yet:

Arrow ClickHouse
INTERVAL(YEAR_MONTH) (Int32 months) IntervalMonth
INTERVAL(DAY_TIME) (Int32 days, Int32 milliseconds) Tuple(days IntervalDay, milliseconds IntervalMillisecond)
INTERVAL(MONTH_DAY_NANO) (Int32 months, Int32 days, Int64 nanoseconds) Tuple(months IntervalMonth, days IntervalDay, nanoseconds IntervalNanosecond)

The composite types keep their counts apart in a Tuple of intervals, as the issue suggests, because months, days and smaller units cannot be converted into each other (the elements are named, so dt.days works and they can be added to dates directly). The Arrow Duration type is already read as an Interval, so this follows the same convention.

  • fieldToCHType maps the types. The Tuple ones follow the rule for structs: they are Nullable(Tuple) only with enable_nullable_tuple_type, and RecordBatchDecoder::wrapsInNullable applies the same rule to them.
  • decodeInner reads each count with memcpy (the values are packed structs) and widens it to the Int64 of the interval columns; invisible rows are zero.

The test files were written with nanoarrow and pyarrow (pyarrow cannot build month and day-time interval arrays from Python) and have a null row in every column. The test checks the inferred types, the values, date arithmetic with them, and Nullable(Tuple) with enable_nullable_tuple_type.

The data type mapping table in the Arrow format documentation is autogenerated, so it is left to the generator. The Apache Arrow library based reader (Arrow Flight, Delta Lake) is not changed.

Changelog category (leave one):

  • Improvement

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

The Arrow and ArrowStream input formats can read the Arrow interval types: YEAR_MONTH as IntervalMonth, and DAY_TIME and MONTH_DAY_NANO as a Tuple of intervals.


Workflow [PR]
Sync PR [sync-upstream/pr/126206]

Version info

  • Merged into: 26.11.1.682-master (included in 26.11 and later)

@clickhouse-gh clickhouse-gh Bot added the comp-formats Input/output formats (CSV/JSON/Parquet/ORC/Arrow/Protobuf/etc.). label Oct 16, 2026
@alexey-milovidov alexey-milovidov added the can be tested Allows running workflows for external contributors label Oct 16, 2026
@alexey-milovidov alexey-milovidov self-assigned this Oct 16, 2026
@clickhouse-gh

clickhouse-gh Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [c1ceeb9]

Summary: ✅


AI Review

Summary

PR #126206 adds native decoding of Arrow interval types into IntervalMonth or named tuples of intervals, preserves the existing tuple nullability rules, and updates the unsupported-type regression fixture. Reviewed the diff, current code, and all prior discussion at head c1ceeb9bd258c0a738bfc5a0e101c0cdefd90076; no actionable findings.

Missing context / blind spots
  • ⚠️ Full CI for the current head is pending. No built clickhouse executable is available in this checkout, so I could not independently rerun the focused tests. The author reports passing runs of 05403_arrow_interval_types, 05408_arrow_infer_null_type, and 04338_native_arrow_ipc_null_type; completed stateless CI would independently confirm that evidence.
Final Verdict

✅ Approve — no actionable findings. No inline comments posted.

@clickhouse-gh clickhouse-gh Bot added the pr-improvement Pull request with some product improvements label Oct 16, 2026
@clickhouse-gh clickhouse-gh Bot added the external Author is not a member of the ClickHouse organization label Oct 17, 2026
JayPokale and others added 2 commits October 17, 2026 10:15
…enabled by default

Master made `Nullable(Tuple)` GA, so `DAY_TIME` and `MONTH_DAY_NANO` interval
columns are now inferred as `Nullable(Tuple(...))` and the null rows read as
`NULL`. Update the reference, and check the previous behavior (null rows read
as zero intervals) with `enable_nullable_tuple_type = 0` instead.

CI report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=126206&sha=caed1f25c64a938b759d0ace6b2f6dd2daddac82&name_0=PR
PR: ClickHouse#126206

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing c1ceeb9bd with master 31ef99e6b (stripped binary size, per-symbol sizes and ThinLTO time; object sizes against the warmup build of 41fb34cd4; compile times per translation unit against the most recent warmup build that recompiled it).

✅ No significant changes.

Binary sizes

programs/clickhouse-stripped: smaller than the master baseline by the known offset between the two builds, so the difference is not shown. A delta that differs from the offset by more than 50% of it is shown, in either direction.

The official master build is compiled with -g and a pull request build is not, and XRay counts debug instructions towards its instrumentation threshold, so master instruments thousands of functions more and its binary is ~0.4% larger no matter what the pull request does.

Compile time of recompiled translation units

9 translation units recompiled, 25 s compile time in total, 9 of them have a recent master baseline.

Job report

@alexey-milovidov

Copy link
Copy Markdown
Member

🕵 @groeneai, investigate the failure: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=126206&sha=adc31c7366d&name_0=PR&name_1=Integration%20tests%20(arm_binary%2C%202%2F4) and provide a fix in a separate PR. If the fix is already in progress, link it here.

test_storage_rabbitmq/test.py::test_rabbitmq_reconnect_drops_stale_deliveries timed out in rabbitmqctl list_queues (300 s). It failed on 2026-10-19 in unrelated PRs #126013 and #115849 too; this PR only changes the Arrow IPC reader.

@groeneai

Copy link
Copy Markdown
Collaborator

No fix PR exists yet; I'm working on it and will link it here.

From the logs of all three failed runs:

  • The ClickHouse side looks correct in all three: 10100 rows for 10000 messages (inside the two-block bound), no unknown delivery tag acks, and consumption finished about 19 s after the reconnect.
  • A single rabbitmqctl -q list_queues poll never returned and was killed at 300 s, while the polls before it took about 0.5 s. It was a different poll each time (the 3rd, 14th and 22nd), once after the queue had already reported 0 0 twice, and in this run the container's rabbitmq-diagnostics ping healthcheck passed 29 times during the hang. So the broker was not stuck on the redelivered backlog; the fix belongs in the test's drain poll.

@groeneai

Copy link
Copy Markdown
Collaborator

The fix is in #126746: the drain loop now asks rabbitmqctl list_queues only after the row count has been stable for 3 s, and a call that does not return within 30 s is abandoned and asked again under the test's own 180 s deadline. It is test-only; the ClickHouse and broker sides were healthy in all three failures.

@alexey-milovidov

Copy link
Copy Markdown
Member

🕵 Thanks, @groeneai. The only red check here is test_storage_rabbitmq/test.py::test_rabbitmq_reconnect_drops_stale_deliveries, and it is unrelated to this PR. Its fix is in #126746, which is still open, so I'm not merging master into this branch yet. Nothing else needs to change here.

@alexey-milovidov

Copy link
Copy Markdown
Member

🕵 Merged master into the branch (no conflicts); 05403_arrow_interval_types passes locally on the merged tree. The only CI failure, test_storage_rabbitmq/test.py::test_rabbitmq_reconnect_drops_stale_deliveries (a rabbitmqctl list_queues call timed out after 300 s), is unrelated to this PR and is being fixed in #126746.

The test from master used `month_day_nano_interval` as an Arrow type the
native reader does not support, to check the error when
`input_format_arrow_skip_columns_with_unsupported_types_in_schema_inference`
skips every column. This PR adds support for Arrow intervals, so the
column is inferred and the test failed. The reader now maps every type
that `pyarrow` can write, so use a schema-only stream whose field has
an undefined type id instead.

CI report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=126206&sha=latest&name_0=PR&name_1=Stateless%20tests%20(arm_binary%2C%20parallel)
PR: ClickHouse#126206

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@alexey-milovidov

Copy link
Copy Markdown
Member

🕵 Fixed the CI failure in 05408_arrow_infer_null_type (all stateless jobs). That test, added on master, used month_day_nano_interval as the type the native reader cannot read, to check the error when input_format_arrow_skip_columns_with_unsupported_types_in_schema_inference skips every column. This PR adds interval support, so the column was inferred and the error was gone. After this PR the reader handles every type pyarrow can write, so the test now reads data_arrow/unknown_type.arrows: a stream with only a schema, whose one field has an undefined type id (99). 05408_arrow_infer_null_type, 05403_arrow_interval_types and 04338_native_arrow_ipc_null_type pass locally.

@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Oct 23, 2026
Merged via the queue into ClickHouse:master with commit 681c21c Oct 23, 2026
178 checks passed
@robot-clickhouse robot-clickhouse added the pr-synced-to-cloud The PR is synced to the cloud repo label Oct 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

can be tested Allows running workflows for external contributors comp-formats Input/output formats (CSV/JSON/Parquet/ORC/Arrow/Protobuf/etc.). external Author is not a member of the ClickHouse organization pr-improvement Pull request with some product improvements pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Arrow: interval types are not supported

4 participants