Skip to content

Commit 3da3faf

Browse files
authored
Update expected errors (sqlancer#922)
* Refactor expected errors * Update creation of ExpectedErrors * Expand ExpectedErrors unit tests * Add missing errors to postgres * Update expected errors for sqlite3
1 parent 94b3782 commit 3da3faf

24 files changed

Lines changed: 1028 additions & 278 deletions

src/sqlancer/citus/gen/CitusCommon.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
package sqlancer.citus.gen;
22

3+
import java.util.ArrayList;
4+
import java.util.List;
5+
36
import sqlancer.citus.CitusBugs;
47
import sqlancer.common.query.ExpectedErrors;
58

@@ -8,8 +11,9 @@ public final class CitusCommon {
811
private CitusCommon() {
912
}
1013

11-
public static void addCitusErrors(ExpectedErrors errors) {
14+
public static List<String> getCitusErrors() {
1215
// not supported by Citus
16+
ArrayList<String> errors = new ArrayList<>();
1317
errors.add("failed to evaluate partition key in insert");
1418
errors.add("cannot perform an INSERT without a partition column value");
1519
errors.add("cannot perform an INSERT with NULL in the partition column");
@@ -74,6 +78,11 @@ public static void addCitusErrors(ExpectedErrors errors) {
7478
if (CitusBugs.bug4079) {
7579
errors.add("aggregate function calls cannot be nested");
7680
}
81+
82+
return errors;
7783
}
7884

85+
public static void addCitusErrors(ExpectedErrors errors) {
86+
errors.addAll(getCitusErrors());
87+
}
7988
}
Lines changed: 52 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,85 +1,65 @@
11
package sqlancer.clickhouse;
22

3+
import java.util.List;
4+
35
import sqlancer.common.query.ExpectedErrors;
46

57
public final class ClickHouseErrors {
68

79
private ClickHouseErrors() {
810
}
911

10-
public static void addExpectedExpressionErrors(ExpectedErrors errors) {
11-
errors.add("Argument at index 1 for function like must be constant");
12-
errors.add("Argument at index 1 for function notLike must be constant");
13-
errors.add("Attempt to read after eof: while converting");
14-
errors.add("Bad get: has Int64, requested UInt64");
15-
errors.add("Cannot convert string");
16-
errors.add("Cannot insert NULL value into a column of type");
17-
errors.add("Cannot parse Int32 from String, because value is too short");
18-
errors.add("Cannot parse NaN.: while converting"); // https://github.com/ClickHouse/ClickHouse/issues/22710
19-
errors.add("Cannot parse infinity.");
20-
errors.add("Cannot parse number with a sign character but without any numeric character");
21-
errors.add("Cannot parse number with multiple sign (+/-) characters or intermediate sign character");
22-
errors.add("Cannot parse string");
23-
errors.add("Cannot read floating point value");
24-
errors.add("Cyclic aliases: default expression and column type are incompatible");
25-
errors.add("Directory for table data");
26-
errors.add("Directory not empty");
27-
errors.add("Expected one of: compound identifier, identifier, list of elements (version"); // VALUES ()
28-
errors.add("Function 'like' doesn't support search with non-constant needles in constant haystack");
29-
errors.add("Illegal type");
30-
errors.add("Illegal value (aggregate function) for positional argument in GROUP BY");
31-
errors.add("Invalid escape sequence at the end of LIKE pattern");
32-
errors.add("Invalid type for filter in");
33-
errors.add("Memory limit");
34-
errors.add("OptimizedRegularExpression: cannot compile re2");
35-
errors.add("Partition key cannot contain constants");
36-
errors.add("Positional argument out of bounds");
37-
errors.add("Sampling expression must be present in the primary key");
38-
errors.add("Sorting key cannot contain constants");
39-
errors.add("There is no supertype for types");
40-
errors.add("argument of function");
41-
errors.add("but its arguments considered equal according to constraints");
42-
errors.add("does not return a value of type UInt8");
43-
errors.add("doesn't exist"); // TODO: consecutive test runs can lead to dropped database
44-
errors.add("in block. There are only columns:"); // https://github.com/ClickHouse/ClickHouse/issues/42399
45-
errors.add("invalid character class range");
46-
errors.add("invalid escape sequence");
47-
errors.add("is not under aggregate function and not in GROUP BY");
48-
errors.add("is not under aggregate function");
49-
errors.add("is violated at row 1. Expression:"); // TODO: check constraint on table creation
50-
errors.add(
51-
"is violated, because it is a constant expression returning 0. It is most likely an error in table definition");
52-
errors.add("there are only columns");
53-
errors.add("there are columns");
54-
errors.add("in block. (NOT_FOUND_COLUMN_IN_BLOCK)");
55-
errors.add("Missing columns");
56-
errors.add("Ambiguous column");
57-
errors.add("Must be one unsigned integer type. (ILLEGAL_TYPE_OF_COLUMN_FOR_FILTER)");
58-
errors.add("Floating point partition key is not supported");
59-
errors.add("Cannot get JOIN keys from JOIN ON section");
60-
errors.add("ILLEGAL_DIVISION");
61-
errors.add("DECIMAL_OVERFLOW");
62-
errors.add("Cannot convert out of range floating point value to integer type");
63-
errors.add("Unexpected inf or nan to integer conversion");
64-
errors.add("No such name in Block::erase"); // https://github.com/ClickHouse/ClickHouse/issues/42769
65-
errors.add("EMPTY_LIST_OF_COLUMNS_QUERIED"); // https://github.com/ClickHouse/ClickHouse/issues/43003
66-
errors.add("cannot get JOIN keys. (INVALID_JOIN_ON_EXPRESSION)");
67-
errors.add("AMBIGUOUS_IDENTIFIER");
68-
errors.add("CYCLIC_ALIASES");
69-
errors.add("Positional argument numeric constant expression is not representable as");
70-
errors.add("Positional argument must be constant with numeric type");
71-
errors.add(" is out of bounds. Expected in range");
72-
errors.add("with constants is not supported. (INVALID_JOIN_ON_EXPRESSION)");
73-
errors.add("Unexpected inf or nan to integer conversion");
74-
errors.add("Unsigned type must not contain");
75-
errors.add("Unexpected inf or nan to integer conversion");
12+
public static List<String> getExpectedExpressionErrors() {
13+
return List.of("Argument at index 1 for function like must be constant",
14+
"Argument at index 1 for function notLike must be constant",
15+
"Attempt to read after eof: while converting", "Bad get: has Int64, requested UInt64",
16+
"Cannot convert string", "Cannot insert NULL value into a column of type",
17+
"Cannot parse Int32 from String, because value is too short", "Cannot parse NaN.: while converting", // https://github.com/ClickHouse/ClickHouse/issues/22710
18+
"Cannot parse infinity.", "Cannot parse number with a sign character but without any numeric character",
19+
"Cannot parse number with multiple sign (+/-) characters or intermediate sign character",
20+
"Cannot parse string", "Cannot read floating point value",
21+
"Cyclic aliases: default expression and column type are incompatible", "Directory for table data",
22+
"Directory not empty", "Expected one of: compound identifier, identifier, list of elements (version", // VALUES
23+
// ()
24+
"Function 'like' doesn't support search with non-constant needles in constant haystack", "Illegal type",
25+
"Illegal value (aggregate function) for positional argument in GROUP BY",
26+
"Invalid escape sequence at the end of LIKE pattern", "Invalid type for filter in", "Memory limit",
27+
"OptimizedRegularExpression: cannot compile re2", "Partition key cannot contain constants",
28+
"Positional argument out of bounds", "Sampling expression must be present in the primary key",
29+
"Sorting key cannot contain constants", "There is no supertype for types", "argument of function",
30+
"but its arguments considered equal according to constraints", "does not return a value of type UInt8",
31+
"doesn't exist", // TODO: consecutive test runs can lead to dropped database
32+
"in block. There are only columns:", // https://github.com/ClickHouse/ClickHouse/issues/42399
33+
"invalid character class range", "invalid escape sequence",
34+
"is not under aggregate function and not in GROUP BY", "is not under aggregate function",
35+
"is violated at row 1. Expression:", // TODO: check constraint on table creation
36+
"is violated, because it is a constant expression returning 0. It is most likely an error in table definition",
37+
"there are only columns", "there are columns", "in block. (NOT_FOUND_COLUMN_IN_BLOCK)",
38+
"Missing columns", "Ambiguous column",
39+
"Must be one unsigned integer type. (ILLEGAL_TYPE_OF_COLUMN_FOR_FILTER)",
40+
"Floating point partition key is not supported", "Cannot get JOIN keys from JOIN ON section",
41+
"ILLEGAL_DIVISION", "DECIMAL_OVERFLOW",
42+
"Cannot convert out of range floating point value to integer type",
43+
"Unexpected inf or nan to integer conversion", "No such name in Block::erase", // https://github.com/ClickHouse/ClickHouse/issues/42769
44+
"EMPTY_LIST_OF_COLUMNS_QUERIED", // https://github.com/ClickHouse/ClickHouse/issues/43003
45+
"cannot get JOIN keys. (INVALID_JOIN_ON_EXPRESSION)", "AMBIGUOUS_IDENTIFIER", "CYCLIC_ALIASES",
46+
"Positional argument numeric constant expression is not representable as",
47+
"Positional argument must be constant with numeric type", " is out of bounds. Expected in range",
48+
"with constants is not supported. (INVALID_JOIN_ON_EXPRESSION)",
49+
"Unexpected inf or nan to integer conversion", "Unsigned type must not contain",
50+
"Unexpected inf or nan to integer conversion",
7651

77-
// The way we generate JOINs we can have ambiguous left table column without alias
78-
// We may not count it as an issue, but it makes no sense to add more complex AST generation logic
79-
errors.add("MULTIPLE_EXPRESSIONS_FOR_ALIAS");
80-
errors.add("AMBIGUOUS_IDENTIFIER"); // https://github.com/ClickHouse/ClickHouse/issues/45389
81-
errors.add("AMBIGUOUS_COLUMN_NAME"); // same https://github.com/ClickHouse/ClickHouse/issues/45389
82-
errors.add("Cannot parse number with multiple sign");
52+
// The way we generate JOINs we can have ambiguous left table column without
53+
// alias
54+
// We may not count it as an issue, but it makes no sense to add more complex
55+
// AST generation logic
56+
"MULTIPLE_EXPRESSIONS_FOR_ALIAS", "AMBIGUOUS_IDENTIFIER", // https://github.com/ClickHouse/ClickHouse/issues/45389
57+
"AMBIGUOUS_COLUMN_NAME", // same https://github.com/ClickHouse/ClickHouse/issues/45389
58+
"Cannot parse number with multiple sign");
59+
}
60+
61+
public static void addExpectedExpressionErrors(ExpectedErrors errors) {
62+
errors.addAll(getExpectedExpressionErrors());
8363
}
8464

8565
}

src/sqlancer/cnosdb/CnosDBExpectedError.java

Lines changed: 59 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -6,74 +6,76 @@
66
import sqlancer.common.query.ExpectedErrors;
77

88
public final class CnosDBExpectedError {
9-
private static final List<String> ERRORS = new ArrayList<>();
109

1110
private CnosDBExpectedError() {
1211
}
1312

14-
static {
15-
ERRORS.add("have the same name. Consider aliasing");
16-
ERRORS.add(
13+
public static List<String> getExpectedErrors() {
14+
ArrayList<String> errors = new ArrayList<>();
15+
16+
errors.add("have the same name. Consider aliasing");
17+
errors.add(
1718
"error: Optimizer rule 'projection_push_down' failed due to unexpected error: Schema error: Schema contains duplicate qualified field name");
18-
ERRORS.add("Projection references non-aggregate values:");
19-
ERRORS.add("External err: Schema error: No field named");
20-
ERRORS.add(
19+
errors.add("Projection references non-aggregate values:");
20+
errors.add("External err: Schema error: No field named");
21+
errors.add(
2122
"Optimizer rule 'common_sub_expression_eliminate' failed due to unexpected error: Schema error: No field named");
22-
ERRORS.add("Binary");
23-
ERRORS.add("Invalid pattern in LIKE expression");
24-
ERRORS.add("If the projection contains the time column, it must contain the field column.");
25-
ERRORS.add("Schema error: No field named");
26-
ERRORS.add("Optimizer rule 'simplify_expressions' failed due to unexpected error:");
27-
ERRORS.add("err: Internal error: Optimizer rule 'projection_push_down' failed due to unexpected error");
28-
ERRORS.add("Schema error: No field named ");
29-
ERRORS.add("err: External err: Schema error: No field named");
30-
ERRORS.add("Optimizer rule 'simplify_expressions' failed due to unexpected error");
31-
ERRORS.add("Csv error: CSV Writer does not support List");
32-
ERRORS.add("This feature is not implemented: cross join.");
33-
ERRORS.add("Execution error: field position must be greater than zero");
34-
ERRORS.add("First argument of `DATE_PART` must be non-null scalar Utf8");
35-
ERRORS.add("Cannot create filter with non-boolean predicate 'NULL' returning Null");
36-
ERRORS.add("requested character too large for encoding.");
37-
ERRORS.add("Can not find compatible types to compare Boolean with [Utf8].");
38-
ERRORS.add("Cannot create filter with non-boolean predicate 'APPROXDISTINCT");
39-
ERRORS.add("HAVING clause references non-aggregate values:");
40-
ERRORS.add("Cannot create filter with non-boolean predicate");
41-
ERRORS.add("negative substring length not allowed");
42-
ERRORS.add("The function Sum does not support inputs of type Boolean.");
43-
ERRORS.add("The function Avg does not support inputs of type Boolean.");
44-
ERRORS.add("Percentile value must be between 0.0 and 1.0 inclusive");
45-
ERRORS.add("Date part '' not supported");
46-
ERRORS.add("Min/Max accumulator not implemented for type Boolean.");
47-
ERRORS.add("meta need get_series_id_by_filter");
48-
ERRORS.add("Arrow: Cast error:");
49-
ERRORS.add("Arrow error: Cast error:");
50-
ERRORS.add("Datafusion: Execution error: Arrow error: External error: Arrow error: Cast error:");
51-
ERRORS.add("Arrow error: Divide by zero error");
52-
ERRORS.add("desired percentile argument must be float literal");
53-
ERRORS.add("Unsupported CAST from Int32 to Timestamp(Nanosecond, None)");
54-
ERRORS.add("Execution error: Date part");
55-
ERRORS.add("Physical plan does not support logical expression MIN(Boolean");
56-
ERRORS.add("The percentile argument for ApproxPercentileCont must be Float64, not Int64");
57-
ERRORS.add("The percentile argument for ApproxPercentileContWithWeight must be Float64, not Int64.");
58-
ERRORS.add("Data type UInt64 not supported for binary operation '#' on dyn arrays.");
59-
ERRORS.add("Arrow: Divide by zero error");
60-
ERRORS.add("The function ApproxPercentileCont does not support inputs of type Null.");
61-
ERRORS.add("can't be evaluated because there isn't a common type to coerce the types to");
62-
ERRORS.add("This was likely caused by a bug in DataFusion's code and we would welcome that you file an bug");
63-
ERRORS.add("The function ApproxMedian does not support inputs of type Null.");
64-
ERRORS.add("null character not permitted.");
65-
ERRORS.add("The percentile argument for ApproxPercentileCont must be Float64, not Null.");
66-
ERRORS.add("This feature is not implemented");
67-
ERRORS.add("The function Avg does not support inputs of type Null.");
68-
ERRORS.add("Coercion from [Utf8, Timestamp(Nanosecond, Some(\\\"+00:00\\\"))]");
69-
ERRORS.add(
23+
errors.add("Binary");
24+
errors.add("Invalid pattern in LIKE expression");
25+
errors.add("If the projection contains the time column, it must contain the field column.");
26+
errors.add("Schema error: No field named");
27+
errors.add("Optimizer rule 'simplify_expressions' failed due to unexpected error:");
28+
errors.add("err: Internal error: Optimizer rule 'projection_push_down' failed due to unexpected error");
29+
errors.add("Schema error: No field named ");
30+
errors.add("err: External err: Schema error: No field named");
31+
errors.add("Optimizer rule 'simplify_expressions' failed due to unexpected error");
32+
errors.add("Csv error: CSV Writer does not support List");
33+
errors.add("This feature is not implemented: cross join.");
34+
errors.add("Execution error: field position must be greater than zero");
35+
errors.add("First argument of `DATE_PART` must be non-null scalar Utf8");
36+
errors.add("Cannot create filter with non-boolean predicate 'NULL' returning Null");
37+
errors.add("requested character too large for encoding.");
38+
errors.add("Can not find compatible types to compare Boolean with [Utf8].");
39+
errors.add("Cannot create filter with non-boolean predicate 'APPROXDISTINCT");
40+
errors.add("HAVING clause references non-aggregate values:");
41+
errors.add("Cannot create filter with non-boolean predicate");
42+
errors.add("negative substring length not allowed");
43+
errors.add("The function Sum does not support inputs of type Boolean.");
44+
errors.add("The function Avg does not support inputs of type Boolean.");
45+
errors.add("Percentile value must be between 0.0 and 1.0 inclusive");
46+
errors.add("Date part '' not supported");
47+
errors.add("Min/Max accumulator not implemented for type Boolean.");
48+
errors.add("meta need get_series_id_by_filter");
49+
errors.add("Arrow: Cast error:");
50+
errors.add("Arrow error: Cast error:");
51+
errors.add("Datafusion: Execution error: Arrow error: External error: Arrow error: Cast error:");
52+
errors.add("Arrow error: Divide by zero error");
53+
errors.add("desired percentile argument must be float literal");
54+
errors.add("Unsupported CAST from Int32 to Timestamp(Nanosecond, None)");
55+
errors.add("Execution error: Date part");
56+
errors.add("Physical plan does not support logical expression MIN(Boolean");
57+
errors.add("The percentile argument for ApproxPercentileCont must be Float64, not Int64");
58+
errors.add("The percentile argument for ApproxPercentileContWithWeight must be Float64, not Int64.");
59+
errors.add("Data type UInt64 not supported for binary operation '#' on dyn arrays.");
60+
errors.add("Arrow: Divide by zero error");
61+
errors.add("The function ApproxPercentileCont does not support inputs of type Null.");
62+
errors.add("can't be evaluated because there isn't a common type to coerce the types to");
63+
errors.add("This was likely caused by a bug in DataFusion's code and we would welcome that you file an bug");
64+
errors.add("The function ApproxMedian does not support inputs of type Null.");
65+
errors.add("null character not permitted.");
66+
errors.add("The percentile argument for ApproxPercentileCont must be Float64, not Null.");
67+
errors.add("This feature is not implemented");
68+
errors.add("The function Avg does not support inputs of type Null.");
69+
errors.add("Coercion from [Utf8, Timestamp(Nanosecond, Some(\\\"+00:00\\\"))]");
70+
errors.add(
7071
"Coercion from [Utf8, Float64, Utf8] to the signature OneOf([Exact([Utf8, Int64]), Exact([LargeUtf8, Int64]), Exact([Utf8, Int64, Utf8]), Exact([LargeUtf8, Int64, Utf8]), Exact([Utf8, Int64, LargeUtf8]), Exact([LargeUtf8, Int64, LargeUtf8])]) failed.");
71-
ERRORS.add("Coercion from");
72+
errors.add("Coercion from");
73+
return errors;
7274
}
7375

7476
public static ExpectedErrors expectedErrors() {
7577
ExpectedErrors res = new ExpectedErrors();
76-
res.addAll(ERRORS);
78+
res.addAll(getExpectedErrors());
7779
return res;
7880
}
7981

0 commit comments

Comments
 (0)