Skip to content

Remove old Parquet writer and reader implementations - #100949

Merged
alexey-milovidov merged 35 commits into
masterfrom
remove-old-parquet-reader-writer
Apr 28, 2026
Merged

alexey-milovidov merged 35 commits into
masterfrom
remove-old-parquet-reader-writer

Conversation

@alexey-milovidov

Copy link
Copy Markdown
Member

Remove the old Arrow-based Parquet writer (used when output_format_parquet_use_custom_encoder = 0) and the old Arrow-based Parquet reader (used when input_format_parquet_use_native_reader_v3 = 0).

Both newer implementations have been the default for an extended period and perform reliably. The custom encoder has been default since 24.5, and the native reader v3 since 25.11.

Changes:

  • Mark output_format_parquet_use_custom_encoder and input_format_parquet_use_native_reader_v3 as obsolete settings
  • Remove the writeUsingArrow code path and Arrow library dependencies from ParquetBlockOutputFormat
  • Remove the entire ParquetBlockInputFormat class (old Arrow-based reader) and ArrowParquetSchemaReader
  • Simplify format registration to always use ParquetV3BlockInputFormat and NativeParquetSchemaReader
  • PREWHERE support checker for Parquet now always returns true
  • Update ~50 test files to remove references to obsolete settings
  • Update documentation

Closes #100126

Changelog category (leave one):

  • Backward Incompatible Change

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

You can no longer use the obsolete Arrow-based Parquet reader and writer. The native implementation will be used instead.

Remove the old Arrow-based Parquet writer (used when
`output_format_parquet_use_custom_encoder` = 0) and the old Arrow-based
Parquet reader (used when `input_format_parquet_use_native_reader_v3` = 0).

Both newer implementations have been the default for an extended period
and perform reliably. The custom encoder has been default since 24.5,
and the native reader v3 since 25.11.

Changes:
- Mark `output_format_parquet_use_custom_encoder` and
  `input_format_parquet_use_native_reader_v3` as obsolete settings
- Remove the `writeUsingArrow` code path and Arrow library dependencies
  from `ParquetBlockOutputFormat`
- Remove the entire `ParquetBlockInputFormat` class (old Arrow-based
  reader) and `ArrowParquetSchemaReader`
- Simplify format registration to always use `ParquetV3BlockInputFormat`
  and `NativeParquetSchemaReader`
- PREWHERE support checker for Parquet now always returns true
- Update ~50 test files to remove references to obsolete settings
- Update documentation

Closes #100126

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Mar 27, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [d4837b6]

Summary: ✅


AI Review

Summary

This PR removes the legacy Arrow-based Parquet reader/writer paths and keeps only the native ParquetV3 reader and custom writer flow, while migrating legacy toggles to obsolete settings. I did not find additional correctness, safety, or performance issues that require new inline comments.

ClickHouse Rules
Item Status Notes
Deletion logging ➖
Serialization versioning ➖
Core-area scrutiny ✅
No test removal ✅
Experimental gate ➖
No magic constants ✅
Backward compatibility ✅
SettingsChangesHistory.cpp ✅
PR metadata quality ✅
Safe rollout ✅
Compilation time ✅
No large/binary files ✅
Final Verdict
  • Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-backward-incompatible Pull request with backwards incompatible changes label Mar 27, 2026
alexey-milovidov and others added 8 commits March 27, 2026 20:27
Fix style check: remove unused `ErrorCodes::LOGICAL_ERROR` from
`ParquetBlockInputFormat.cpp` and unused `ErrorCodes::UNKNOWN_EXCEPTION`,
`ErrorCodes::NOT_IMPLEMENTED` from `ParquetBlockOutputFormat.cpp`.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
…iant_nested_types` as obsolete

These settings were only used by the old Arrow-based Parquet writer.
The custom encoder always writes Parquet V2.6+ and always uses
compliant nested types, so these settings have had no effect since the
custom encoder became the default in version 24.5.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
- `02245_parquet_skip_unknown_type`: Add `error_message` column to
  reference — the v3 native reader supports the always-null type and
  includes it instead of skipping.
- `03164_adapting_parquet_reader_output_size`: Reduce row count from
  25000 to 10000 to fix timeout in flaky check (>180s limit).

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
The removal of the NOTE about `output_format_parquet_use_custom_encoder`
left two consecutive blank lines, which violates the markdown linter rule
MD012.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Comment thread src/Core/SettingsChangesHistory.cpp Outdated
});
addSettingsChanges(settings_changes_history, "26.1",
{
{"output_format_parquet_use_custom_encoder", true, true, "Obsolete setting, the custom encoder is now always used."},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is recorded under 26.1, but the behavior change is introduced by this PR now.

Placing it in an older version makes system.settings_changes misleading and also means compatibility handling for the actual introduction version is tracked under the wrong release bucket.

Please move these four entries to the current release block (the newest addSettingsChanges(...) section used for this development cycle), keeping the same messages.

alexey-milovidov and others added 4 commits March 30, 2026 04:15
…ngsChangesHistory`

