From b2d459d9b7893283990065bc25da2e1b5503b8d3 Mon Sep 17 00:00:00 2001 From: aykut-bozkurt <51649454+aykut-bozkurt@users.noreply.github.com> Date: Wed, 11 Sep 2024 14:53:01 +0300 Subject: [PATCH] bump pgrx to 0.12.3 (#20) --- .github/workflows/ci.yml | 2 +- Cargo.toml | 10 +- src/arrow_parquet/arrow_to_pg.rs | 192 ++-- src/arrow_parquet/arrow_to_pg/date.rs | 2 +- src/arrow_parquet/arrow_to_pg/map.rs | 25 +- src/arrow_parquet/arrow_to_pg/time.rs | 2 +- src/arrow_parquet/arrow_to_pg/timestamp.rs | 2 +- src/arrow_parquet/arrow_to_pg/timestamptz.rs | 2 +- src/arrow_parquet/arrow_to_pg/timetz.rs | 2 +- src/arrow_parquet/parquet_writer.rs | 8 +- src/arrow_parquet/pg_to_arrow.rs | 846 ++++++++++-------- src/arrow_parquet/pg_to_arrow/bool.rs | 11 +- src/arrow_parquet/pg_to_arrow/bytea.rs | 14 +- src/arrow_parquet/pg_to_arrow/char.rs | 11 +- src/arrow_parquet/pg_to_arrow/date.rs | 13 +- .../pg_to_arrow/fallback_to_text.rs | 13 +- src/arrow_parquet/pg_to_arrow/float4.rs | 11 +- src/arrow_parquet/pg_to_arrow/float8.rs | 11 +- src/arrow_parquet/pg_to_arrow/geometry.rs | 11 +- src/arrow_parquet/pg_to_arrow/int2.rs | 11 +- src/arrow_parquet/pg_to_arrow/int4.rs | 11 +- src/arrow_parquet/pg_to_arrow/int8.rs | 11 +- src/arrow_parquet/pg_to_arrow/map.rs | 46 +- src/arrow_parquet/pg_to_arrow/numeric.rs | 11 +- src/arrow_parquet/pg_to_arrow/oid.rs | 11 +- src/arrow_parquet/pg_to_arrow/record.rs | 33 +- src/arrow_parquet/pg_to_arrow/text.rs | 11 +- src/arrow_parquet/pg_to_arrow/time.rs | 13 +- src/arrow_parquet/pg_to_arrow/timestamp.rs | 13 +- src/arrow_parquet/pg_to_arrow/timestamptz.rs | 15 +- src/arrow_parquet/pg_to_arrow/timetz.rs | 15 +- src/bin/pgrx_embed.rs | 2 + src/lib.rs | 151 ++-- src/parquet_copy_hook/copy_from.rs | 25 +- src/parquet_copy_hook/copy_to.rs | 16 +- .../copy_to_dest_receiver.rs | 12 +- src/parquet_copy_hook/copy_utils.rs | 97 +- src/parquet_copy_hook/hook.rs | 217 +++-- src/pgrx_missing_declerations.rs | 52 ++ src/type_compat/fallback_to_text.rs | 22 + src/type_compat/geometry.rs | 31 +- src/type_compat/map.rs | 39 +- src/type_compat/pg_arrow_type_conversions.rs | 50 +- 43 files changed, 1132 insertions(+), 971 deletions(-) create mode 100644 src/bin/pgrx_embed.rs create mode 100644 src/pgrx_missing_declerations.rs diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6041291..fbeed55 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -47,7 +47,7 @@ jobs: - name: Install and configure pgrx run: | - cargo install --locked cargo-pgrx@0.11.4 + cargo install --locked cargo-pgrx@0.12.3 cargo pgrx init --pg16 $(which pg_config) - name: Format and lint diff --git a/Cargo.toml b/Cargo.toml index 4639ec4..ba6f061 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,11 @@ version = "0.1.0" edition = "2021" [lib] -crate-type = ["cdylib"] +crate-type = ["cdylib","lib"] + +[[bin]] +name = "pgrx_embed_pg_parquet" +path = "./src/bin/pgrx_embed.rs" [features] default = ["pg16"] @@ -26,13 +30,13 @@ parquet = {version = "53", default-features = false, features = [ "zstd", "object_store", ]} -pgrx = "=0.11.4" +pgrx = "=0.12.3" serde = {version = "1", default-features = false} serde_json = "1" tokio = {version = "1", default-features = false, features = ["rt", "time", "macros"]} [dev-dependencies] -pgrx-tests = "=0.11.4" +pgrx-tests = "=0.12.3" [profile.dev] panic = "unwind" diff --git a/src/arrow_parquet/arrow_to_pg.rs b/src/arrow_parquet/arrow_to_pg.rs index 3f28448..608c248 100644 --- a/src/arrow_parquet/arrow_to_pg.rs +++ b/src/arrow_parquet/arrow_to_pg.rs @@ -4,13 +4,13 @@ use arrow::array::{ StructArray, Time64MicrosecondArray, TimestampMicrosecondArray, UInt32Array, }; use pgrx::{ + datum::{Date, Time, TimeWithTimeZone, Timestamp, TimestampWithTimeZone}, pg_sys::{ Datum, Oid, BOOLOID, BYTEAOID, CHAROID, DATEOID, FLOAT4OID, FLOAT8OID, INT2OID, INT4OID, INT8OID, NUMERICOID, OIDOID, TEXTOID, TIMEOID, TIMESTAMPOID, TIMESTAMPTZOID, TIMETZOID, }, prelude::PgHeapTuple, - AllocatedByRust, AnyNumeric, Date, IntoDatum, PgTupleDesc, Time, TimeWithTimeZone, Timestamp, - TimestampWithTimeZone, + AllocatedByRust, AnyNumeric, IntoDatum, PgTupleDesc, }; use crate::{ @@ -92,35 +92,22 @@ pub(crate) fn to_pg_datum( attribute_typoid: Oid, attribute_typmod: i32, ) -> Option { - if is_composite_type(attribute_typoid) { - let attribute_tupledesc = tuple_desc(attribute_typoid, attribute_typmod); - - let attribute_context = - ArrowToPgPerAttributeContext::new(attribute_typoid, attribute_typmod) - .with_tupledesc(attribute_tupledesc); - - to_pg_composite_datum(attribute_array.into(), attribute_context) - } else if is_array_type(attribute_typoid) { + if is_array_type(attribute_typoid) { let attribute_element_typoid = array_element_typoid(attribute_typoid); let attribute_context = ArrowToPgPerAttributeContext::new(attribute_element_typoid, attribute_typmod); to_pg_array_datum(attribute_array.into(), attribute_context) - } else if is_crunchy_map_typoid(attribute_typoid) { - let attribute_context = - ArrowToPgPerAttributeContext::new(attribute_typoid, attribute_typmod); - - to_pg_map_datum(attribute_array.into(), attribute_context) } else { let attribute_context = ArrowToPgPerAttributeContext::new(attribute_typoid, attribute_typmod); - to_pg_primitive_datum(attribute_array, attribute_context) + to_pg_nonarray_datum(attribute_array, attribute_context) } } -fn to_pg_primitive_datum( +fn to_pg_nonarray_datum( primitive_array: ArrayData, attribute_context: ArrowToPgPerAttributeContext, ) -> Option { @@ -233,10 +220,41 @@ fn to_pg_primitive_datum( val.into_datum() } _ => { - if is_postgis_geometry_typoid(attribute_context.typoid) { - to_pg_geometry_datum(primitive_array.into(), attribute_context) + if is_composite_type(attribute_context.typoid) { + let attribute_tupledesc = + tuple_desc(attribute_context.typoid, attribute_context.typmod); + let attribute_context = attribute_context.with_tupledesc(attribute_tupledesc); + + let val = as ArrowArrayToPgType< + StructArray, + PgHeapTuple, + >>::to_pg_type(primitive_array.into(), attribute_context); + + val.into_datum() + } else if is_crunchy_map_typoid(attribute_context.typoid) { + let val = >::to_pg_type( + primitive_array.into(), + attribute_context, + ); + + val.into_datum() + } else if is_postgis_geometry_typoid(attribute_context.typoid) { + let val = >::to_pg_type( + primitive_array.into(), + attribute_context, + ); + + val.into_datum() } else { - to_pg_fallback_to_text_datum(primitive_array.into(), attribute_context) + reset_fallback_to_text_context(attribute_context.typoid, attribute_context.typmod); + + let val = + >::to_pg_type( + primitive_array.into(), + attribute_context, + ); + + val.into_datum() } } } @@ -372,120 +390,40 @@ fn to_pg_array_datum( if is_composite_type(attribute_context.typoid) { let attribute_tupledesc = tuple_desc(attribute_context.typoid, attribute_context.typmod); + let attribute_context = attribute_context.with_tupledesc(attribute_tupledesc); - to_pg_composite_array_datum( - list_array.into(), - attribute_context.with_tupledesc(attribute_tupledesc), - ) - } else if is_crunchy_map_typoid(attribute_context.typoid) { - to_pg_map_array_datum(list_array.into(), attribute_context) - } else if is_postgis_geometry_typoid(attribute_context.typoid) { - to_pg_geometry_array_datum(list_array.into(), attribute_context) - } else { - to_pg_fallback_to_text_array_datum(list_array.into(), attribute_context) - } - } - } -} - -fn to_pg_composite_datum( - struct_array: StructArray, - attribute_context: ArrowToPgPerAttributeContext, -) -> Option { - let val = as ArrowArrayToPgType< - StructArray, - PgHeapTuple, - >>::to_pg_type(struct_array, attribute_context); - - val.into_datum() -} + let val = >> as ArrowArrayToPgType< + StructArray, + Vec>>, + >>::to_pg_type(list_array.into(), attribute_context); -fn to_pg_composite_array_datum( - struct_array: StructArray, - attribute_context: ArrowToPgPerAttributeContext, -) -> Option { - let val = >> as ArrowArrayToPgType< - StructArray, - Vec>>, - >>::to_pg_type(struct_array, attribute_context); - - val.into_datum() -} - -fn to_pg_map_datum( - map_array: MapArray, - attribute_context: ArrowToPgPerAttributeContext, -) -> Option { - let val = >::to_pg_type( - map_array, - attribute_context, - ); - - val.into_datum() -} - -fn to_pg_map_array_datum( - map_array: MapArray, - attribute_context: ArrowToPgPerAttributeContext, -) -> Option { - let val = > as ArrowArrayToPgType>>>::to_pg_type( - map_array, - attribute_context, - ); - - val.into_datum() -} - -fn to_pg_geometry_datum( - geometry_array: BinaryArray, - attribute_context: ArrowToPgPerAttributeContext, -) -> Option { - let val = >::to_pg_type( - geometry_array, - attribute_context, - ); - - val.into_datum() -} + val.into_datum() + } else if is_crunchy_map_typoid(attribute_context.typoid) { + let val = > as ArrowArrayToPgType< + MapArray, + Vec>, + >>::to_pg_type(list_array.into(), attribute_context); -fn to_pg_geometry_array_datum( - geometry_array: BinaryArray, - attribute_context: ArrowToPgPerAttributeContext, -) -> Option { - let val = > as ArrowArrayToPgType< + val.into_datum() + } else if is_postgis_geometry_typoid(attribute_context.typoid) { + let val = > as ArrowArrayToPgType< BinaryArray, Vec>, - >>::to_pg_type(geometry_array, attribute_context); - - val.into_datum() -} - -fn to_pg_fallback_to_text_datum( - text_array: StringArray, - attribute_context: ArrowToPgPerAttributeContext, -) -> Option { - reset_fallback_to_text_context(attribute_context.typoid, attribute_context.typmod); + >>::to_pg_type(list_array.into(), attribute_context); - let val = >::to_pg_type( - text_array, - attribute_context, - ); - - val.into_datum() -} - -fn to_pg_fallback_to_text_array_datum( - text_array: StringArray, - attribute_context: ArrowToPgPerAttributeContext, -) -> Option { - reset_fallback_to_text_context(attribute_context.typoid, attribute_context.typmod); + val.into_datum() + } else { + reset_fallback_to_text_context(attribute_context.typoid, attribute_context.typmod); - let val = > as ArrowArrayToPgType< - StringArray, - Vec>, - >>::to_pg_type(text_array, attribute_context); + let val = > as ArrowArrayToPgType< + StringArray, + Vec>, + >>::to_pg_type(list_array.into(), attribute_context); - val.into_datum() + val.into_datum() + } + } + } } fn to_pg_numeric_datum( diff --git a/src/arrow_parquet/arrow_to_pg/date.rs b/src/arrow_parquet/arrow_to_pg/date.rs index 2ba6bcc..7505de4 100644 --- a/src/arrow_parquet/arrow_to_pg/date.rs +++ b/src/arrow_parquet/arrow_to_pg/date.rs @@ -1,5 +1,5 @@ use arrow::array::{Array, Date32Array}; -use pgrx::Date; +use pgrx::datum::Date; use crate::type_compat::pg_arrow_type_conversions::i32_to_date; diff --git a/src/arrow_parquet/arrow_to_pg/map.rs b/src/arrow_parquet/arrow_to_pg/map.rs index a76d05b..a24fd73 100644 --- a/src/arrow_parquet/arrow_to_pg/map.rs +++ b/src/arrow_parquet/arrow_to_pg/map.rs @@ -1,5 +1,5 @@ use arrow::array::{Array, MapArray, StructArray}; -use pgrx::{prelude::PgHeapTuple, AllocatedByRust}; +use pgrx::{prelude::PgHeapTuple, AllocatedByRust, FromDatum, IntoDatum}; use crate::{ pgrx_utils::{domain_array_base_elem_typoid, tuple_desc}, @@ -32,9 +32,14 @@ impl<'b, 'a: 'b> ArrowArrayToPgType<'b, MapArray, CrunchyMap<'a>> for CrunchyMap >>::to_pg_type(entries_array, entries_context); if let Some(entries) = entries { - // entries cannot be null if the map is not null (arrow does not allow it) - let entries = entries.into_iter().flatten().collect(); - Some(CrunchyMap { entries }) + let entries_datum = entries.into_datum(); + + if let Some(entries_datum) = entries_datum { + let entries = unsafe { pgrx::Array::from_datum(entries_datum, false).unwrap() }; + Some(CrunchyMap { entries }) + } else { + None + } } else { None } @@ -67,9 +72,15 @@ impl<'b, 'a: 'b> ArrowArrayToPgType<'b, MapArray, Vec>>> >>::to_pg_type(entries_array, entries_context.clone()); if let Some(entries) = entries { - // entries cannot be null if the map is not null (arrow does not allow it) - let entries = entries.into_iter().flatten().collect(); - maps.push(Some(CrunchyMap { entries })); + let entries_datum = entries.into_datum(); + + if let Some(entries_datum) = entries_datum { + let entries = + unsafe { pgrx::Array::from_datum(entries_datum, false).unwrap() }; + maps.push(Some(CrunchyMap { entries })) + } else { + maps.push(None); + } } else { maps.push(None); } diff --git a/src/arrow_parquet/arrow_to_pg/time.rs b/src/arrow_parquet/arrow_to_pg/time.rs index cdb87fb..77a6e06 100644 --- a/src/arrow_parquet/arrow_to_pg/time.rs +++ b/src/arrow_parquet/arrow_to_pg/time.rs @@ -1,5 +1,5 @@ use arrow::array::{Array, Time64MicrosecondArray}; -use pgrx::Time; +use pgrx::datum::Time; use crate::type_compat::pg_arrow_type_conversions::i64_to_time; diff --git a/src/arrow_parquet/arrow_to_pg/timestamp.rs b/src/arrow_parquet/arrow_to_pg/timestamp.rs index b26d0e9..01a49da 100644 --- a/src/arrow_parquet/arrow_to_pg/timestamp.rs +++ b/src/arrow_parquet/arrow_to_pg/timestamp.rs @@ -1,5 +1,5 @@ use arrow::array::{Array, TimestampMicrosecondArray}; -use pgrx::Timestamp; +use pgrx::datum::Timestamp; use crate::type_compat::pg_arrow_type_conversions::i64_to_timestamp; diff --git a/src/arrow_parquet/arrow_to_pg/timestamptz.rs b/src/arrow_parquet/arrow_to_pg/timestamptz.rs index cbf3235..f2cc340 100644 --- a/src/arrow_parquet/arrow_to_pg/timestamptz.rs +++ b/src/arrow_parquet/arrow_to_pg/timestamptz.rs @@ -1,5 +1,5 @@ use arrow::array::{Array, TimestampMicrosecondArray}; -use pgrx::TimestampWithTimeZone; +use pgrx::datum::TimestampWithTimeZone; use crate::type_compat::pg_arrow_type_conversions::i64_to_timestamptz; diff --git a/src/arrow_parquet/arrow_to_pg/timetz.rs b/src/arrow_parquet/arrow_to_pg/timetz.rs index 184c688..154f021 100644 --- a/src/arrow_parquet/arrow_to_pg/timetz.rs +++ b/src/arrow_parquet/arrow_to_pg/timetz.rs @@ -1,5 +1,5 @@ use arrow::array::{Array, Time64MicrosecondArray}; -use pgrx::TimeWithTimeZone; +use pgrx::datum::TimeWithTimeZone; use crate::type_compat::pg_arrow_type_conversions::i64_to_timetz; diff --git a/src/arrow_parquet/parquet_writer.rs b/src/arrow_parquet/parquet_writer.rs index 1f067ac..e1b1562 100644 --- a/src/arrow_parquet/parquet_writer.rs +++ b/src/arrow_parquet/parquet_writer.rs @@ -102,8 +102,6 @@ fn collect_arrow_attribute_arrays_from_tupledesc( let mut tuple_attribute_arrow_arrays = vec![]; - let mut tuples = tuples; - for attribute in attributes { let attribute_name = attribute.name(); let attribute_typoid = attribute.type_oid().value(); @@ -112,16 +110,14 @@ fn collect_arrow_attribute_arrays_from_tupledesc( .field_with_name(attribute_name) .expect("Expected attribute field"); - let (field, array, tups) = collect_attribute_array_from_tuples( - tuples, - tupledesc.clone(), + let (field, array) = collect_attribute_array_from_tuples( + &tuples, attribute_name, attribute_typoid, attribute_typmod, Arc::new(attribute_field.clone()), ); - tuples = tups; let tuple_attribute_arrow_array = (field, array); tuple_attribute_arrow_arrays.push(tuple_attribute_arrow_array); diff --git a/src/arrow_parquet/pg_to_arrow.rs b/src/arrow_parquet/pg_to_arrow.rs index a70c2be..eb59f92 100644 --- a/src/arrow_parquet/pg_to_arrow.rs +++ b/src/arrow_parquet/pg_to_arrow.rs @@ -1,17 +1,16 @@ use arrow::{array::ArrayRef, datatypes::FieldRef}; use pgrx::{ + datum::{Date, Time, TimeWithTimeZone, Timestamp, TimestampWithTimeZone, UnboxDatum}, heap_tuple::PgHeapTuple, pg_sys::{ - self, deconstruct_array, heap_getattr, Datum, Oid, BOOLOID, BYTEAOID, CHAROID, DATEOID, - FLOAT4OID, FLOAT8OID, INT2OID, INT4OID, INT8OID, NUMERICOID, OIDOID, TEXTOID, TIMEOID, - TIMESTAMPOID, TIMESTAMPTZOID, TIMETZOID, + Oid, BOOLOID, BYTEAOID, CHAROID, DATEOID, FLOAT4OID, FLOAT8OID, INT2OID, INT4OID, INT8OID, + NUMERICOID, OIDOID, TEXTOID, TIMEOID, TIMESTAMPOID, TIMESTAMPTZOID, TIMETZOID, }, - AllocatedByRust, AnyNumeric, Date, FromDatum, IntoDatum, PgBox, PgTupleDesc, Time, - TimeWithTimeZone, Timestamp, TimestampWithTimeZone, + AllocatedByRust, AnyNumeric, FromDatum, IntoDatum, }; use crate::{ - pgrx_utils::{array_element_typoid, is_array_type, is_composite_type, tuple_desc}, + pgrx_utils::{array_element_typoid, is_array_type, is_composite_type}, type_compat::{ fallback_to_text::{reset_fallback_to_text_context, FallbackToText}, geometry::{is_postgis_geometry_typoid, Geometry}, @@ -44,7 +43,7 @@ pub(crate) mod timestamp; pub(crate) mod timestamptz; pub(crate) mod timetz; -pub(crate) trait PgTypeToArrowArray { +pub(crate) trait PgTypeToArrowArray { fn to_arrow_array(self, context: PgToArrowPerAttributeContext) -> (FieldRef, ArrayRef); } @@ -53,7 +52,6 @@ pub(crate) struct PgToArrowPerAttributeContext<'a> { field: FieldRef, typoid: Oid, typmod: i32, - tupledesc: Option>, scale: Option, precision: Option, } @@ -65,17 +63,11 @@ impl<'a> PgToArrowPerAttributeContext<'a> { field, typoid, typmod, - tupledesc: None, scale: None, precision: None, } } - fn with_tupledesc(mut self, tupledesc: PgTupleDesc<'a>) -> Self { - self.tupledesc = Some(tupledesc); - self - } - fn with_scale(mut self, scale: usize) -> Self { self.scale = Some(scale); self @@ -87,31 +79,14 @@ impl<'a> PgToArrowPerAttributeContext<'a> { } } -pub(crate) fn collect_attribute_array_from_tuples<'a>( - tuples: Vec>>, - tupledesc: PgTupleDesc<'a>, - attribute_name: &'a str, +pub(crate) fn collect_attribute_array_from_tuples<'tup>( + tuples: &'tup [Option>], + attribute_name: &'tup str, attribute_typoid: Oid, attribute_typmod: i32, attribute_field: FieldRef, -) -> ( - FieldRef, - ArrayRef, - Vec>>, -) { - if is_composite_type(attribute_typoid) { - let attribute_tupledesc = tuple_desc(attribute_typoid, attribute_typmod); - - let attribute_context = PgToArrowPerAttributeContext::new( - attribute_name, - attribute_typoid, - attribute_typmod, - attribute_field, - ) - .with_tupledesc(attribute_tupledesc); - - collect_tuple_attribute_array_from_tuples_helper(tuples, tupledesc, attribute_context) - } else if is_array_type(attribute_typoid) { +) -> (FieldRef, ArrayRef) { + if is_array_type(attribute_typoid) { let attribute_element_typoid = array_element_typoid(attribute_typoid); let attribute_context = PgToArrowPerAttributeContext::new( @@ -121,19 +96,7 @@ pub(crate) fn collect_attribute_array_from_tuples<'a>( attribute_field, ); - collect_array_attribute_array_from_tuples(tuples, tupledesc, attribute_context) - } else if is_crunchy_map_typoid(attribute_typoid) { - let attribute_context = PgToArrowPerAttributeContext::new( - attribute_name, - attribute_typoid, - attribute_typmod, - attribute_field, - ); - - collect_array_attribute_array_from_tuples_helper::>( - tuples, - attribute_context, - ) + collect_array_attribute_array_from_tuples(tuples, attribute_context) } else { let attribute_context = PgToArrowPerAttributeContext::new( attribute_name, @@ -142,426 +105,563 @@ pub(crate) fn collect_attribute_array_from_tuples<'a>( attribute_field, ); - collect_primitive_attribute_array_from_tuples(tuples, attribute_context) + collect_nonarray_attribute_array_from_tuples(tuples, attribute_context) } } -fn collect_primitive_attribute_array_from_tuples<'a>( - tuples: Vec>>, - attribute_context: PgToArrowPerAttributeContext<'a>, -) -> ( - FieldRef, - ArrayRef, - Vec>>, -) { +fn collect_nonarray_attribute_array_from_tuples<'tup>( + tuples: &'tup [Option>], + attribute_context: PgToArrowPerAttributeContext<'tup>, +) -> (FieldRef, ArrayRef) { match attribute_context.typoid { FLOAT4OID => { - collect_array_attribute_array_from_tuples_helper::(tuples, attribute_context) + let mut attribute_values: Vec> = Vec::new(); + + collect_attribute_array_from_tuples_helper( + tuples, + &attribute_context, + &mut attribute_values, + ); + + let (field, array) = attribute_values.to_arrow_array(attribute_context); + (field, array) } FLOAT8OID => { - collect_array_attribute_array_from_tuples_helper::(tuples, attribute_context) + let mut attribute_values: Vec> = Vec::new(); + + collect_attribute_array_from_tuples_helper( + tuples, + &attribute_context, + &mut attribute_values, + ); + + let (field, array) = attribute_values.to_arrow_array(attribute_context); + (field, array) } INT2OID => { - collect_array_attribute_array_from_tuples_helper::(tuples, attribute_context) + let mut attribute_values: Vec> = Vec::new(); + + collect_attribute_array_from_tuples_helper( + tuples, + &attribute_context, + &mut attribute_values, + ); + + let (field, array) = attribute_values.to_arrow_array(attribute_context); + (field, array) } INT4OID => { - collect_array_attribute_array_from_tuples_helper::(tuples, attribute_context) + let mut attribute_values: Vec> = Vec::new(); + + collect_attribute_array_from_tuples_helper( + tuples, + &attribute_context, + &mut attribute_values, + ); + + let (field, array) = attribute_values.to_arrow_array(attribute_context); + (field, array) } INT8OID => { - collect_array_attribute_array_from_tuples_helper::(tuples, attribute_context) + let mut attribute_values: Vec> = Vec::new(); + + collect_attribute_array_from_tuples_helper( + tuples, + &attribute_context, + &mut attribute_values, + ); + + let (field, array) = attribute_values.to_arrow_array(attribute_context); + (field, array) } NUMERICOID => { let precision = extract_precision_from_numeric_typmod(attribute_context.typmod); if precision > MAX_DECIMAL_PRECISION { reset_fallback_to_text_context(attribute_context.typoid, attribute_context.typmod); - collect_array_attribute_array_from_tuples_helper::( + + let mut attribute_values: Vec> = Vec::new(); + + collect_attribute_array_from_tuples_helper( tuples, - attribute_context, - ) + &attribute_context, + &mut attribute_values, + ); + + let (field, array) = attribute_values.to_arrow_array(attribute_context); + (field, array) } else { - collect_array_attribute_array_from_tuples_helper::( + let mut attribute_values: Vec> = Vec::new(); + + collect_attribute_array_from_tuples_helper( tuples, - attribute_context, - ) + &attribute_context, + &mut attribute_values, + ); + + let (field, array) = attribute_values.to_arrow_array(attribute_context); + (field, array) } } BOOLOID => { - collect_array_attribute_array_from_tuples_helper::(tuples, attribute_context) + let mut attribute_values: Vec> = Vec::new(); + + collect_attribute_array_from_tuples_helper( + tuples, + &attribute_context, + &mut attribute_values, + ); + + let (field, array) = attribute_values.to_arrow_array(attribute_context); + (field, array) } DATEOID => { - collect_array_attribute_array_from_tuples_helper::(tuples, attribute_context) + let mut attribute_values: Vec> = Vec::new(); + + collect_attribute_array_from_tuples_helper( + tuples, + &attribute_context, + &mut attribute_values, + ); + + let (field, array) = attribute_values.to_arrow_array(attribute_context); + (field, array) } TIMEOID => { - collect_array_attribute_array_from_tuples_helper::