Skip to content

Commit 40598c2

Browse files
committed
feat: float signature class
1 parent 32ce88b commit 40598c2

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

datafusion/common/src/types/native.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,12 @@ impl NativeType {
436436
)
437437
}
438438

439+
#[inline]
440+
pub fn is_float(&self) -> bool {
441+
use NativeType::*;
442+
matches!(self, Float16 | Float32 | Float64)
443+
}
444+
439445
#[inline]
440446
pub fn is_integer(&self) -> bool {
441447
use NativeType::*;

datafusion/expr-common/src/signature.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ pub enum TypeSignatureClass {
216216
Duration,
217217
Native(LogicalTypeRef),
218218
Numeric,
219+
Float,
219220
Integer,
220221
}
221222

@@ -258,6 +259,9 @@ impl TypeSignatureClass {
258259
DataType::Decimal256(3, -2),
259260
]
260261
}
262+
TypeSignatureClass::Float => {
263+
vec![DataType::Float64]
264+
}
261265
TypeSignatureClass::Integer => {
262266
vec![DataType::Int64]
263267
}
@@ -280,6 +284,7 @@ impl TypeSignatureClass {
280284
TypeSignatureClass::Interval if logical_type.is_interval() => true,
281285
TypeSignatureClass::Duration if logical_type.is_duration() => true,
282286
TypeSignatureClass::Numeric if logical_type.is_numeric() => true,
287+
TypeSignatureClass::Float if logical_type.is_float() => true,
283288
TypeSignatureClass::Integer if logical_type.is_integer() => true,
284289
_ => false,
285290
}
@@ -311,6 +316,9 @@ impl TypeSignatureClass {
311316
TypeSignatureClass::Numeric if native_type.is_numeric() => {
312317
Ok(origin_type.to_owned())
313318
}
319+
TypeSignatureClass::Float if native_type.is_float() => {
320+
Ok(origin_type.to_owned())
321+
}
314322
TypeSignatureClass::Integer if native_type.is_integer() => {
315323
Ok(origin_type.to_owned())
316324
}

0 commit comments

Comments
 (0)