Skip to content

feat: add Carquet reads through the existing IO interfaces - #1047

Open
luoxiaojian wants to merge 1 commit into
alibaba:mainfrom
luoxiaojian:codex/carquet-r03-complete-reader
Open

feat: add Carquet reads through the existing IO interfaces#1047
luoxiaojian wants to merge 1 commit into
alibaba:mainfrom
luoxiaojian:codex/carquet-r03-complete-reader

Conversation

@luoxiaojian

Copy link
Copy Markdown
Collaborator

Adds the private Carquet reading path in the Parquet extension. CarquetSniffer and CarquetChunkSupplier reuse InputStreamFactory and IDataChunkSupplier and return NeuG-owned DataChunk columns. The scan handles scalar/NULL/temporal values, LIST and ARRAY nesting, projection, complete predicates with runtime parameters, multiple files, batch/full reads and ordered parallel row-group tasks.

The reader selects output columns plus all predicate dependencies before decoding, applies conservative row-group pruning, evaluates the complete predicate using the shared R5 filter and restores the requested output projection. Reader, schema and batch ownership use RAII, including failed initialization and reads. The existing callback input adapter adds bounded caching. Carquet remains a pinned submodule with an adjacent patch; the additions restore fixed-size-list metadata and select nested top-level fields before decoding.

Production Parquet registration still uses Arrow. No public IO, compiler, execution, CSV/JSON or existing Arrow-reader behavior is changed. The new implementation remains in the test build until the backend-switch PR. MAP schema inspection is supported, but general MAP/STRUCT values are outside this reader's supported scope. Chunk size bounds returned chunks; nested/projected/pruned paths may decode a whole row group and full reads retain their complete result.

Review map

  • schema_converter and column_converter/nested_converter: scalar, temporal and nested layout conversion.
  • chunk_supplier and input_adapter: ownership, chunk slicing, physical column/row-group selection and caching.
  • scan and row_group_pruner: schema checks, complete predicates, parameter rebinding, projection and conservative statistics.
  • Carquet supplier/scan tests and HTTPFS test: independent expected results, temporary in-memory data, resource lifetime, actual HTTP Range bytes. Existing datasets are reused; no Parquet binaries or PyArrow dependency are added to C++ tests. Fixed-size-list metadata uses a documented schema-only IPC test value.
  • doc/source/extensions/carquet_reader.md: feature status, type coverage, options, memory constraints and test instructions, linked from Parquet documentation and navigation.

Validation

  • Debug and Release: 38/38 Carquet tests, 46/46 production Parquet tests.
  • Debug and Release: 88 Python Parquet/export tests passed, 6 existing comprehensive_graph tests skipped; 6 credential-dependent HTTPFS export tests deselected.
  • The five Parquet CTest entries selected by extension_tests_default passed, including existing page-encoding and callback tests.
  • 22 HTTPFS tests passed with local loopback-server access. Range integration compares the same physical projection with pruning enabled/disabled and verifies lower actual HTTP response bytes.
  • ASan/UBSan: all 38 tests passed with all 48 Carquet C sources, 9 C++ adapter sources and 4 test sources instrumented. Existing core/dependency libraries are uninstrumented; leak detection is disabled on macOS.
  • 600 predicate/row-group combinations checked against exact evaluation; separate all-NULL/adjacent-NOT-ISNULL, nested CASE/ARRAY/LIST parameters, duplicate outputs and reordered nested projection regressions passed.
  • Debug with only parquet enabled (HTTPFS disabled) configured, built and passed Carquet tests. Existing build configuration restored afterward.
  • A fresh pinned Carquet source archive plus the adjacent patch configured and built with pkg-config disabled. Live patched files equal this fresh application. All 9 private C++ sources separately compile without Arrow include directories.
  • clang-format 10 and git diff --check passed. No submodule gitlink or local design documents are included.

These are local macOS results. Linux runners and the system-Arrow configuration still require PR CI; no local system Arrow installation is available. No push or PR creation was performed.

Base: upstream/main fc9096b (R5 merged as #1023). Branch: codex/carquet-r03-complete-reader. One cohesive feature commit: 25 files, +5397/-8 (5405 changed lines). Logs: build/review-r03-expanded-mdfpz1ah/.

Implement private scalar and nested chunk suppliers, schema sniffing, complete predicate filtering, physical projection, ordered multi-file scans and conservative row-group pruning. Preserve the public IO contract and current production Arrow registration.

Extend the adjacent Carquet patch for nested projection and fixed-size-list metadata, and add supplier, scan, HTTP Range and feature documentation coverage. Validate Debug/Release, ASan/UBSan, existing Parquet/export regressions and a clean patched Carquet build without pkg-config.
@luoxiaojian
luoxiaojian force-pushed the codex/carquet-r03-complete-reader branch from 1ff38b8 to 702ff96 Compare September 10, 2026 03:43
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
#pragma once

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

.h文件是否需要放到include目录

Comment on lines +294 to +307
if (format == "c") {
return convertPrimitive<int8_t, int32_t>(schema, array, path);
}
if (format == "s") {
return convertPrimitive<int16_t, int32_t>(schema, array, path);
}
if (format == "i") {
return convertPrimitive<int32_t, int32_t>(schema, array, path);
}
if (format == "C") {
return convertPrimitive<uint8_t, uint32_t>(schema, array, path);
}
if (format == "S") {
return convertPrimitive<uint16_t, uint32_t>(schema, array, path);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

[P1] 8/16 位整数的读取宽度与 Carquet 实际缓冲区不一致
新增转换器按 int8_t/int16_t 等类型读取,但固定版本 Carquet 的两个导出路径仍将这些 Parquet 整数按 INT32、每值 4 字节存放,仅 schema 标记为 8/16 位。因此读取步长错误,后续值会变成前一个整数的部分字节。

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants