risingwave_sqlsmith/
validation.rs1use risingwave_expr::ExprError;
17
18fn is_zero_err(db_error: &str) -> bool {
20 db_error.contains(&ExprError::DivisionByZero.to_string()) || db_error.contains("can't be zero")
21}
22
23fn is_numeric_out_of_range_err(db_error: &str) -> bool {
29 db_error.contains(&ExprError::NumericOutOfRange.to_string())
30 || db_error.contains("Casting to u32 out of range")
31}
32
33fn is_parse_err(db_error: &str) -> bool {
34 db_error.contains("Parse error")
35}
36
37fn is_unimplemented_error(db_error: &str) -> bool {
39 db_error.contains("not yet implemented")
40}
41
42fn not_unique_error(db_error: &str) -> bool {
47 db_error.contains("Bind error") && db_error.contains("is not unique")
48}
49
50fn is_window_error(db_error: &str) -> bool {
51 db_error.contains("Bind error: The size arg of window table function should be an interval literal")
52 || db_error.contains("Bind error: The 2nd arg of window table function should be a column name but not complex expression. Consider using an intermediate CTE or view as workaround")
53}
54
55fn is_nested_loop_join_error(db_error: &str) -> bool {
57 db_error.contains("Not supported: streaming nested-loop join")
58}
59
60fn is_subquery_unnesting_error(db_error: &str) -> bool {
61 db_error.contains("Subquery can not be unnested")
62 || db_error.contains("Scalar subquery might produce more than one row")
63}
64
65fn is_numeric_overflow_error(db_error: &str) -> bool {
67 db_error.contains("Number") && db_error.contains("overflows")
68}
69
70fn is_neg_substr_error(db_error: &str) -> bool {
72 db_error.contains("negative substring length not allowed")
73}
74
75fn is_overlay_start_error(db_error: &str) -> bool {
77 db_error.contains("Invalid parameter start") && db_error.contains("is not positive")
78}
79
80fn is_broken_channel_error(db_error: &str) -> bool {
82 db_error.contains("failed to finish command: channel closed")
83}
84
85pub fn is_recovery_in_progress_error(db_error: &str) -> bool {
99 db_error.contains("Barrier read is unavailable for now. Likely the cluster is recovering")
100 || db_error.contains("Service unavailable: The cluster is starting or recovering")
101}
102
103pub fn is_neg_exp_error(db_error: &str) -> bool {
104 db_error.contains("zero raised to a negative power is undefined")
105}
106
107pub fn is_neg_input_error(db_error: &str) -> bool {
108 db_error.contains("input cannot be negative value")
109}
110
111pub fn is_permissible_error(db_error: &str) -> bool {
115 is_numeric_out_of_range_err(db_error)
116 || is_zero_err(db_error)
117 || is_parse_err(db_error)
118 || is_unimplemented_error(db_error)
119 || not_unique_error(db_error)
120 || is_window_error(db_error)
121 || is_nested_loop_join_error(db_error)
122 || is_subquery_unnesting_error(db_error)
123 || is_numeric_overflow_error(db_error)
124 || is_neg_substr_error(db_error)
125 || is_overlay_start_error(db_error)
126 || is_broken_channel_error(db_error)
127 || is_neg_exp_error(db_error)
128 || is_neg_input_error(db_error)
129}