Skip to content

Conversation

alamb
Copy link
Contributor

@alamb alamb commented Oct 1, 2025

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.

Rationale for this change

Basically, I was confused about the casting / conversion functions available so I want to improve the documentation

What changes are included in this PR?

  1. Improve the documentation
  2. Rename cast_to_variant module to cast so there isn't a function with the same name

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)?

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.

@github-actions github-actions bot added parquet Changes to the parquet crate parquet-variant parquet-variant* crates labels Oct 1, 2025
/// # use arrow::array::{Array, ArrayRef, Int64Array};
/// # use parquet_variant::Variant;
/// # use parquet_variant_compute::cast_to_variant::cast_to_variant;
/// # use parquet_variant_compute::cast::cast_to_variant;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I renamed this module cast so that it doesn't have the same name as the function cast_to_variant

Copy link
Contributor Author

Choose a reason for hiding this comment

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

but then it doesn't match the convention of shred_variant and unshred_variant 🤔

//! - [`variant_to_json`]: Function to convert a `VariantArray` to Arrays of JSON strings.
//! - [`cast_to_variant`]: Cast Arrow arrays to `VariantArray`.
//! - [`variant_get`]: Convert `VariantArray` (or an inner path) to ArrowArrays type
//! - [`shred_variant`]: Shred a `VariantArray`
Copy link
Contributor Author

Choose a reason for hiding this comment

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

added mention of shred and unshred

mod arrow_to_variant;
pub mod cast_to_variant;
mod cast;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

let's keep it consistent and not have pub modules, and instead pub use the parts of the API explicitly

Copy link
Contributor Author

@alamb alamb left a comment

Choose a reason for hiding this comment

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

I am not sure about this one and I ran out of time for today, so I'll try and revisit it tomorrow with a clear head

/// # use arrow::array::{Array, ArrayRef, Int64Array};
/// # use parquet_variant::Variant;
/// # use parquet_variant_compute::cast_to_variant::cast_to_variant;
/// # use parquet_variant_compute::cast::cast_to_variant;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

but then it doesn't match the convention of shred_variant and unshred_variant 🤔

@alamb alamb marked this pull request as draft October 1, 2025 21:52
@alamb alamb closed this in #8536 Oct 4, 2025
pull bot pushed a commit to yeya24/arrow-rs that referenced this pull request Oct 4, 2025
)

# 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#8531
- Closes apache#8532

# Rationale for this change

Basically, I was confused about the casting / conversion functions
available so I want to improve the documentation

# What changes are included in this PR?

1. Add documentation, improve other docs
2. Remove `pub` crates in favor of exporting only the functions/ structs
needed

# Are these changes tested?

Yes by CI
If tests are not included in your PR, please explain why (for example,
are they covered by existing tests)?

# 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.

---------

Co-authored-by: Copilot <[email protected]>
Co-authored-by: Ryan Johnson <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
parquet Changes to the parquet crate parquet-variant parquet-variant* crates
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Variant] casting functions are confusingly named
1 participant