@@ -169,6 +169,8 @@ pub enum BuiltinScalarFunction {
169169 NullIf ,
170170 /// octet_length
171171 OctetLength ,
172+ /// random
173+ Random ,
172174 /// regexp_replace
173175 RegexpReplace ,
174176 /// repeat
@@ -267,6 +269,7 @@ impl FromStr for BuiltinScalarFunction {
267269 "md5" => BuiltinScalarFunction :: MD5 ,
268270 "nullif" => BuiltinScalarFunction :: NullIf ,
269271 "octet_length" => BuiltinScalarFunction :: OctetLength ,
272+ "random" => BuiltinScalarFunction :: Random ,
270273 "regexp_replace" => BuiltinScalarFunction :: RegexpReplace ,
271274 "repeat" => BuiltinScalarFunction :: Repeat ,
272275 "replace" => BuiltinScalarFunction :: Replace ,
@@ -430,6 +433,7 @@ pub fn return_type(
430433 ) ) ;
431434 }
432435 } ) ,
436+ BuiltinScalarFunction :: Random => Ok ( DataType :: Float64 ) ,
433437 BuiltinScalarFunction :: RegexpReplace => Ok ( match arg_types[ 0 ] {
434438 DataType :: LargeUtf8 => DataType :: LargeUtf8 ,
435439 DataType :: Utf8 => DataType :: Utf8 ,
@@ -734,6 +738,7 @@ pub fn create_physical_expr(
734738 BuiltinScalarFunction :: Ln => math_expressions:: ln,
735739 BuiltinScalarFunction :: Log10 => math_expressions:: log10,
736740 BuiltinScalarFunction :: Log2 => math_expressions:: log2,
741+ BuiltinScalarFunction :: Random => math_expressions:: random,
737742 BuiltinScalarFunction :: Round => math_expressions:: round,
738743 BuiltinScalarFunction :: Signum => math_expressions:: signum,
739744 BuiltinScalarFunction :: Sin => math_expressions:: sin,
@@ -1299,6 +1304,7 @@ fn signature(fun: &BuiltinScalarFunction) -> Signature {
12991304 Signature :: Exact ( vec![ DataType :: Utf8 , DataType :: Utf8 , DataType :: Utf8 ] ) ,
13001305 Signature :: Exact ( vec![ DataType :: LargeUtf8 , DataType :: Utf8 , DataType :: Utf8 ] ) ,
13011306 ] ) ,
1307+ BuiltinScalarFunction :: Random => Signature :: Exact ( vec ! [ ] ) ,
13021308 // math expressions expect 1 argument of type f64 or f32
13031309 // priority is given to f64 because e.g. `sqrt(1i32)` is in IR (real numbers) and thus we
13041310 // return the best approximation for it (in f64).
0 commit comments