You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by ji...@apache.org on 2021/11/06 13:21:26 UTC
[arrow-datafusion] branch master updated: numerical_coercion
pattern match optimize (#1256)
This is an automated email from the ASF dual-hosted git repository.
jiayuliu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-datafusion.git
The following commit(s) were added to refs/heads/master by this push:
new e49d4c7 numerical_coercion pattern match optimize (#1256)
e49d4c7 is described below
commit e49d4c797aeede8825d6033754080b9caa6a9561
Author: Jiayu Liu <Ji...@users.noreply.github.com>
AuthorDate: Sat Nov 6 21:21:18 2021 +0800
numerical_coercion pattern match optimize (#1256)
---
.../src/physical_plan/expressions/coercion.rs | 40 ++++++----------------
1 file changed, 10 insertions(+), 30 deletions(-)
diff --git a/datafusion/src/physical_plan/expressions/coercion.rs b/datafusion/src/physical_plan/expressions/coercion.rs
index fe073df..180b165 100644
--- a/datafusion/src/physical_plan/expressions/coercion.rs
+++ b/datafusion/src/physical_plan/expressions/coercion.rs
@@ -128,36 +128,16 @@ pub fn numerical_coercion(lhs_type: &DataType, rhs_type: &DataType) -> Option<Da
// these are ordered from most informative to least informative so
// that the coercion removes the least amount of information
match (lhs_type, rhs_type) {
- (Float64, _) => Some(Float64),
- (_, Float64) => Some(Float64),
-
- (_, Float32) => Some(Float32),
- (Float32, _) => Some(Float32),
-
- (Int64, _) => Some(Int64),
- (_, Int64) => Some(Int64),
-
- (Int32, _) => Some(Int32),
- (_, Int32) => Some(Int32),
-
- (Int16, _) => Some(Int16),
- (_, Int16) => Some(Int16),
-
- (Int8, _) => Some(Int8),
- (_, Int8) => Some(Int8),
-
- (UInt64, _) => Some(UInt64),
- (_, UInt64) => Some(UInt64),
-
- (UInt32, _) => Some(UInt32),
- (_, UInt32) => Some(UInt32),
-
- (UInt16, _) => Some(UInt16),
- (_, UInt16) => Some(UInt16),
-
- (UInt8, _) => Some(UInt8),
- (_, UInt8) => Some(UInt8),
-
+ (Float64, _) | (_, Float64) => Some(Float64),
+ (_, Float32) | (Float32, _) => Some(Float32),
+ (Int64, _) | (_, Int64) => Some(Int64),
+ (Int32, _) | (_, Int32) => Some(Int32),
+ (Int16, _) | (_, Int16) => Some(Int16),
+ (Int8, _) | (_, Int8) => Some(Int8),
+ (UInt64, _) | (_, UInt64) => Some(UInt64),
+ (UInt32, _) | (_, UInt32) => Some(UInt32),
+ (UInt16, _) | (_, UInt16) => Some(UInt16),
+ (UInt8, _) | (_, UInt8) => Some(UInt8),
_ => None,
}
}