Skip to content

Commit f9b0b36

Browse files
committed
Lints and formatting
1 parent 6e1522e commit f9b0b36

4 files changed

Lines changed: 15 additions & 20 deletions

File tree

datafusion-examples/examples/extension_types/event_id.rs

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -67,18 +67,10 @@ async fn register_events_table(ctx: &SessionContext) -> Result<DataFrame> {
6767
schema,
6868
vec![
6969
Arc::new(UInt32Array::from(vec![
70-
20_01_000000,
71-
20_01_000001,
72-
21_03_000000,
73-
21_03_000001,
74-
21_03_000002,
70+
2001000000, 2001000001, 2103000000, 2103000001, 2103000002,
7571
])),
7672
Arc::new(UInt32Array::from(vec![
77-
2020_01_0000,
78-
2020_01_0001,
79-
2021_03_0000,
80-
2021_03_0001,
81-
2021_03_0002,
73+
2020010000, 2020010001, 2021030000, 2021030001, 2021030002,
8274
])),
8375
Arc::new(StringArray::from(vec![
8476
"First Event Jan 2020",
@@ -167,8 +159,7 @@ impl ExtensionType for EventIdExtensionType {
167159
"short" => Ok(IdYearMode::Short),
168160
"long" => Ok(IdYearMode::Long),
169161
_ => Err(ArrowError::InvalidArgumentError(format!(
170-
"Invalid metadata for event id type: {}",
171-
metadata
162+
"Invalid metadata for event id type: {metadata}"
172163
))),
173164
},
174165
}
@@ -256,7 +247,7 @@ impl DisplayIndex for EventIdDisplayIndex<'_> {
256247
let month = rest % 100;
257248
let year = rest / 100;
258249

259-
write!(f, "{:02}-{:02}-{:06}", year, month, counter)?;
250+
write!(f, "{year:02}-{month:02}-{counter:06}")?;
260251
}
261252
IdYearMode::Long => {
262253
// Format: YYYY-MM-CCCC
@@ -269,7 +260,7 @@ impl DisplayIndex for EventIdDisplayIndex<'_> {
269260
let month = rest % 100;
270261
let year = rest / 100;
271262

272-
write!(f, "{:04}-{:02}-{:04}", year, month, counter)?;
263+
write!(f, "{year:04}-{month:02}-{counter:04}")?;
273264
}
274265
}
275266
Ok(())

datafusion/common/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ apache-avro = { workspace = true, features = [
6666
"zstandard",
6767
], optional = true }
6868
arrow = { workspace = true }
69-
arrow-schema = { workspace = true, features = ["canonical_extension_types"] }
7069
arrow-ipc = { workspace = true }
70+
arrow-schema = { workspace = true, features = ["canonical_extension_types"] }
7171
chrono = { workspace = true }
7272
half = { workspace = true }
7373
hashbrown = { workspace = true }

datafusion/common/src/types/extension.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ pub type DFExtensionTypeRef = Arc<dyn DFExtensionType>;
3232
/// from these operations. The extension type mechanism allows users to define how these operations
3333
/// apply to a particular extension type.
3434
///
35-
/// For example, adding two values of [`DataType::Int64`] is a sensible thing to do. However, if the
36-
/// same column is annotated with an extension type like `custom.id`, the correct interpretation of
37-
/// a column changes. Adding together two `custom.id` values, even though they are stored as
38-
/// integers, may no longer make sense.
35+
/// For example, adding two values of [`Int64`](arrow::datatypes::DataType::Int64) is a sensible
36+
/// thing to do. However, if the same column is annotated with an extension type like `custom.id`,
37+
/// the correct interpretation of a column changes. Adding together two `custom.id` values, even
38+
/// though they are stored as integers, may no longer make sense.
3939
///
4040
/// Note that DataFusion's extension type support is still young and therefore might not cover all
4141
/// relevant use cases. Currently, the following operations can be customized:

datafusion/expr/src/registry.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,11 @@ pub trait ExtensionTypeRegistration: Debug + Send + Sync {
258258
/// A cheaply cloneable pointer to an [ExtensionTypeRegistry].
259259
pub type ExtensionTypeRegistryRef = Arc<dyn ExtensionTypeRegistry>;
260260

261-
/// Supports registering custom [LogicalType]s, including native types.
261+
/// Manages [`ExtensionTypeRegistration`]s, which allow users to register custom behavior for
262+
/// extension types.
263+
///
264+
/// Each registration is connected to the extension type name, which can also be looked up to get
265+
/// the registration.
262266
pub trait ExtensionTypeRegistry: Debug + Send + Sync {
263267
/// Returns a reference to registration of an extension type named `name`.
264268
///

0 commit comments

Comments
 (0)