This is an automated email from the ASF dual-hosted git repository.
lidavidm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-adbc.git
The following commit(s) were added to refs/heads/main by this push:
new 53ae4556 chore(rust): upgrade arrow to latest (44.0.0) version (#925)
53ae4556 is described below
commit 53ae455698cd152f3c0873571fa65995c6d40728
Author: Alexandre Crayssac <[email protected]>
AuthorDate: Fri Jul 21 18:23:43 2023 +0200
chore(rust): upgrade arrow to latest (44.0.0) version (#925)
---
rust/Cargo.toml | 6 ++---
rust/src/info.rs | 73 +++++++++++++++++++++++++++++---------------------------
2 files changed, 41 insertions(+), 38 deletions(-)
diff --git a/rust/Cargo.toml b/rust/Cargo.toml
index 8fb50866..dc7a37dd 100644
--- a/rust/Cargo.toml
+++ b/rust/Cargo.toml
@@ -30,9 +30,9 @@ keywords = ["arrow", "database", "sql"]
# See more keys and their definitions at
https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
-arrow-array = { version = "34.0.0", default-features = false}
-arrow-schema = { version = "34.0.0", features = ["ffi"], default-features =
false}
-arrow-data = { version = "34.0.0", features = ["ffi"], default-features =
false}
+arrow-array = { version = "44.0.0", default-features = false}
+arrow-schema = { version = "44.0.0", features = ["ffi"], default-features =
false}
+arrow-data = { version = "44.0.0", features = ["ffi"], default-features =
false}
async-trait = "0.1"
libloading = "0.7"
num_enum = "0.5"
diff --git a/rust/src/info.rs b/rust/src/info.rs
index 6a30dddd..7ccf6045 100644
--- a/rust/src/info.rs
+++ b/rust/src/info.rs
@@ -27,7 +27,7 @@ use arrow_array::cast::{as_primitive_array, as_string_array,
as_union_array};
use arrow_array::types::UInt32Type;
use arrow_array::{Array, ArrayRef, UnionArray};
use arrow_array::{RecordBatch, RecordBatchIterator, RecordBatchReader};
-use arrow_schema::{ArrowError, DataType, Field, Schema, UnionMode};
+use arrow_schema::{ArrowError, DataType, Field, Fields, Schema, UnionFields,
UnionMode};
use num_enum::{FromPrimitive, IntoPrimitive};
use once_cell::sync::Lazy;
use std::{borrow::Cow, collections::HashMap, sync::Arc};
@@ -59,41 +59,43 @@ static INFO_SCHEMA: Lazy<Arc<Schema>> = Lazy::new(|| {
Field::new(
"info_value",
DataType::Union(
- vec![
- Field::new("string_value", DataType::Utf8, true),
- Field::new("bool_value", DataType::Boolean, true),
- Field::new("int64_value", DataType::Int64, true),
- Field::new("int32_bitmask", DataType::Int32, true),
- Field::new(
- "string_list",
- DataType::List(Box::new(Field::new("item",
DataType::Utf8, true))),
- true,
- ),
- Field::new(
- "int32_to_int32_list_map",
- DataType::Map(
- Box::new(Field::new(
- "entries",
- DataType::Struct(vec![
- Field::new("keys", DataType::Int32, false),
- Field::new(
- "values",
- DataType::List(Box::new(Field::new(
- "item",
- DataType::Int32,
+ UnionFields::new(
+ vec![0, 1, 2, 3, 4, 5],
+ vec![
+ Field::new("string_value", DataType::Utf8, true),
+ Field::new("bool_value", DataType::Boolean, true),
+ Field::new("int64_value", DataType::Int64, true),
+ Field::new("int32_bitmask", DataType::Int32, true),
+ Field::new(
+ "string_list",
+ DataType::List(Arc::new(Field::new("item",
DataType::Utf8, true))),
+ true,
+ ),
+ Field::new(
+ "int32_to_int32_list_map",
+ DataType::Map(
+ Arc::new(Field::new(
+ "entries",
+ DataType::Struct(Fields::from(vec![
+ Field::new("keys", DataType::Int32,
false),
+ Field::new(
+ "values",
+ DataType::List(Arc::new(Field::new(
+ "item",
+ DataType::Int32,
+ true,
+ ))),
true,
- ))),
- true,
- ),
- ]),
+ ),
+ ])),
+ false,
+ )),
false,
- )),
- false,
+ ),
+ true,
),
- true,
- ),
- ],
- vec![0, 1, 2, 3, 4, 5],
+ ],
+ ),
UnionMode::Dense,
),
true,
@@ -167,15 +169,16 @@ pub fn export_info_data(
let info_schema = INFO_SCHEMA.clone();
let union_fields = {
match info_schema.field(1).data_type() {
- DataType::Union(fields, _, _) => fields,
+ DataType::Union(fields, _) => fields,
_ => unreachable!(),
}
};
let children = union_fields
.iter()
- .map(|f| f.to_owned())
+ .map(|f| (**f.1).clone())
.zip(arrays.into_iter())
.collect();
+
let info_value = UnionArray::try_new(
&[0, 1, 2, 3, 4, 5],
type_id.finish(),