Move the four obsolete Parquet setting entries (`output_format_parquet_use_custom_encoder`,
`output_format_parquet_version`, `output_format_parquet_compliant_nested_types`,
`input_format_parquet_use_native_reader_v3`) from the 26.1 block to the 26.4 block,
since the behavior change is introduced by this PR, not in a past release.

This addresses review feedback about `SettingsChangesHistory` entries being
placed under the wrong version.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>

@al13n321 al13n321 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A bit scary (what if someone's using it, what if we want a reference implementation for testing in future), but hard to argue with -2287 loc :)

return parquet_column_descriptor;
}

void ParquetFileBucketInfo::serialize(WriteBuffer & buffer)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move these remaining bits into ParquetV3BlockInputFormat.{h,cpp} and delete ParquetBlockInputFormat.{h,cpp}.

$CLICKHOUSE_CLIENT -q "desc file(test_02245.parquet) settings input_format_parquet_use_native_reader_v3=0" 2>&1 | grep -qF "CANNOT_EXTRACT_TABLE_STRUCTURE" && echo "OK" || echo "FAIL"
$CLICKHOUSE_CLIENT -q "desc file(test_02245.parquet) settings input_format_parquet_skip_columns_with_unsupported_types_in_schema_inference=1, input_format_parquet_use_native_reader_v3=0"
$CLICKHOUSE_CLIENT -q "select count(*) from file(test_02245.parquet) settings input_format_parquet_skip_columns_with_unsupported_types_in_schema_inference=1, input_format_parquet_use_native_reader_v3=0"
# The v3 reader supports the always-null type, so desc succeeds.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This no longer makes sense, or at least doesn't match the name of the test. Ideally make this test use a type that the reader still doesn't support, or otherwise at least change the test name to be about always-null type.

