[Bug] Configured Variant shredding schema without field IDs is rejected unlike Java Paimon
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
- 68/100
Hướng nghiên cứu
Start at VariantShreddingWritePlan::FromConfiguredSchema, then trace DataTypeJsonParser::ParseRowType and DataField::FromJson. Compare the configured-schema behavior with Java Paimon’s all-or-none field-ID handling, and inspect existing Variant shredding tests. Done means omitted IDs receive deterministic traversal-order IDs, explicit IDs remain unchanged, partial IDs produce a clear rejection, and configured shredding round trips with the generated physical schema.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Search before asking
- I searched in the issues and found nothing similar.
Paimon-cpp version
- Apache Paimon C++ v0.3.0 (
efbfc848). - The problem is also present on current
main(ccfe346670f32b82d7c9139a8f3d356c33dc5b7d). - Java behavior used for comparison: Apache Paimon 1.4.2.
Minimal reproduce step
Create a logical schema with a top-level Variant column and configure variant.shreddingSchema with a valid ROW type whose fields omit every id, for example:
{
"type": "ROW",
"fields": [
{
"name": "payload",
"type": {
"type": "ROW",
"fields": [
{"name": "age", "type": "INT"},
{"name": "profile", "type": {
"type": "ROW",
"fields": [{"name": "city", "type": "STRING"}]
}}
]
}
}
]
}
Pass this value to VariantShreddingWritePlan::FromConfiguredSchema (normally through variant.shreddingSchema or its Parquet fallback option) and open a writer.
Paimon-cpp rejects the configuration while deserializing the first DataField, because DataField::FromJson unconditionally requires the id key. In an embedding engine the propagated exception is equivalent to:
key 'id' must exist
The same schema is accepted by Java Paimon 1.4.2. DataTypeJsonParser.parseDataType starts an AtomicInteger at -1 and assigns deterministic IDs in traversal order when all field IDs are omitted.
What doesn't meet your expectations?
Expected behavior
Paimon-cpp should accept the same configured Variant shredding schema JSON as Java Paimon:
- If every ROW field omits
id, assign deterministic IDs in the same traversal order as Java, starting at 0. - If every ROW field provides
id, preserve those IDs. - If IDs are only partially present, reject the schema with an explicit diagnostic such as
Partial field id is not allowed.
Actual behavior
Paimon-cpp accepts only the second form. A valid all-ID-omitted schema accepted by Java is rejected before the Variant shredding plan can be created.
This creates a cross-language compatibility gap for engines that consume table options written by Java/Spark. Such engines must currently route an otherwise supported Variant write back to the Java SDK solely because the configured schema omits optional field IDs.
Anything else?
The mismatch comes from the generic JSON parsing path:
VariantShreddingWritePlan::FromConfiguredSchemadelegates the configured ROW JSON toDataTypeJsonParser::ParseType.DataTypeJsonParser::ParseRowTypedeserializes every ROW child as aDataField.DataField::FromJsonrequiresidunconditionally.
A contained fix could normalize the configured schema before normal DataType parsing: recursively count ID presence across ROW fields; generate preorder IDs only when none are present; preserve the current error behavior for partial IDs. Alternatively, the generic DataTypeJsonParser can implement Java's all-or-none semantics if that behavior is desired for every DataType JSON consumer.
Suggested regression coverage:
- all IDs omitted, including nested ROW/ARRAY/MAP descendants;
- all IDs explicitly present;
- partially present IDs are rejected;
- configured shredding write/read round trip uses the generated IDs in the physical Parquet schema.
This is separate from #344: that issue concerns missing IDs in the generated physical shredded Variant subtree, whereas this issue concerns parsing IDs in the user-configured logical shredding schema.
Are you willing to submit a PR?
- I'm willing to submit a PR!
- Ngôn ngữ chính
- C++
- Star
- 65
- Fork
- 29
- Merge trung bình
- 2 ngày 30 phút
- Pull request đã merge (30 ngày)
- 77
Hướng dẫn đóng góp
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/paimon-cpp
-
enhancement
apache/paimon-cpp#381 · 1 người được giao ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 30/100
apache/paimon-cpp#375 · 1 người được giao ·
-
enhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 30/100
apache/paimon-cpp#369 · 1 người được giao ·
-
enhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 45/100
apache/paimon-cpp#361 · 1 người được giao ·
-
enhancement
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
apache/paimon-cpp#325 · 1 người được giao ·
Tất cả issue của apache/paimon-cpp
Issue tương tự
-
enhancement
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
QuantStack/git2cpp#187 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
mlcommons/mobile_app_open#1182 ·
-
Needs-Triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
microsoft/winget-cli#6547 ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
AXERA-TECH/ax-llm#77 ·