File tree 2 files changed +28
-3
lines changed
physical-expr-common/src/expressions
2 files changed +28
-3
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,11 @@ const DEFAULT_CAST_OPTIONS: CastOptions<'static> = CastOptions {
36
36
format_options : DEFAULT_FORMAT_OPTIONS ,
37
37
} ;
38
38
39
+ const DEFAULT_SAFE_CAST_OPTIONS : CastOptions < ' static > = CastOptions {
40
+ safe : true ,
41
+ format_options : DEFAULT_FORMAT_OPTIONS ,
42
+ } ;
43
+
39
44
/// CAST expression casts an expression to a specific data type and returns a runtime error on invalid cast
40
45
#[ derive( Debug , Clone ) ]
41
46
pub struct CastExpr {
@@ -150,9 +155,9 @@ impl PhysicalExpr for CastExpr {
150
155
let child_interval = children[ 0 ] ;
151
156
// Get child's datatype:
152
157
let cast_type = child_interval. data_type ( ) ;
153
- Ok ( Some (
154
- vec ! [ interval. cast_to( & cast_type, & self . cast_options ) ? ] ,
155
- ) )
158
+ Ok ( Some ( vec ! [
159
+ interval. cast_to( & cast_type, & DEFAULT_SAFE_CAST_OPTIONS ) ?
160
+ ] ) )
156
161
}
157
162
158
163
fn dyn_hash ( & self , state : & mut dyn Hasher ) {
Original file line number Diff line number Diff line change @@ -69,3 +69,23 @@ query ?
69
69
SELECT CAST(MAKE_ARRAY() AS VARCHAR[])
70
70
----
71
71
[]
72
+
73
+ statement ok
74
+ create table t0(v0 BIGINT);
75
+
76
+ statement ok
77
+ insert into t0 values (1),(2),(3);
78
+
79
+ query I
80
+ select * from t0 where v0>1e100;
81
+ ----
82
+
83
+ query I
84
+ select * from t0 where v0<1e100;
85
+ ----
86
+ 1
87
+ 2
88
+ 3
89
+
90
+ statement ok
91
+ drop table t0;
You can’t perform that action at this time.
0 commit comments