GH-45937: [C++][Parquet] support to read, write and validate variant - #50252
GH-45937: [C++][Parquet] support to read, write and validate variant#50252HuaHuaY wants to merge 13 commits into
Conversation
b186aeb to
f8d6cb9
Compare
| return field->type()->storage_id() == Type::BINARY || | ||
| field->type()->storage_id() == Type::LARGE_BINARY; | ||
|
|
||
| bool IsSupportedPrimitiveTypedValue(const std::shared_ptr<DataType>& type) { |
There was a problem hiding this comment.
It seems that some Arrow primitive types are missing from here: https://arrow.apache.org/docs/format/CanonicalExtensions.html#primitive-type-mappings
There was a problem hiding this comment.
This issue is still under discussion; those interested, please head over to #50622
c5c54dc to
a16f004
Compare
9086570 to
63e8a1a
Compare
de57207 to
c343ded
Compare
|
|
||
| if(MSVC) | ||
| set_source_files_properties(variant/builder.cc variant/slot_internal.cc | ||
| PROPERTIES COMPILE_OPTIONS /Zc:preprocessor) |
There was a problem hiding this comment.
Probably? I would try it on a different PR, as suggested, and investigate whether we can drop:
arrow/cpp/cmake_modules/SetupCxxFlags.cmake
Lines 221 to 236 in 374db36
|
@pitrou @emkornfield Can you help to review the API design? I’ve tried to keep the code concise, but this is still a huge PR. I’d like to focus on the overall API design for now, and then I’ll break this PR down into several smaller ones. I include brief introductions to each module in the PR description. |
@HuaHuaY thanks for the PR. Which files contain the API design we should focus on? |
I'm sorry what I said earlier wasn't clear enough. I would like your help reviewing whether the implementation approach is appropriate and whether the provided interfaces are easy to use. As for specific code details, we can review those later in smaller, separate PRs. You can start by reviewing these header files, and I consider them to be the parts directly used by the user:
|
Rationale for this change
This PR supports:
This PR does not support:
typed_valueshredded data from thevaluearrayWhat changes are included in this PR?
variant/format_internal.h:Define some type-related traits and concepts.
variant/builder.h .cc:Add builders for encoded Variant values, arrays, nested objects and lists, and residual value arrays. This part shares a similar design with
arrow-rs, but differs slightly because C++ lacksenumtypes that hold values. It employs a single-buffer builder design and also supports nested builder APIs. Some previous discussions: [C++][Parquet] Encoding tools for variant type #46555variant/decoding.h .cc:Add zero-copy views with shallow parsing and recursive validation.
variant/shred.h .cc:Convert an unshredded
VariantArrayinto a requested primitive, object, or listtyped_valuelayout while retaining incompatible values in residualvalue.variant/unshred.h .cc:Reconstruct encoded Variant values from shredded storage.
variant/validate.h .cc:Validate nested Variant arrays using strict writer rules or read-compatible rules. To avoid too much materialization of bitmaps, this module employs a two-pass design: first constructing the plan and finding variant, then executing it.
variant/slot_internal.h .cc:Compile shredded storage layouts and process primitive, object, and list slots for validation and unshredding. This is a common module used by
unshredandvalidate.Some code use
template <bool strict>because some schemas are read-compatible but do not support writing. For details, please see apache/parquet-format#591Are these changes tested?
Yes.
Are there any user-facing changes?
ArrowReaderPropertiesaddsset_variant_validation_enabled().ArrowWriterProperties::Builderaddsset_variant_validation_enabled(). Validation is enabled by default.