Commit 992fe5a 1 parent b72701c commit 992fe5a Copy full SHA for 992fe5a
File tree 4 files changed +44
-33
lines changed
4 files changed +44
-33
lines changed Original file line number Diff line number Diff line change @@ -3914,10 +3914,13 @@ mod tests {
3914
3914
. await ?;
3915
3915
3916
3916
// decimal query
3917
- let result = plan_and_collect ( & mut ctx, "select min(c1) from aggregate_simple" )
3918
- . await
3919
- . unwrap ( ) ;
3920
- println ! ( "{:?}" , result) ;
3917
+
3918
+ // let result = plan_and_collect(&mut ctx, "select min(c1) from aggregate_simple")
3919
+ // .await
3920
+ // .unwrap();
3921
+ //
3922
+ // println!("{:?}", result);
3923
+
3921
3924
Ok ( ( ) )
3922
3925
}
3923
3926
Original file line number Diff line number Diff line change @@ -63,16 +63,23 @@ pub fn avg_return_type(arg_type: &DataType) -> Result<DataType> {
63
63
}
64
64
65
65
pub ( crate ) fn is_avg_support_arg_type ( arg_type : & DataType ) -> bool {
66
- match arg_type {
67
- // TODO: do we need to support the unsigned data type?
68
- DataType :: UInt8 | DataType :: UInt16 | DataType :: UInt32 | DataType :: UInt64 => true ,
69
- DataType :: Int8 | DataType :: Int16 | DataType :: Int32 | DataType :: Int64 => true ,
70
- DataType :: Float16 | DataType :: Float32 | DataType :: Float64 => true ,
71
- // TODO support the decimal data type
72
- DataType :: Decimal ( _, _) => true ,
73
- // TODO support the interva
74
- _ => false ,
75
- }
66
+ // TODO support the interval
67
+ // TODO: do we need to support the unsigned data type?
68
+ matches ! (
69
+ arg_type,
70
+ DataType :: UInt8
71
+ | DataType :: UInt16
72
+ | DataType :: UInt32
73
+ | DataType :: UInt64
74
+ | DataType :: Int8
75
+ | DataType :: Int16
76
+ | DataType :: Int32
77
+ | DataType :: Int64
78
+ | DataType :: Float16
79
+ | DataType :: Float32
80
+ | DataType :: Float64
81
+ | DataType :: Decimal ( _, _)
82
+ )
76
83
}
77
84
78
85
impl Avg {
Original file line number Diff line number Diff line change @@ -64,16 +64,23 @@ pub fn sum_return_type(arg_type: &DataType) -> Result<DataType> {
64
64
}
65
65
66
66
pub ( crate ) fn is_sum_support_arg_type ( arg_type : & DataType ) -> bool {
67
- match arg_type {
68
- // TODO: do we need to support the unsigned data type?
69
- DataType :: UInt8 | DataType :: UInt16 | DataType :: UInt32 | DataType :: UInt64 => true ,
70
- DataType :: Int8 | DataType :: Int16 | DataType :: Int32 | DataType :: Int64 => true ,
71
- DataType :: Float16 | DataType :: Float32 | DataType :: Float64 => true ,
72
- // TODO support the decimal data type
73
- DataType :: Decimal ( _, _) => true ,
74
- // TODO support the interva
75
- _ => false ,
76
- }
67
+ // TODO support the interval
68
+ // TODO: do we need to support the unsigned data type?
69
+ matches ! (
70
+ arg_type,
71
+ DataType :: UInt8
72
+ | DataType :: UInt16
73
+ | DataType :: UInt32
74
+ | DataType :: UInt64
75
+ | DataType :: Int8
76
+ | DataType :: Int16
77
+ | DataType :: Int32
78
+ | DataType :: Int64
79
+ | DataType :: Float16
80
+ | DataType :: Float32
81
+ | DataType :: Float64
82
+ | DataType :: Decimal ( _, _)
83
+ )
77
84
}
78
85
79
86
impl Sum {
Original file line number Diff line number Diff line change @@ -145,8 +145,6 @@ fn maybe_data_types(
145
145
valid_types : & [ DataType ] ,
146
146
current_types : & [ DataType ] ,
147
147
) -> Option < Vec < DataType > > {
148
- // TODO liukun4515
149
-
150
148
if valid_types. len ( ) != current_types. len ( ) {
151
149
return None ;
152
150
}
@@ -157,13 +155,10 @@ fn maybe_data_types(
157
155
158
156
if current_type == valid_type {
159
157
new_type. push ( current_type. clone ( ) )
158
+ } else if can_coerce_from ( valid_type, current_type) {
159
+ new_type. push ( valid_type. clone ( ) )
160
160
} else {
161
- if can_coerce_from ( valid_type, current_type) {
162
- new_type. push ( valid_type. clone ( ) )
163
- } else {
164
- // not possible
165
- return None ;
166
- }
161
+ return None ;
167
162
}
168
163
}
169
164
Some ( new_type)
@@ -175,7 +170,6 @@ fn maybe_data_types(
175
170
/// See the module level documentation for more detail on coercion.
176
171
fn can_coerce_from ( type_into : & DataType , type_from : & DataType ) -> bool {
177
172
use self :: DataType :: * ;
178
- // TODO liukun4515
179
173
match type_into {
180
174
// TODO, decimal data type, we just support the decimal
181
175
Int8 => matches ! ( type_from, Int8 ) ,
You can’t perform that action at this time.
0 commit comments