mirror of
https://github.com/langchain-ai/arrow-rs.git
synced 2026-07-01 21:34:01 -04:00
Move variant interop test to Rust integration test (#7602)
# Which issue does this PR close? - Part of https://github.com/apache/arrow-rs/issues/6736 # Rationale for this change Rust integration tests (in `parquet-variant/tests`) are compiled as a external program would be compiled and thus can only use the exposed API. This helps verify that the crate is usable # What changes are included in this PR? 1. Move the tests that read/write variant values into `variant_interop` test (`cargo test --test variant_interop`) 2. Publically expose `pub` structures # Are there any user-facing changes? There are now pub APIs in the parquet-variant crate
This commit is contained in:
+1
-1
Submodule parquet-testing updated: 2dc8bf140e...b68bea40fe
@@ -30,12 +30,9 @@
|
||||
// TODO: dead code removal
|
||||
#[allow(dead_code)]
|
||||
mod decoder;
|
||||
// TODO: dead code removal
|
||||
#[allow(dead_code)]
|
||||
mod variant;
|
||||
// TODO: dead code removal
|
||||
#[allow(dead_code)]
|
||||
mod utils;
|
||||
|
||||
#[cfg(test)]
|
||||
mod test_variant;
|
||||
pub use variant::*;
|
||||
|
||||
@@ -88,7 +88,7 @@ impl OffsetSizeBytes {
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Copy, PartialEq)]
|
||||
pub(crate) struct VariantMetadataHeader {
|
||||
pub struct VariantMetadataHeader {
|
||||
version: u8,
|
||||
is_sorted: bool,
|
||||
/// Note: This is `offset_size_minus_one` + 1
|
||||
@@ -323,10 +323,16 @@ pub struct VariantArray<'m, 'v> {
|
||||
}
|
||||
|
||||
impl<'m, 'v> VariantArray<'m, 'v> {
|
||||
/// Return the length of this array
|
||||
pub fn len(&self) -> usize {
|
||||
todo!()
|
||||
}
|
||||
|
||||
/// Is the array of zero length
|
||||
pub fn is_empty(&self) -> bool {
|
||||
self.len() == 0
|
||||
}
|
||||
|
||||
pub fn values(&self) -> Result<impl Iterator<Item = Variant<'m, 'v>>, ArrowError> {
|
||||
todo!();
|
||||
#[allow(unreachable_code)] // Just to infer the return type
|
||||
|
||||
@@ -23,8 +23,8 @@
|
||||
use std::fs;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
use crate::variant::{Variant, VariantMetadata};
|
||||
use arrow_schema::ArrowError;
|
||||
use parquet_variant::{Variant, VariantMetadata};
|
||||
|
||||
fn cases_dir() -> PathBuf {
|
||||
Path::new(env!("CARGO_MANIFEST_DIR"))
|
||||
@@ -42,15 +42,14 @@ fn load_case(name: &str) -> Result<(Vec<u8>, Vec<u8>), ArrowError> {
|
||||
|
||||
fn get_primitive_cases() -> Vec<(&'static str, Variant<'static, 'static>)> {
|
||||
vec![
|
||||
("primitive_boolean_false", Variant::BooleanFalse),
|
||||
("primitive_boolean_true", Variant::BooleanTrue),
|
||||
("primitive_int8", Variant::Int8(42)),
|
||||
// Using the From<String> trait
|
||||
("primitive_string", Variant::from("This string is longer than 64 bytes and therefore does not fit in a short_string and it also includes several non ascii characters such as 🐢, 💖, ♥\u{fe0f}, 🎣 and 🤦!!")),
|
||||
// Using the From<String> trait
|
||||
("short_string", Variant::from("Less than 64 bytes (❤\u{fe0f} with utf8)")),
|
||||
// TODO Reenable when https://github.com/apache/parquet-testing/issues/81 is fixed
|
||||
// ("primitive_null", Variant::Null),
|
||||
("primitive_null", Variant::Null),
|
||||
("primitive_boolean_false", Variant::BooleanFalse),
|
||||
("primitive_boolean_true", Variant::BooleanTrue),
|
||||
("primitive_int8", Variant::Int8(42)),
|
||||
// Using the From<String> trait
|
||||
("primitive_string", Variant::from("This string is longer than 64 bytes and therefore does not fit in a short_string and it also includes several non ascii characters such as 🐢, 💖, ♥\u{fe0f}, 🎣 and 🤦!!")),
|
||||
// Using the From<String> trait
|
||||
("short_string", Variant::from("Less than 64 bytes (❤\u{fe0f} with utf8)")),
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user