@@ -24,7 +24,6 @@ use ordered_float::OrderedFloat;
24
24
use serde:: Deserialize ;
25
25
use serde:: Serialize ;
26
26
27
- use crate :: ColumnBuilder ;
28
27
use crate :: property:: Domain ;
29
28
use crate :: types:: ArgType ;
30
29
use crate :: types:: DataType ;
@@ -33,6 +32,7 @@ use crate::types::ValueType;
33
32
use crate :: util:: buffer_into_mut;
34
33
use crate :: values:: Column ;
35
34
use crate :: values:: Scalar ;
35
+ use crate :: ColumnBuilder ;
36
36
use crate :: ScalarRef ;
37
37
38
38
pub type F32 = OrderedFloat < f32 > ;
@@ -52,11 +52,10 @@ pub type UInt64Type = NumberType<u64>;
52
52
pub type Float32Type = NumberType < F32 > ;
53
53
pub type Float64Type = NumberType < F64 > ;
54
54
55
-
56
- impl < Num : Number > NumberType < Num > {
57
- pub fn try_downcast_builder < ' a > ( builder : & ' a mut ColumnBuilder ) -> Option < & ' a mut Vec < Num > > {
55
+ impl < Num : Number > NumberType < Num > {
56
+ pub fn try_downcast_builder < ' a > ( builder : & ' a mut ColumnBuilder ) -> Option < & ' a mut Vec < Num > > {
58
57
match builder {
59
- ColumnBuilder :: Number ( num) => Num :: try_downcast_builder ( num) ,
58
+ ColumnBuilder :: Number ( num) => Num :: try_downcast_builder ( num) ,
60
59
_ => None ,
61
60
}
62
61
}
@@ -831,8 +830,6 @@ fn overflow_cast<T: Number, U: Number>(src: T) -> (U, bool) {
831
830
( dest, overflowing)
832
831
}
833
832
834
-
835
-
836
833
#[ macro_export]
837
834
macro_rules! with_number_type {
838
835
( | $t: tt | $( $tail: tt) * ) => {
@@ -858,15 +855,27 @@ macro_rules! with_number_mapped_type {
858
855
}
859
856
860
857
pub trait Number :
861
- Copy + Debug + NumCast + Default + Clone + Copy + PartialEq + Eq + PartialOrd + Ord + Sync + Send + ' static
858
+ Copy
859
+ + Debug
860
+ + NumCast
861
+ + Default
862
+ + Clone
863
+ + Copy
864
+ + PartialEq
865
+ + Eq
866
+ + PartialOrd
867
+ + Ord
868
+ + Sync
869
+ + Send
870
+ + ' static
862
871
{
863
872
const MIN : Self ;
864
873
const MAX : Self ;
865
874
866
875
fn data_type ( ) -> NumberDataType ;
867
876
fn try_downcast_scalar ( scalar : & NumberScalar ) -> Option < Self > ;
868
877
fn try_downcast_column ( col : & NumberColumn ) -> Option < Buffer < Self > > ;
869
- //TODO
878
+ // TODO
870
879
fn try_downcast_builder ( col : & mut NumberColumnBuilder ) -> Option < & mut Vec < Self > > ;
871
880
fn try_downcast_domain ( domain : & NumberDomain ) -> Option < SimpleDomain < Self > > ;
872
881
fn upcast_scalar ( scalar : Self ) -> NumberScalar ;
@@ -927,7 +936,7 @@ impl Number for u16 {
927
936
col. as_u_int16 ( ) . cloned ( )
928
937
}
929
938
930
- fn try_downcast_builder ( builder : & mut NumberColumnBuilder ) -> Option < & mut Vec < Self > > {
939
+ fn try_downcast_builder ( builder : & mut NumberColumnBuilder ) -> Option < & mut Vec < Self > > {
931
940
builder. as_u_int16_mut ( )
932
941
}
933
942
@@ -964,7 +973,7 @@ impl Number for u32 {
964
973
col. as_u_int32 ( ) . cloned ( )
965
974
}
966
975
967
- fn try_downcast_builder ( builder : & mut NumberColumnBuilder ) -> Option < & mut Vec < Self > > {
976
+ fn try_downcast_builder ( builder : & mut NumberColumnBuilder ) -> Option < & mut Vec < Self > > {
968
977
builder. as_u_int32_mut ( )
969
978
}
970
979
@@ -1001,7 +1010,7 @@ impl Number for u64 {
1001
1010
col. as_u_int64 ( ) . cloned ( )
1002
1011
}
1003
1012
1004
- fn try_downcast_builder ( builder : & mut NumberColumnBuilder ) -> Option < & mut Vec < Self > > {
1013
+ fn try_downcast_builder ( builder : & mut NumberColumnBuilder ) -> Option < & mut Vec < Self > > {
1005
1014
builder. as_u_int64_mut ( )
1006
1015
}
1007
1016
@@ -1038,7 +1047,7 @@ impl Number for i8 {
1038
1047
col. as_int8 ( ) . cloned ( )
1039
1048
}
1040
1049
1041
- fn try_downcast_builder ( builder : & mut NumberColumnBuilder ) -> Option < & mut Vec < Self > > {
1050
+ fn try_downcast_builder ( builder : & mut NumberColumnBuilder ) -> Option < & mut Vec < Self > > {
1042
1051
builder. as_int8_mut ( )
1043
1052
}
1044
1053
@@ -1075,7 +1084,7 @@ impl Number for i16 {
1075
1084
col. as_int16 ( ) . cloned ( )
1076
1085
}
1077
1086
1078
- fn try_downcast_builder ( builder : & mut NumberColumnBuilder ) -> Option < & mut Vec < Self > > {
1087
+ fn try_downcast_builder ( builder : & mut NumberColumnBuilder ) -> Option < & mut Vec < Self > > {
1079
1088
builder. as_int16_mut ( )
1080
1089
}
1081
1090
@@ -1112,7 +1121,7 @@ impl Number for i32 {
1112
1121
col. as_int32 ( ) . cloned ( )
1113
1122
}
1114
1123
1115
- fn try_downcast_builder ( builder : & mut NumberColumnBuilder ) -> Option < & mut Vec < Self > > {
1124
+ fn try_downcast_builder ( builder : & mut NumberColumnBuilder ) -> Option < & mut Vec < Self > > {
1116
1125
builder. as_int32_mut ( )
1117
1126
}
1118
1127
@@ -1149,15 +1158,14 @@ impl Number for i64 {
1149
1158
col. as_int64 ( ) . cloned ( )
1150
1159
}
1151
1160
1152
- fn try_downcast_builder ( builder : & mut NumberColumnBuilder ) -> Option < & mut Vec < Self > > {
1161
+ fn try_downcast_builder ( builder : & mut NumberColumnBuilder ) -> Option < & mut Vec < Self > > {
1153
1162
builder. as_int64_mut ( )
1154
1163
}
1155
1164
1156
1165
fn try_downcast_domain ( domain : & NumberDomain ) -> Option < SimpleDomain < Self > > {
1157
1166
domain. as_int64 ( ) . cloned ( )
1158
1167
}
1159
1168
1160
-
1161
1169
fn upcast_scalar ( scalar : Self ) -> NumberScalar {
1162
1170
NumberScalar :: Int64 ( scalar)
1163
1171
}
@@ -1187,7 +1195,7 @@ impl Number for F32 {
1187
1195
col. as_float32 ( ) . cloned ( )
1188
1196
}
1189
1197
1190
- fn try_downcast_builder ( builder : & mut NumberColumnBuilder ) -> Option < & mut Vec < Self > > {
1198
+ fn try_downcast_builder ( builder : & mut NumberColumnBuilder ) -> Option < & mut Vec < Self > > {
1191
1199
builder. as_float32_mut ( )
1192
1200
}
1193
1201
@@ -1224,7 +1232,7 @@ impl Number for F64 {
1224
1232
col. as_float64 ( ) . cloned ( )
1225
1233
}
1226
1234
1227
- fn try_downcast_builder ( builder : & mut NumberColumnBuilder ) -> Option < & mut Vec < Self > > {
1235
+ fn try_downcast_builder ( builder : & mut NumberColumnBuilder ) -> Option < & mut Vec < Self > > {
1228
1236
builder. as_float64_mut ( )
1229
1237
}
1230
1238
0 commit comments