Skip to content

Parquet: allow reading Tuple/Map columns as JSON - #92864

Merged
al13n321 merged 3 commits into
masterfrom
pq2js
Jan 1, 2026
Merged

al13n321 merged 3 commits into
masterfrom
pq2js

Conversation

@al13n321

Copy link
Copy Markdown
Contributor

Changelog category (leave one):

  • Improvement

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

Parquet reader now allows reading Tuple or Map columns as JSON: select x from file(f.parquet, auto, 'x JSON') works even if the type of column x in f.parquet is tuple or map.


Closes #92383

Refactors the reader to (1) do castColumn in formOutputColumn instead of decodePrimitiveColumn, so that non-primitive columns can be cast, (2) call formOutputColumn from decodePrimitiveColumn when all primitive columns of that output column are decoded, so that formOutputColumn runs in parallel for different columns (previously these calls happened from one thread when delivering final block).

@al13n321
al13n321 requested a review from Avogar December 23, 2025 00:40
@clickhouse-gh

clickhouse-gh Bot commented Dec 23, 2025 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [a66d6c4]

Summary: ❌

job_name test_name status info comment
Stateless tests (amd_debug, distributed plan, s3 storage, parallel) failure
00754_alter_modify_order_by_replicated_zookeeper_long FAIL cidb
Logical error: Block structure mismatch in A stream: different number of columns: (STID: 0993-3d6a) FAIL cidb
Integration tests (arm_binary, distributed plan, 1/4) failure
test_scheduler_cpu_preemptive/test.py::test_independent_pools FAIL cidb, issue
BuzzHouse (amd_debug) failure
Logical error: 'Inconsistent AST formatting: the query: (STID: 1941-1bfa) FAIL cidb, issue

@clickhouse-gh clickhouse-gh Bot added the pr-improvement Pull request with some product improvements label Dec 23, 2025
@Avogar Avogar self-assigned this Dec 23, 2025
@al13n321
al13n321 enabled auto-merge January 1, 2026 19:42
@al13n321
al13n321 added this pull request to the merge queue Jan 1, 2026
Merged via the queue into master with commit 124da39 Jan 1, 2026
@al13n321
al13n321 deleted the pq2js branch January 1, 2026 19:58
@robot-ch-test-poll robot-ch-test-poll added the pr-synced-to-cloud The PR is synced to the cloud repo label Jan 1, 2026
alexey-milovidov added a commit that referenced this pull request Jul 3, 2026
The `Style check` was the only red job (it drops all downstream builds/tests),
failing on three issues in the new test:
- a test-numbering gap (`05020` was far ahead of the highest existing number),
- a global `SYSTEM FLUSH LOGS` (must name the log: `SYSTEM FLUSH LOGS query_log`),
- `SYSTEM DROP QUERY CONDITION CACHE` without a `no-parallel` tag.

While verifying the test end-to-end (CI never built it, since it stopped at the
style stage) two functional problems surfaced:

- The original test asserted on `read_rows`, but that cannot observe the cache:
  Parquet bloom-filter pruning already skips the absent (odd) value on the very
  first query, so the cached and uncached reads are identical. The reliable
  signal is the `QueryConditionCacheMisses` / `QueryConditionCacheHits` profile
  events, as used by the existing object-storage test
  (`test_storage_iceberg_with_spark/test_query_condition_cache.py`).

- The `file()` table function has a Nil table UUID, and `QueryConditionCache`
  disables itself for storages without a UUID (issues #92863 / #92864), so the
  cache is inert for it - the same limitation the `s3()` table function has. The
  cache is populated and reused for file-backed tables that do have a UUID, i.e.
  the `File` table engine.

Rewrite the test to use a `File` engine table and assert on the cache
miss/hit profile events (first query = miss, second = hit), plus a correctness
check that a matching predicate is not over-skipped. The table gets a unique
UUID per test run, so the cache keys are isolated and no global cache reset is
needed, keeping the test parallel-safe.
zeekay pushed a commit to hanzoai/datastore that referenced this pull request Sep 11, 2026
The `Style check` was the only red job (it drops all downstream builds/tests),
failing on three issues in the new test:
- a test-numbering gap (`05020` was far ahead of the highest existing number),
- a global `SYSTEM FLUSH LOGS` (must name the log: `SYSTEM FLUSH LOGS query_log`),
- `SYSTEM DROP QUERY CONDITION CACHE` without a `no-parallel` tag.

While verifying the test end-to-end (CI never built it, since it stopped at the
style stage) two functional problems surfaced:

- The original test asserted on `read_rows`, but that cannot observe the cache:
  Parquet bloom-filter pruning already skips the absent (odd) value on the very
  first query, so the cached and uncached reads are identical. The reliable
  signal is the `QueryConditionCacheMisses` / `QueryConditionCacheHits` profile
  events, as used by the existing object-storage test
  (`test_storage_iceberg_with_spark/test_query_condition_cache.py`).

- The `file()` table function has a Nil table UUID, and `QueryConditionCache`
  disables itself for storages without a UUID (issues ClickHouse#92863 / ClickHouse#92864), so the
  cache is inert for it - the same limitation the `s3()` table function has. The
  cache is populated and reused for file-backed tables that do have a UUID, i.e.
  the `File` table engine.

Rewrite the test to use a `File` engine table and assert on the cache
miss/hit profile events (first query = miss, second = hit), plus a correctness
check that a matching predicate is not over-skipped. The table gets a unique
UUID per test run, so the cache keys are isolated and no global cache reset is
needed, keeping the test parallel-safe.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

Allow to read JSON column from Tuple in native Parquet reader

3 participants