alexey-milovidov and others added 2 commits April 6, 2026 23:43
…tFormat`, delete old files, rename test

- Move `ParquetFileBucketInfo`, `ParquetBucketSplitter`, and format registration
  functions from `ParquetBlockInputFormat.{h,cpp}` into `ParquetV3BlockInputFormat.{h,cpp}`
- Delete `ParquetBlockInputFormat.{h,cpp}` entirely
- Update all includes that referenced the old header
- Rename test `02245_parquet_skip_unknown_type` to `02245_parquet_always_null_type`
  since the native reader supports the always-null type and no columns are skipped

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
alexey-milovidov and others added 3 commits April 6, 2026 17:54
…reader-writer

# Conflicts:
#	src/Storages/ObjectStorage/StorageObjectStorageSource.cpp
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@alexey-milovidov

Copy link
Copy Markdown
Member Author

The flaky check failure is fixed in #102148, let's update the branch.

alexey-milovidov and others added 6 commits April 21, 2026 10:30
…reader-writer

# Conflicts:
#	src/Processors/Formats/Impl/ParquetBlockInputFormat.cpp
#	src/Processors/Formats/Impl/ParquetBlockOutputFormat.cpp
Master has advanced past 26.4 into the 26.5 development cycle, so move
the four obsolete Parquet setting entries (`output_format_parquet_use_custom_encoder`,
`output_format_parquet_version`, `output_format_parquet_compliant_nested_types`,
`input_format_parquet_use_native_reader_v3`) from the 26.4 block into
the current 26.5 block. This keeps `system.settings_changes` and
`compatibility` handling aligned with the actual introduction version.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
After merging master, three tests brought in from other PRs still
referenced the now-obsolete settings `output_format_parquet_use_custom_encoder`
and `input_format_parquet_use_native_reader_v3`. Drop those `SETTINGS`
clauses — the custom encoder and V3 reader are always used.

- `04099_parquet_nullable_null_check_fix.sh`
- `04103_deltalake_parquet_metadata_cache.sql`
- `04108_parquet_metadata_cache_persists_across_drop.sql`

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
MAKE_OBSOLETE(M, Bool, input_format_parquet_use_native_reader_v3, true) \
MAKE_OBSOLETE(M, Bool, output_format_parquet_use_custom_encoder, true) \
MAKE_OBSOLETE(M, ParquetVersion, output_format_parquet_version, "2.latest") \
MAKE_OBSOLETE(M, Bool, output_format_parquet_compliant_nested_types, true) \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

output_format_parquet_unsupported_types_as_binary still remains a normal setting, but after removing writeUsingArrow there is no remaining code path that reads this flag. The new writer always throws UNKNOWN_TYPE for unsupported types, so this setting has become silently ineffective.

Please either:

  1. mark output_format_parquet_unsupported_types_as_binary as obsolete in OBSOLETE_FORMAT_SETTINGS (same as other removed Parquet toggles in this PR), or
  2. implement equivalent behavior in the native writer.

Without one of these, users can set the option and get different behavior than the setting name promises.

@alexey-milovidov

alexey-milovidov commented Apr 25, 2026 •

Copy link
Copy Markdown
Member Author

@groeneai, please fix this BuzzHouse finding, send a separate PR, and assign it to @Michicosun, because he was involved in these changes and likely introduced this bug. In the PR, please attract @Michicosun's attention as loudly as possible, so he has a chance to notice.

alexey-milovidov and others added 3 commits April 26, 2026 05:52
The new Parquet writer always throws `UNKNOWN_TYPE` for unsupported
types and has no binary-fallback code path, so this setting was
silently ineffective after this PR removed `writeUsingArrow`.

Mark it obsolete in `OBSOLETE_FORMAT_SETTINGS` (same as the other
removed Parquet toggles in this PR), drop the unused
`format_settings.parquet.output_unsupported_types_as_binary` field
and assignment in `FormatFactory`, and record the change in
`SettingsChangesHistory.cpp` under the current `26.5` block.

Addresses review feedback on
#100949

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…reader-writer

# Conflicts:
#	src/Processors/tests/gtest_write_parquet_page_index.cpp
@groeneai

Copy link
Copy Markdown
Collaborator

@alexey-milovidov — the BuzzHouse finding here (Logical error: Unknown virtual column: 'עברית0.size0', STID: 3381-2a5e) is the same chronic trunk bug tracked in issue #102104. I already have a separate fix open: #102470 — "Fix crash when selecting subcolumns from Buffer table", opened 2026-04-11.

Cross-PR confirmation that this is a trunk bug, not a #100949 regression: STID 3381-2a5e has hit 9 times across master + 7 unrelated PRs in the last 90 days (different subcolumn names: 'A...', 'c1.null', 'עברית0.size0', etc.) — well before #100949 added any commits.

Root cause: BufferSource::generate() checks buffer.data.has(name) for the full subcolumn name (e.g. arr.size0), but the buffer's in-memory data block only stores parent columns, so subcolumns fall through to fillVirtualColumn() which only handles _table and throws. The buggy code came from commit aac90df2e0a (support common virtuals for buffer table, 2026-04-01) by @Michicosun — matches your guess.

PR #102470 status: rebased on master 2026-04-24, CI green (Style check, Fast test, Code Review all pass; AI Review verdict: Approve), regression test covers .null / .size0 / tuple / map subcolumns. The two reported CI failures are unrelated chronic flaky tests (04103_user_network_bandwidth_throttler, function_prop_fuzzer) tracked separately.

I just cc'd @Michicosun on #102470 with a loud notification per your directive — could you take a look so the fix can move forward?

Session: cron:clickhouse-ci-task-worker:20260427-151500

@clickhouse-gh

clickhouse-gh Bot commented Apr 28, 2026

Copy link
Copy Markdown
Contributor

LLVM Coverage Report

Metric Baseline Current Δ
Lines 84.00% 84.10% +0.10%
Functions 91.10% 91.10% +0.00%
Branches 76.50% 76.60% +0.10%

Changed lines: 84.19% (245/291) | lost baseline coverage: 1 line(s) · Uncovered code

Full report · Diff report

@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Apr 28, 2026
Merged via the queue into master with commit 823a90c Apr 28, 2026
165 checks passed
@alexey-milovidov
alexey-milovidov deleted the remove-old-parquet-reader-writer branch April 28, 2026 13:46
@robot-ch-test-poll1 robot-ch-test-poll1 added the pr-synced-to-cloud The PR is synced to the cloud repo label Apr 28, 2026
valerypetrov pushed a commit to valerypetrov/ClickHouse that referenced this pull request Sep 2, 2026
…ease notes

The 26.6 Cloud release notes were missing several backward incompatible
changes that ship in that version:

* UUID parsing now rejects same-length non-hexadecimal strings (ClickHouse#104370).
* The obsolete Arrow-based Parquet reader and writer were removed (ClickHouse#100949).
* `RANK` and `DENSE_RANK` reject arguments (ClickHouse#104324).
* `Dynamic`/`Variant` types are validated in window `PARTITION BY` (ClickHouse#105450).
@erezrokah

Copy link
Copy Markdown
Contributor

FYI the native implementation uses more memory than the Arrow one for some
shapes: reading a single-row-group file (715 MiB vs 1.25 GiB for 240 MB of
data), and copying a file with s3-to-s3 INSERT SELECT whether or not it has
several row groups (717 MiB vs 1.34 GiB, and 609 MiB vs 872 MiB). Reading
several row groups is cheaper with the native reader. Numbers and a repro in
#119300

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-backward-incompatible Pull request with backwards incompatible changes 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.

Remove the old Parquet writer (output_format_parquet_use_custom_encoder = 0) and reader (input_format_parquet_use_native_reader_v3 = 0)

6 participants