From 23f8c28d0fc7e1a15e211ee04728a36520d0c532 Mon Sep 17 00:00:00 2001 From: WindSoilder Date: Thu, 16 Feb 2023 15:17:38 +0800 Subject: [PATCH] Updated base64 to 0.21 (#1408) * dependency update: update base64 to 0.21 * fmt code --- Cargo.toml | 2 +- src/io/parquet/read/schema/metadata.rs | 3 ++- src/io/parquet/write/schema.rs | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 87ac73f1a49..eb1c1017ba6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -69,7 +69,7 @@ rand = { version = "0.8", optional = true } itertools = { version = "^0.10", optional = true } -base64 = { version = "0.13.0", optional = true } +base64 = { version = "0.21.0", optional = true } # to write to parquet as a stream futures = { version = "0.3", optional = true } diff --git a/src/io/parquet/read/schema/metadata.rs b/src/io/parquet/read/schema/metadata.rs index 2595083f44e..1df6e7b2af2 100644 --- a/src/io/parquet/read/schema/metadata.rs +++ b/src/io/parquet/read/schema/metadata.rs @@ -1,3 +1,4 @@ +use base64::{engine::general_purpose, Engine as _}; pub use parquet2::metadata::KeyValue; use crate::datatypes::{Metadata, Schema}; @@ -18,7 +19,7 @@ pub fn read_schema_from_metadata(metadata: &mut Metadata) -> Result Result { - let decoded = base64::decode(encoded_meta); + let decoded = general_purpose::STANDARD.decode(encoded_meta); match decoded { Ok(bytes) => { let slice = if bytes[0..4] == [255u8; 4] { diff --git a/src/io/parquet/write/schema.rs b/src/io/parquet/write/schema.rs index 248397d2414..ee60e98ac13 100644 --- a/src/io/parquet/write/schema.rs +++ b/src/io/parquet/write/schema.rs @@ -1,3 +1,4 @@ +use base64::{engine::general_purpose, Engine as _}; use parquet2::{ metadata::KeyValue, schema::{ @@ -30,7 +31,7 @@ pub fn schema_to_metadata_key(schema: &Schema) -> KeyValue { len_prefix_schema.extend_from_slice(&(schema_len as u32).to_le_bytes()); len_prefix_schema.extend_from_slice(&serialized_schema); - let encoded = base64::encode(&len_prefix_schema); + let encoded = general_purpose::STANDARD.encode(&len_prefix_schema); KeyValue { key: ARROW_SCHEMA_META_KEY.to_string(),