Skip to content

Commit 0a0f53d

Browse files
committed
Merge remote-tracking branch 'apache/main' into alamb/upgrade_arrow_57
2 parents 17e7932 + 987f333 commit 0a0f53d

File tree

54 files changed

+1859
-723
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+1859
-723
lines changed

.github/workflows/audit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
steps:
4343
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
4444
- name: Install cargo-audit
45-
uses: taiki-e/install-action@2cdf2d81f4edfc3b41d5ddf56083c70b48ac2475 # v2.62.35
45+
uses: taiki-e/install-action@ebb229c6baa68383264f2822689b07b4916d9177 # v2.62.36
4646
with:
4747
tool: cargo-audit
4848
- name: Run audit check

.github/workflows/rust.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ jobs:
425425
sudo apt-get update -qq
426426
sudo apt-get install -y -qq clang
427427
- name: Setup wasm-pack
428-
uses: taiki-e/install-action@2cdf2d81f4edfc3b41d5ddf56083c70b48ac2475 # v2.62.35
428+
uses: taiki-e/install-action@ebb229c6baa68383264f2822689b07b4916d9177 # v2.62.36
429429
with:
430430
tool: wasm-pack
431431
- name: Run tests with headless mode
@@ -752,7 +752,7 @@ jobs:
752752
- name: Setup Rust toolchain
753753
uses: ./.github/actions/setup-builder
754754
- name: Install cargo-msrv
755-
uses: taiki-e/install-action@2cdf2d81f4edfc3b41d5ddf56083c70b48ac2475 # v2.62.35
755+
uses: taiki-e/install-action@ebb229c6baa68383264f2822689b07b4916d9177 # v2.62.36
756756
with:
757757
tool: cargo-msrv
758758

datafusion-cli/src/object_storage/instrumented.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ pub enum InstrumentedObjectStoreMode {
5858

5959
impl fmt::Display for InstrumentedObjectStoreMode {
6060
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
61-
write!(f, "{:?}", self)
61+
write!(f, "{self:?}")
6262
}
6363
}
6464

@@ -426,7 +426,7 @@ pub enum Operation {
426426

427427
impl fmt::Display for Operation {
428428
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
429-
write!(f, "{:?}", self)
429+
write!(f, "{self:?}")
430430
}
431431
}
432432

@@ -556,11 +556,11 @@ impl RequestSummaries {
556556
let size_stats = s.size_stats.as_ref();
557557
let dur_avg = duration_stats.map(|d| {
558558
let avg = d.sum.as_secs_f32() / count;
559-
format!("{:.6}s", avg)
559+
format!("{avg:.6}s")
560560
});
561561
let size_avg = size_stats.map(|s| {
562562
let avg = s.sum as f32 / count;
563-
format!("{} B", avg)
563+
format!("{avg} B")
564564
});
565565
[dur_avg, size_avg]
566566
})

datafusion-cli/src/print_options.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ impl PrintOptions {
206206

207207
writeln!(writer, "Summaries:")?;
208208
let summaries = RequestSummaries::new(&requests);
209-
writeln!(writer, "{}", summaries)?;
209+
writeln!(writer, "{summaries}")?;
210210
}
211211
}
212212
}

datafusion/common/src/datatype.rs

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
18+
//! [DataTypeExt] extension trait for converting DataTypes to Fields
19+
20+
use crate::arrow::datatypes::{DataType, Field, FieldRef};
21+
use std::sync::Arc;
22+
23+
/// DataFusion extension methods for Arrow [`DataType`]
24+
pub trait DataTypeExt {
25+
/// Convert the type to field with nullable type and "" name
26+
///
27+
/// This is used to track the places where we convert a [`DataType`]
28+
/// into a nameless field to interact with an API that is
29+
/// capable of representing an extension type and/or nullability.
30+
fn into_nullable_field(self) -> Field;
31+
32+
/// Convert the type to field ref with nullable type and "" name
33+
///
34+
/// Concise wrapper around [`DataTypeExt::into_nullable_field`] that
35+
/// constructs a [`FieldRef`].
36+
fn into_nullable_field_ref(self) -> FieldRef;
37+
}
38+
39+
impl DataTypeExt for DataType {
40+
fn into_nullable_field(self) -> Field {
41+
Field::new("", self, true)
42+
}
43+
44+
fn into_nullable_field_ref(self) -> FieldRef {
45+
Arc::new(Field::new("", self, true))
46+
}
47+
}
48+
49+
/// DataFusion extension methods for Arrow [`Field`]
50+
pub trait FieldExt {
51+
/// Returns a new Field representing a List of this Field's DataType.
52+
fn into_list(self) -> Self;
53+
54+
/// Return a new Field representing this Field as the item type of a FixedSizeList
55+
fn into_fixed_size_list(self, list_size: i32) -> Self;
56+
57+
/// Create a field with the default list field name ("item")
58+
///
59+
/// Note that lists are allowed to have an arbitrarily named field;
60+
/// however, a name other than 'item' will cause it to fail an
61+
/// == check against a more idiomatically created list in
62+
/// arrow-rs which causes issues.
63+
fn into_list_item(self) -> Self;
64+
}
65+
66+
impl FieldExt for Field {
67+
fn into_list(self) -> Self {
68+
DataType::List(Arc::new(self.into_list_item())).into_nullable_field()
69+
}
70+
71+
fn into_fixed_size_list(self, list_size: i32) -> Self {
72+
DataType::FixedSizeList(self.into_list_item().into(), list_size)
73+
.into_nullable_field()
74+
}
75+
76+
fn into_list_item(self) -> Self {
77+
if self.name() != Field::LIST_FIELD_DEFAULT_NAME {
78+
self.with_name(Field::LIST_FIELD_DEFAULT_NAME)
79+
} else {
80+
self
81+
}
82+
}
83+
}
84+
85+
impl FieldExt for Arc<Field> {
86+
fn into_list(self) -> Self {
87+
DataType::List(self.into_list_item())
88+
.into_nullable_field()
89+
.into()
90+
}
91+
92+
fn into_fixed_size_list(self, list_size: i32) -> Self {
93+
DataType::FixedSizeList(self.into_list_item(), list_size)
94+
.into_nullable_field()
95+
.into()
96+
}
97+
98+
fn into_list_item(self) -> Self {
99+
if self.name() != Field::LIST_FIELD_DEFAULT_NAME {
100+
Arc::unwrap_or_clone(self)
101+
.with_name(Field::LIST_FIELD_DEFAULT_NAME)
102+
.into()
103+
} else {
104+
self
105+
}
106+
}
107+
}

datafusion/common/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ pub mod alias;
3939
pub mod cast;
4040
pub mod config;
4141
pub mod cse;
42+
pub mod datatype;
4243
pub mod diagnostic;
4344
pub mod display;
4445
pub mod encryption;
@@ -47,6 +48,7 @@ pub mod file_options;
4748
pub mod format;
4849
pub mod hash_utils;
4950
pub mod instant;
51+
pub mod metadata;
5052
pub mod nested_struct;
5153
mod null_equality;
5254
pub mod parsers;

0 commit comments

Comments
 (0)