Skip to content

Commit 2567a32

Browse files
klion26alambsdf-jkl
authored
[Variant] Fix the variant shred logic (apache#10157)
# Which issue does this PR close? <!-- We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. --> - Closes apache#10145. # What changes are included in this PR? <!-- There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR. --> - Seperate the logic for `variant_shred` and `variant_get` by introduce `shred` flag for row builder - Move some logic in `Variant::as_xxx` to `type_conversion`, and these moved code will be used when `variant_get`, `variant_shred` will use `Variant::as_xxx` - After the change, when shredding a variant, all `Variant::as_xx()` is identity function now, `Variant::Int8` can only be treated as `int8`, but not `int16`/`int32`/`int64`, etc. - Removed the `Variant::as_f16` - Add a test to cover that shred can/can't be shredded to some datatype in `test_variant_type_shredded_correctly` # Are these changes tested? <!-- We typically require tests for all PRs in order to: 1. Prevent the code from being accidentally broken by subsequent changes 2. Serve as another way to document the expected behavior of the code If tests are not included in your PR, please explain why (for example, are they covered by existing tests)? If this PR claims a performance improvement, please include evidence such as benchmark results. --> Yes, added some tests to cover the logic # Are there any user-facing changes? <!-- If there are user-facing changes then we may require documentation to be updated before approving the PR. If there are any breaking changes to public APIs, please call them out. --> Yes, some `Variant::as_xx` logic have been changed. --------- Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org> Co-authored-by: Kosta Tarasov <33369833+sdf-jkl@users.noreply.github.com>
1 parent 3e6bd62 commit 2567a32

9 files changed

Lines changed: 1606 additions & 684 deletions

File tree

‎Cargo.lock‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎parquet-variant-compute/Cargo.toml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ parquet-variant-json = { workspace = true }
3737
chrono = { workspace = true }
3838
uuid = { version = "1.18.0", features = ["v4"] }
3939
serde_json = "1.0"
40+
num-traits = { version = "0.2.19", default-features = false }
4041

4142
# uuid requires the `js` feature to run on wasm
4243
[target.'cfg(target_arch = "wasm32")'.dependencies]

0 commit comments

Comments
 (0)