Skip to content

Commit

Permalink
fix: function uuid() should be non_deterministic. (#15840)
Browse files Browse the repository at this point in the history
  • Loading branch information
youngsofun authored Jun 20, 2024
1 parent 1b9d28c commit 6e784b5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/query/functions/src/scalars/other.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ pub fn register(registry: &mut FunctionRegistry) {
FunctionProperty::default().non_deterministic(),
);

registry.properties.insert(
"gen_random_uuid".to_string(),
FunctionProperty::default().non_deterministic(),
);

registry.register_passthrough_nullable_1_arg::<Float64Type, StringType, _, _>(
"humanize_size",
|_, _| FunctionDomain::Full,
Expand Down
2 changes: 1 addition & 1 deletion src/query/sql/src/planner/expression_parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ pub fn parse_default_expr_to_string(
let expr = scalar.as_expr()?;

// Added columns are not allowed to use expressions,
// as the default values will be generated at at each query.
// as the default values will be generated at each query.
if is_add_column && !expr.is_deterministic(&BUILTIN_FUNCTIONS) {
return Err(ErrorCode::SemanticError(format!(
"default expression `{}` is not a valid constant. Please provide a valid constant expression as the default value.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -557,3 +557,9 @@ select count(*) from t;

statement ok
drop table t

statement error 1081.*is not deterministic
create table t(a int) cluster by (a+rand())

statement error 1081.*is not deterministic
create table t(a string) cluster by (a+uuid())

0 comments on commit 6e784b5

Please sign in to comment.