Replace the logical codec's object registry with durable metadata
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 74/100
Hướng nghiên cứu
Bắt đầu trong examples/datafusion-ffi-example/src/logical_extension_codec.rs tại try_encode_table_provider và so sánh cách tiếp cận IPC trong examples/distributed/storage-library/src/codec.rs. Cập nhật python/tests/_test_logical_extension_codec.py, bao gồm assertion về codec trước đó và một test giải mã hai lần. Được xem là hoàn tất khi registry và mã token đã bị xóa, provider_prefix được sử dụng, các test được chỉ định đều vượt qua và grep -in token không trả về gì.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
examples/datafusion-ffi-example/src/logical_extension_codec.rs parks live table providers in a process-global HashMap and encodes an integer token into it. Encoding inserts, decoding removes, so the same bytes cannot be decoded twice, one plan cannot fan out to several readers, and a plan that never reaches a decoder keeps its provider alive for the life of the process. extension-guide/codecs.md tells authors not to do this.
Unlike the physical codec in the same crate (see the quarantine sub-issue), this one is fixable: try_encode_table_provider at line 148 claims node.downcast_ref::<MemTable>(), which is narrow, and a MemTable is fully describable by its schema and batches.
Pattern to copy: examples/distributed/storage-library/src/codec.rs — same Arrow IPC technique, same error convention (internal_datafusion_err! on encode, since this process holds the object; exec_datafusion_err! on decode, since those are foreign bytes).
Verified prerequisites: MemTable.batches is pub (datafusion-catalog/src/memory/table.rs:69), typed Vec<PartitionData> where PartitionData = Arc<tokio::sync::RwLock<Vec<RecordBatch>>>. MemTable::try_new rejects zero partitions (table.rs:84). arrow is already a dependency with IPC available, so no Cargo.toml change.
Proposed wire format, keeping the per-instance prefix the dispatch tests rely on:
<provider_prefix> | b"MEMTBL1" | u32 LE n_partitions | { u32 LE ipc_len | ipc stream }*
One stream per partition, because MemTable partition boundaries become output partitions. A stream carries its schema even when empty, so an empty partition round-trips.
Two traps worth writing down before someone hits them:
- Use
try_read()on each partition lock, notblocking_read(). The FFI codec runs with a tokio runtime handle installed, andblocking_readpanics in that context. - On decode, build
MemTable::try_newfrom the IPC schema, not theschema: SchemaRefargument.try_newvalidatesschema.contains(&batch.schema()), so metadata drift would surface as a spurious mismatch. This is the opposite choice fromstorage-library/src/codec.rs:376-380, which must honour the plan's schema because it re-reads files from disk; here the batches are the payload. Worth a comment noting the contrast, since the two codecs otherwise look alike.
Done when: the registry, token_id(), and the HashMap/Mutex/OnceLock/AtomicU64 imports are gone; the struct field token is renamed provider_prefix to match the Python kwarg that already uses that name; and grep -in token over the file returns nothing.
Tests: of 19 tests in python/tests/_test_logical_extension_codec.py, one changes. test_installing_a_codec_cannot_hijack_an_earlier_codecs_objects asserts len(before) == len(after) with a comment about tokens being minted per encode; that comment becomes false and the assertion becomes weaker than reality, so it should become assert before == after. Add one test for the property the guide claims and nothing currently covers: encode once, decode twice on one session, assert both produce the same rows. All 47 tests in the planner crate should be unaffected — every assertion there is on call counters, never on payload shape.
- Ngôn ngữ chính
- Python
- Star
- 605
- Fork
- 176
- Merge trung bình
- 1 ngày 23 giờ
- Pull request đã merge (30 ngày)
- 8
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của apache/datafusion-python
-
documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
apache/datafusion-python#1726 ·
-
Độ khó 2/5 Nửa ngày Mức phù hợp với người mới 88/100
apache/datafusion-python#1691 ·
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
apache/datafusion-python#1644 ·
-
enhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 30/100
apache/datafusion-python#1737 ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 76/100
apache/datafusion-python#1735 · 1 bình luận ·
Tất cả issue của apache/datafusion-python
Issue tương tự
-
货币战争手改优先级配置缺少列表元素类型校验(P3) Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
syfoud/Simulated_Scepter#172 ·
-
A cancelled tests run makes the coverage comment workflow fail and reports it as a red check on main Đang mởarea: ci bug perceived difficulty: 3
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Nitjsefnie-Harness-Commons/daedalus#921 · 1 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
EleutherAI/lm-evaluation-harness#4207 ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 92/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
ClickHouse/clickhouse-connect#1057 ·